-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
zebra/fpm: fix shutdown and add more documentation #6253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution to FRR!
Click for style suggestions
To apply these suggestions:
curl -s https://gist.githubusercontent.com/polychaeta/8f12886fa15c66c61cfe28d22d2406b7/raw/d3e1b5e78de971828505be2c614e99f61a58c364/cr_6253_1587140461.diff | git apply
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 143354b16..78dfedf3f 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -3565,7 +3565,7 @@ void zebra_dplane_pre_finish(void)
zdplane_info.dg_is_shutdown = true;
/* Notify provider(s) of pending shutdown. */
- TAILQ_FOREACH(dp, &zdplane_info.dg_providers_q, dp_prov_link) {
+ TAILQ_FOREACH (dp, &zdplane_info.dg_providers_q, dp_prov_link) {
if (dp->dp_fini == NULL)
continue;
@@ -3892,7 +3892,7 @@ void zebra_dplane_shutdown(void)
zdplane_info.dg_master = NULL;
/* Notify provider(s) of final shutdown. */
- TAILQ_FOREACH(dp, &zdplane_info.dg_providers_q, dp_prov_link) {
+ TAILQ_FOREACH (dp, &zdplane_info.dg_providers_q, dp_prov_link) {
if (dp->dp_fini == NULL)
continue;
If you are a new contributor to FRR, please see our contributing guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had one question about the fpm callback?
zebra/dplane_fpm_nl.c
Outdated
close(fnc->socket); | ||
|
||
/* This is the late call: stop the thread. */ | ||
if (early == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm - maybe it's just a style nit, but I find the flow a little hard to follow. couldn't it be:
if (early) {
do early stuff
return 0;
} else {
/* it's the real end */
do final stuff
return 0;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO that looks the same to me... I think my initial code looks cleaner since it avoids an extra indentation level. If this bothers too much, maybe I'll split it into two functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another nit, please don't compare bools to true / false, just test them directly; I did a mass conversion to fix all of these a while back and would like to keep it that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in last push.
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
doc/developer/fpm.rst
Outdated
FPM | ||
=== | ||
|
||
FPM stands for Forwarding Plane Manager and it's a ``zebra``'s daemon module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"it's a module for use with Zebra" or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
zebra/dplane_fpm_nl.c
Outdated
close(fnc->socket); | ||
|
||
/* This is the late call: stop the thread. */ | ||
if (early == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another nit, please don't compare bools to true / false, just test them directly; I did a mass conversion to fix all of these a while back and would like to keep it that way
zebra/dplane_fpm_nl.c
Outdated
THREAD_OFF(fnc->t_ribwalk); | ||
THREAD_OFF(fnc->t_rmacreset); | ||
THREAD_OFF(fnc->t_rmacwalk); | ||
if (fnc->t_read) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't test these like this, it's a race condition, just call the async cancel directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopology tests on Ubuntu 16.04 amd64: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPOU1604-11930/test Topology Tests failed for Topology tests on Ubuntu 16.04 amd64:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11930/artifact/TOPOU1604/ErrorLog/log_topotests.txt Successful on other platforms/tests
Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
Tell users about new FPM implementation and add more documentation about it. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Call the `dp_fini` callback twice: once at the beginning of the shutdown and then again right before `exit()`ing zebra. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Lets stop and free all resources before shutting down. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11935/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Summary
Changes: