diff options
Diffstat (limited to 'zebra/zebra_rib.c')
| -rw-r--r-- | zebra/zebra_rib.c | 65 |
1 files changed, 28 insertions, 37 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index fcffb500e9..2f71a10d3d 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -72,7 +72,7 @@ DEFINE_MTYPE_STATIC(ZEBRA, WQ_WRAPPER, "WQ wrapper"); */ static pthread_mutex_t dplane_mutex; static struct thread *t_dplane; -static struct dplane_ctx_q rib_dplane_q; +static struct dplane_ctx_list_head rib_dplane_q; DEFINE_HOOK(rib_update, (struct route_node * rn, const char *reason), (rn, reason)); @@ -1788,9 +1788,12 @@ no_nexthops: ctxnhg->nexthop != NULL ? "" : " (empty)"); /* Set the flag about the dedicated fib list */ - SET_FLAG(re->status, ROUTE_ENTRY_USE_FIB_NHG); - if (ctxnhg->nexthop) - copy_nexthops(&(re->fib_ng.nexthop), ctxnhg->nexthop, NULL); + if (zrouter.asic_notification_nexthop_control) { + SET_FLAG(re->status, ROUTE_ENTRY_USE_FIB_NHG); + if (ctxnhg->nexthop) + copy_nexthops(&(re->fib_ng.nexthop), ctxnhg->nexthop, + NULL); + } check_backups: @@ -2712,10 +2715,6 @@ static void process_subq_early_route_add(struct zebra_early_route *ere) if (ere->src_p_provided) apply_mask_ipv6(&ere->src_p); - /* Set default distance by route type. */ - if (re->distance == 0) - re->distance = route_distance(re->type); - /* Lookup route node.*/ rn = srcdest_rnode_get(table, &ere->p, ere->src_p_provided ? &ere->src_p : NULL); @@ -2762,6 +2761,22 @@ static void process_subq_early_route_add(struct zebra_early_route *ere) } } + /* Set default distance by route type. */ + if (re->distance == 0) { + if (same && !zebra_router_notify_on_ack()) + re->distance = same->distance; + else + re->distance = route_distance(re->type); + } + + if (re->metric == ROUTE_INSTALLATION_METRIC && + CHECK_FLAG(re->flags, ZEBRA_FLAG_SELFROUTE)) { + if (same && !zebra_router_notify_on_ack()) + re->metric = same->metric; + else + re->metric = 0; + } + /* If this route is kernel/connected route, notify the dataplane. */ if (RIB_SYSTEM_ROUTE(re)) { /* Notify dataplane */ @@ -4325,25 +4340,6 @@ void rib_update_table(struct route_table *table, enum rib_update_event event, } } -static void rib_update_handle_vrf(vrf_id_t vrf_id, enum rib_update_event event, - int rtype) -{ - struct route_table *table; - - if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("%s: Handling VRF %s event %s", __func__, - vrf_id_to_name(vrf_id), rib_update_event2str(event)); - - /* Process routes of interested address-families. */ - table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id); - if (table) - rib_update_table(table, event, rtype); - - table = zebra_vrf_table(AFI_IP6, SAFI_UNICAST, vrf_id); - if (table) - rib_update_table(table, event, rtype); -} - static void rib_update_handle_vrf_all(enum rib_update_event event, int rtype) { struct zebra_router_table *zrt; @@ -4359,7 +4355,6 @@ static void rib_update_handle_vrf_all(enum rib_update_event event, int rtype) struct rib_update_ctx { enum rib_update_event event; - bool vrf_all; vrf_id_t vrf_id; }; @@ -4387,10 +4382,7 @@ static void rib_update_handler(struct thread *thread) ctx = THREAD_ARG(thread); - if (ctx->vrf_all) - rib_update_handle_vrf_all(ctx->event, ZEBRA_ROUTE_ALL); - else - rib_update_handle_vrf(ctx->vrf_id, ctx->event, ZEBRA_ROUTE_ALL); + rib_update_handle_vrf_all(ctx->event, ZEBRA_ROUTE_ALL); rib_update_ctx_fini(&ctx); } @@ -4410,7 +4402,6 @@ void rib_update(enum rib_update_event event) return; ctx = rib_update_ctx_init(0, event); - ctx->vrf_all = true; thread_add_event(zrouter.master, rib_update_handler, ctx, 0, &t_rib_update_threads[event]); @@ -4601,13 +4592,13 @@ static void handle_pw_result(struct zebra_dplane_ctx *ctx) static void rib_process_dplane_results(struct thread *thread) { struct zebra_dplane_ctx *ctx; - struct dplane_ctx_q ctxlist; + struct dplane_ctx_list_head ctxlist; bool shut_p = false; /* Dequeue a list of completed updates with one lock/unlock cycle */ do { - TAILQ_INIT(&ctxlist); + dplane_ctx_q_init(&ctxlist); /* Take lock controlling queue of results */ frr_with_mutex (&dplane_mutex) { @@ -4776,7 +4767,7 @@ static void rib_process_dplane_results(struct thread *thread) * the dataplane pthread. We enqueue the results here for processing by * the main thread later. */ -static int rib_dplane_results(struct dplane_ctx_q *ctxlist) +static int rib_dplane_results(struct dplane_ctx_list_head *ctxlist) { /* Take lock controlling queue of results */ frr_with_mutex (&dplane_mutex) { @@ -4821,7 +4812,7 @@ void rib_init(void) /* Init dataplane, and register for results */ pthread_mutex_init(&dplane_mutex, NULL); - TAILQ_INIT(&rib_dplane_q); + dplane_ctx_q_init(&rib_dplane_q); zebra_dplane_init(rib_dplane_results); } |
