From: Donald Sharp Date: Fri, 11 Jan 2019 20:11:38 +0000 (-0500) Subject: zebra: Move ribq from zebrad to zrouter X-Git-Tag: 7.1_pulled~282^2~8 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=489a9614293c0e538746164ac4a249890a4ae91b;p=matthieu%2Ffrr.git zebra: Move ribq from zebrad to zrouter The zrouter should own this data structure and it should not be defined in zserv.h Signed-off-by: Donald Sharp --- diff --git a/zebra/main.c b/zebra/main.c index faace93061..6b58f4a137 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -201,9 +201,6 @@ int zebra_finalize(struct thread *dummy) /* Stop dplane thread and finish any cleanup */ zebra_dplane_shutdown(); - work_queue_free_and_null(&zebrad.ribq); - meta_queue_free(zebrad.mq); - zebra_router_terminate(); frr_fini(); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index fb9f1331c4..81c74a9df8 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2180,8 +2180,8 @@ static wq_item_status meta_queue_process(struct work_queue *dummy, void *data) queue_len, queue_limit); /* Ensure that the meta-queue is actually enqueued */ - if (work_queue_empty(zebrad.ribq)) - work_queue_add(zebrad.ribq, zebrad.mq); + if (work_queue_empty(zrouter.ribq)) + work_queue_add(zrouter.ribq, zebrad.mq); return WQ_QUEUE_BLOCKED; } @@ -2270,7 +2270,7 @@ void rib_queue_add(struct route_node *rn) return; } - if (zebrad.ribq == NULL) { + if (zrouter.ribq == NULL) { flog_err(EC_ZEBRA_WQ_NONEXISTENT, "%s: work_queue does not exist!", __func__); return; @@ -2284,8 +2284,8 @@ void rib_queue_add(struct route_node *rn) * holder, if necessary, then push the work into it in any case. * This semantics was introduced after 0.99.9 release. */ - if (work_queue_empty(zebrad.ribq)) - work_queue_add(zebrad.ribq, zebrad.mq); + if (work_queue_empty(zrouter.ribq)) + work_queue_add(zrouter.ribq, zebrad.mq); rib_meta_queue_add(zebrad.mq, rn); @@ -2325,22 +2325,21 @@ static void rib_queue_init(struct zebra_t *zebra) { assert(zebra); - if (!(zebra->ribq = - work_queue_new(zrouter.master, - "route_node processing"))) { + if (!(zrouter.ribq = work_queue_new(zrouter.master, + "route_node processing"))) { flog_err(EC_ZEBRA_WQ_NONEXISTENT, "%s: could not initialise work queue!", __func__); return; } /* fill in the work queue spec */ - zebra->ribq->spec.workfunc = &meta_queue_process; - zebra->ribq->spec.errorfunc = NULL; - zebra->ribq->spec.completion_func = &meta_queue_process_complete; + zrouter.ribq->spec.workfunc = &meta_queue_process; + zrouter.ribq->spec.errorfunc = NULL; + zrouter.ribq->spec.completion_func = &meta_queue_process_complete; /* XXX: TODO: These should be runtime configurable via vty */ - zebra->ribq->spec.max_retries = 3; - zebra->ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME; - zebra->ribq->spec.retry = ZEBRA_RIB_PROCESS_RETRY_TIME; + zrouter.ribq->spec.max_retries = 3; + zrouter.ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME; + zrouter.ribq->spec.retry = ZEBRA_RIB_PROCESS_RETRY_TIME; if (!(zebra->mq = meta_queue_new())) { flog_err(EC_ZEBRA_WQ_NONEXISTENT, diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index 1cf73b7b2f..dde0e1bf62 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -188,6 +188,9 @@ void zebra_router_terminate(void) zebra_router_free_table(zrt); } + work_queue_free_and_null(&zrouter.ribq); + meta_queue_free(zebrad.mq); + zebra_vxlan_disable(); zebra_mlag_terminate(); diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h index 17db34b346..7f3a1a3e09 100644 --- a/zebra/zebra_router.h +++ b/zebra/zebra_router.h @@ -73,6 +73,11 @@ struct zebra_router { /* The default table used for this router */ uint32_t rtm_table_default; + + /* rib work queue */ +#define ZEBRA_RIB_PROCESS_HOLD_TIME 10 +#define ZEBRA_RIB_PROCESS_RETRY_TIME 1 + struct work_queue *ribq; }; extern struct zebra_router zrouter; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 704b729fba..874ab3edac 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2485,7 +2485,7 @@ DEFUN_HIDDEN (zebra_workqueue_timer, "Time in milliseconds\n") { uint32_t timer = strtoul(argv[2]->arg, NULL, 10); - zebrad.ribq->spec.hold = timer; + zrouter.ribq->spec.hold = timer; return CMD_SUCCESS; } @@ -2498,7 +2498,7 @@ DEFUN_HIDDEN (no_zebra_workqueue_timer, "Work Queue\n" "Time in milliseconds\n") { - zebrad.ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME; + zrouter.ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME; return CMD_SUCCESS; } @@ -2548,8 +2548,8 @@ static int config_write_protocol(struct vty *vty) if (zebra_rnh_ipv6_default_route) vty_out(vty, "ipv6 nht resolve-via-default\n"); - if (zebrad.ribq->spec.hold != ZEBRA_RIB_PROCESS_HOLD_TIME) - vty_out(vty, "zebra work-queue %u\n", zebrad.ribq->spec.hold); + if (zrouter.ribq->spec.hold != ZEBRA_RIB_PROCESS_HOLD_TIME) + vty_out(vty, "zebra work-queue %u\n", zrouter.ribq->spec.hold); if (zebrad.packets_to_process != ZEBRA_ZAPI_PACKETS_TO_PROCESS) vty_out(vty, "zebra zapi-packets %u\n", diff --git a/zebra/zserv.h b/zebra/zserv.h index 856a6debbd..a6a35a81c9 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -175,10 +175,6 @@ DECLARE_KOOH(zserv_client_close, (struct zserv *client), (client)); /* Zebra instance */ struct zebra_t { -/* rib work queue */ -#define ZEBRA_RIB_PROCESS_HOLD_TIME 10 -#define ZEBRA_RIB_PROCESS_RETRY_TIME 1 - struct work_queue *ribq; struct meta_queue *mq; /* LSP work queue */