zebra: On shutdown, ensure ctx's in rib_dplane_q are freed

a) Rename rib_init to zebra_rib_init() to better follow how
things are named

b) on shutdown cycle through the rib_dplane_q and free
up any contexts sitting in it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2023-11-16 12:55:34 -05:00
parent 7bf3c2fb19
commit a1c1b9d9c5
3 changed files with 19 additions and 3 deletions

View File

@ -228,6 +228,7 @@ void zebra_finalize(struct event *dummy)
/* Final shutdown of ns resources */
ns_walk_func(zebra_ns_final_shutdown, NULL, NULL);
zebra_rib_terminate();
zebra_router_terminate();
ns_terminate();
@ -410,7 +411,7 @@ int main(int argc, char **argv)
/* Zebra related initialize. */
zebra_router_init(asic_offload, notify_on_ack, v6_with_v4_nexthop);
zserv_init();
rib_init();
zebra_rib_init();
zebra_if_init();
zebra_debug_init();

View File

@ -414,7 +414,8 @@ extern void rib_update_table(struct route_table *table,
extern void rib_sweep_route(struct event *t);
extern void rib_sweep_table(struct route_table *table);
extern void rib_close_table(struct route_table *table);
extern void rib_init(void);
extern void zebra_rib_init(void);
extern void zebra_rib_terminate(void);
extern unsigned long rib_score_proto(uint8_t proto, unsigned short instance);
extern unsigned long rib_score_proto_table(uint8_t proto,
unsigned short instance,

View File

@ -4926,7 +4926,7 @@ static void check_route_info(void)
}
/* Routing information base initialize. */
void rib_init(void)
void zebra_rib_init(void)
{
check_route_info();
@ -4938,6 +4938,20 @@ void rib_init(void)
zebra_dplane_init(rib_dplane_results);
}
void zebra_rib_terminate(void)
{
struct zebra_dplane_ctx *ctx;
EVENT_OFF(t_dplane);
ctx = dplane_ctx_dequeue(&rib_dplane_q);
while (ctx) {
dplane_ctx_fini(&ctx);
ctx = dplane_ctx_dequeue(&rib_dplane_q);
}
}
/*
* vrf_id_get_next
*