Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: use ring buffer for network input #1591

Merged
merged 3 commits into from
Jan 11, 2018
Merged

Conversation

qlyoung
Copy link
Member

@qlyoung qlyoung commented Jan 3, 2018

The multithreading code has a comment that reads:
"XXX: Heavy abuse of stream API. This needs a ring buffer."

This patch makes the relevant code use a ring buffer.

Quick 'n easy way to copy the contents of one ringbuf to another.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Fix rare failure caused when end pointer is at end of buffer memory
  and a call to ringbuf_get() is made that reads all of the data in the
  buffer; start pointer was advanced past end pointer, causing some
  special handling to be skipped
* Fix ringbuf_peek() moving start pointer
* Fix use after free
* Remove extraneous assignment
* Update relevant tests

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
The multithreading code has a comment that reads:
"XXX: Heavy abuse of stream API. This needs a ring buffer."

This patch makes the relevant code use a ring buffer.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
@LabN-CI
Copy link
Collaborator

LabN-CI commented Jan 3, 2018

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/1591 74ffbfe
Date 01/03/2018
Start 15:15:09
Finish 15:38:02
Run-Time 22:53
Total 1808
Pass 1808
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2018-01-03-15:15:09.txt
Log autoscript-2018-01-03-15:15:46.log.bz2

For details, please contact louberger

lib/ringbuf.c Outdated
size_t tocopy = MIN(ringbuf_space(to), size);
uint8_t *cbuf = XCALLOC(MTYPE_TMP, tocopy);
tocopy = ringbuf_peek(from, 0, cbuf, tocopy);
XFREE(MTYPE_TMP, cbuf);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, doesn't cbuf get set to NULL here? How does this work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I fixed that in the commit afterwards, look at the final diff not the commit diff

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-2246/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 1591, comparing to Git base SHA 9bc82f1

No Changes in Static Analysis warnings compared to base

21 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-2246/artifact/shared/static_analysis/index.html

@donaldsharp donaldsharp requested a review from riw777 January 9, 2018 16:32
@riw777 riw777 merged commit 2ed7e4c into FRRouting:master Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants