Skip to content

Commit 06525c4

Browse files
committed
zebra: Add zrouter.asic_notification_nexthop_control
Volta submitted notification changes for the dplane that had a special use case for their system. Volta is no more, the code is not being actively developed and from talking with ex-Volta employees there is no current plans to even maintain this code. Wrap the special handling of nexthops that their asic-dataplane did in a bit of code to isolate it and allow for future removal, as that I do not actually believe anyone else is using this code. Add a CPP_NOTICE several years into the future that will tell us to remove the code. If someone starts using it then they will have to notice this variable to set it and hopefully they will see my CPP_NOTICE to come talk to us. If this is being used then we can just remove this wrapper. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
1 parent 871a16c commit 06525c4

File tree

4 files changed

+83
-40
lines changed

4 files changed

+83
-40
lines changed

zebra/zebra_rib.c

Lines changed: 55 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,55 +2339,70 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx)
23392339
/* Various fib transitions: changed nexthops; from installed to
23402340
* not-installed; or not-installed to installed.
23412341
*/
2342-
if (start_count > 0 && end_count > 0) {
2343-
if (debug_p)
2344-
zlog_debug(
2345-
"%s(%u:%u):%pRN applied nexthop changes from dplane notification",
2346-
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
2347-
dplane_ctx_get_table(ctx), rn);
2342+
if (zrouter.asic_notification_nexthop_control) {
2343+
if (start_count > 0 && end_count > 0) {
2344+
if (debug_p)
2345+
zlog_debug(
2346+
"%s(%u:%u):%pRN applied nexthop changes from dplane notification",
2347+
VRF_LOGNAME(vrf),
2348+
dplane_ctx_get_vrf(ctx),
2349+
dplane_ctx_get_table(ctx), rn);
23482350

2349-
/* Changed nexthops - update kernel/others */
2350-
dplane_route_notif_update(rn, re,
2351-
DPLANE_OP_ROUTE_UPDATE, ctx);
2351+
/* Changed nexthops - update kernel/others */
2352+
dplane_route_notif_update(rn, re,
2353+
DPLANE_OP_ROUTE_UPDATE, ctx);
23522354

2353-
} else if (start_count == 0 && end_count > 0) {
2354-
if (debug_p)
2355-
zlog_debug(
2356-
"%s(%u:%u):%pRN installed transition from dplane notification",
2357-
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
2358-
dplane_ctx_get_table(ctx), rn);
2355+
} else if (start_count == 0 && end_count > 0) {
2356+
if (debug_p)
2357+
zlog_debug(
2358+
"%s(%u:%u):%pRN installed transition from dplane notification",
2359+
VRF_LOGNAME(vrf),
2360+
dplane_ctx_get_vrf(ctx),
2361+
dplane_ctx_get_table(ctx), rn);
23592362

2360-
/* We expect this to be the selected route, so we want
2361-
* to tell others about this transition.
2362-
*/
2363-
SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
2363+
/* We expect this to be the selected route, so we want
2364+
* to tell others about this transition.
2365+
*/
2366+
SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
23642367

2365-
/* Changed nexthops - update kernel/others */
2366-
dplane_route_notif_update(rn, re, DPLANE_OP_ROUTE_UPDATE, ctx);
2368+
/* Changed nexthops - update kernel/others */
2369+
dplane_route_notif_update(rn, re,
2370+
DPLANE_OP_ROUTE_UPDATE, ctx);
23672371

2368-
/* Redistribute, lsp, and nht update */
2369-
redistribute_update(rn, re, NULL);
2372+
/* Redistribute, lsp, and nht update */
2373+
redistribute_update(rn, re, NULL);
23702374

2371-
} else if (start_count > 0 && end_count == 0) {
2372-
if (debug_p)
2373-
zlog_debug(
2374-
"%s(%u:%u):%pRN un-installed transition from dplane notification",
2375-
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
2376-
dplane_ctx_get_table(ctx), rn);
2375+
} else if (start_count > 0 && end_count == 0) {
2376+
if (debug_p)
2377+
zlog_debug(
2378+
"%s(%u:%u):%pRN un-installed transition from dplane notification",
2379+
VRF_LOGNAME(vrf),
2380+
dplane_ctx_get_vrf(ctx),
2381+
dplane_ctx_get_table(ctx), rn);
23772382

2378-
/* Transition from _something_ installed to _nothing_
2379-
* installed.
2380-
*/
2381-
/* We expect this to be the selected route, so we want
2382-
* to tell others about this transistion.
2383-
*/
2384-
UNSET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
2383+
/* Transition from _something_ installed to _nothing_
2384+
* installed.
2385+
*/
2386+
/* We expect this to be the selected route, so we want
2387+
* to tell others about this transistion.
2388+
*/
2389+
UNSET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
23852390

2386-
/* Changed nexthops - update kernel/others */
2387-
dplane_route_notif_update(rn, re, DPLANE_OP_ROUTE_DELETE, ctx);
2391+
/* Changed nexthops - update kernel/others */
2392+
dplane_route_notif_update(rn, re,
2393+
DPLANE_OP_ROUTE_DELETE, ctx);
23882394

2389-
/* Redistribute, lsp, and nht update */
2390-
redistribute_delete(rn, re, NULL);
2395+
/* Redistribute, lsp, and nht update */
2396+
redistribute_delete(rn, re, NULL);
2397+
}
2398+
}
2399+
2400+
if (!zebra_router_notify_on_ack()) {
2401+
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED))
2402+
zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_INSTALLED);
2403+
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED))
2404+
zsend_route_notify_owner_ctx(ctx,
2405+
ZAPI_ROUTE_FAIL_INSTALL);
23912406
}
23922407

23932408
/* Make any changes visible for lsp and nexthop-tracking processing */

zebra/zebra_router.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,17 @@ void zebra_router_init(bool asic_offload, bool notify_on_ack)
330330
zrouter.asic_offloaded = asic_offload;
331331
zrouter.notify_on_ack = notify_on_ack;
332332

333+
/*
334+
* If you start using asic_notification_nexthop_control
335+
* come talk to the FRR community about what you are doing
336+
* We would like to know.
337+
*/
338+
#if CONFDATE > 20251231
339+
CPP_NOTICE(
340+
"Remove zrouter.asic_notification_nexthop_control as that it's not being maintained or used");
341+
#endif
342+
zrouter.asic_notification_nexthop_control = false;
343+
333344
#ifdef HAVE_SCRIPTING
334345
zebra_script_init();
335346
#endif

zebra/zebra_router.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ struct zebra_router {
224224
bool asic_offloaded;
225225
bool notify_on_ack;
226226

227+
/*
228+
* If the asic is notifying us about successful nexthop
229+
* allocation/control. Some developers have made their
230+
* asic take control of how many nexthops/ecmp they can
231+
* have and will report what is successfull or not
232+
*/
233+
bool asic_notification_nexthop_control;
234+
227235
bool supports_nhgs;
228236

229237
bool all_mc_forwardingv4, default_mc_forwardingv4;

zebra/zebra_vty.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4073,6 +4073,15 @@ DEFUN (show_zebra,
40734073
ttable_add_row(table, "ASIC offload|%s",
40744074
zrouter.asic_offloaded ? "Used" : "Unavailable");
40754075

4076+
/*
4077+
* Do not display this unless someone is actually using it
4078+
*
4079+
* Why this distinction? I think this is effectively dead code
4080+
* and should not be exposed. Maybe someone proves me wrong.
4081+
*/
4082+
if (zrouter.asic_notification_nexthop_control)
4083+
ttable_add_row(table, "ASIC offload and nexthop control|Used");
4084+
40764085
ttable_add_row(table, "RA|%s",
40774086
rtadv_compiled_in() ? "Compiled in" : "Not Compiled in");
40784087
ttable_add_row(table, "RFC 5549|%s",

0 commit comments

Comments
 (0)