From ea45a4e7db86b29d8cf1ec0adc82ef92e602e7fd Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 11 Jan 2019 15:30:57 -0500 Subject: [PATCH] zebra: Move the mq data structure to zrouter Signed-off-by: Donald Sharp --- zebra/zebra_rib.c | 8 ++++---- zebra/zebra_router.c | 2 +- zebra/zebra_router.h | 3 +++ zebra/zebra_vrf.c | 12 ++++++------ zebra/zserv.h | 2 -- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 81c74a9df8..b0c82a8a57 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2181,7 +2181,7 @@ static wq_item_status meta_queue_process(struct work_queue *dummy, void *data) /* Ensure that the meta-queue is actually enqueued */ if (work_queue_empty(zrouter.ribq)) - work_queue_add(zrouter.ribq, zebrad.mq); + work_queue_add(zrouter.ribq, zrouter.mq); return WQ_QUEUE_BLOCKED; } @@ -2285,9 +2285,9 @@ void rib_queue_add(struct route_node *rn) * This semantics was introduced after 0.99.9 release. */ if (work_queue_empty(zrouter.ribq)) - work_queue_add(zrouter.ribq, zebrad.mq); + work_queue_add(zrouter.ribq, zrouter.mq); - rib_meta_queue_add(zebrad.mq, rn); + rib_meta_queue_add(zrouter.mq, rn); return; } @@ -2341,7 +2341,7 @@ static void rib_queue_init(struct zebra_t *zebra) zrouter.ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME; zrouter.ribq->spec.retry = ZEBRA_RIB_PROCESS_RETRY_TIME; - if (!(zebra->mq = meta_queue_new())) { + if (!(zrouter.mq = meta_queue_new())) { flog_err(EC_ZEBRA_WQ_NONEXISTENT, "%s: could not initialise meta queue!", __func__); return; diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index dde0e1bf62..24dd2691c7 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -189,7 +189,7 @@ void zebra_router_terminate(void) } work_queue_free_and_null(&zrouter.ribq); - meta_queue_free(zebrad.mq); + meta_queue_free(zrouter.mq); zebra_vxlan_disable(); zebra_mlag_terminate(); diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h index 7f3a1a3e09..b4daeea245 100644 --- a/zebra/zebra_router.h +++ b/zebra/zebra_router.h @@ -78,6 +78,9 @@ struct zebra_router { #define ZEBRA_RIB_PROCESS_HOLD_TIME 10 #define ZEBRA_RIB_PROCESS_RETRY_TIME 1 struct work_queue *ribq; + + /* Meta Queue Information */ + struct meta_queue *mq; }; extern struct zebra_router zrouter; diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 8928ba6136..11578d82d3 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -189,13 +189,13 @@ static int zebra_vrf_disable(struct vrf *vrf) struct route_node *rnode; rib_dest_t *dest; - for (ALL_LIST_ELEMENTS(zebrad.mq->subq[i], lnode, nnode, + for (ALL_LIST_ELEMENTS(zrouter.mq->subq[i], lnode, nnode, rnode)) { dest = rib_dest_from_rnode(rnode); if (dest && rib_dest_vrf(dest) == zvrf) { route_unlock_node(rnode); - list_delete_node(zebrad.mq->subq[i], lnode); - zebrad.mq->size--; + list_delete_node(zrouter.mq->subq[i], lnode); + zrouter.mq->size--; } } } @@ -241,13 +241,13 @@ static int zebra_vrf_delete(struct vrf *vrf) struct route_node *rnode; rib_dest_t *dest; - for (ALL_LIST_ELEMENTS(zebrad.mq->subq[i], lnode, nnode, + for (ALL_LIST_ELEMENTS(zrouter.mq->subq[i], lnode, nnode, rnode)) { dest = rib_dest_from_rnode(rnode); if (dest && rib_dest_vrf(dest) == zvrf) { route_unlock_node(rnode); - list_delete_node(zebrad.mq->subq[i], lnode); - zebrad.mq->size--; + list_delete_node(zrouter.mq->subq[i], lnode); + zrouter.mq->size--; } } } diff --git a/zebra/zserv.h b/zebra/zserv.h index a6a35a81c9..5cad68d5d0 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -175,8 +175,6 @@ DECLARE_KOOH(zserv_client_close, (struct zserv *client), (client)); /* Zebra instance */ struct zebra_t { - struct meta_queue *mq; - /* LSP work queue */ struct work_queue *lsp_process_q; -- 2.39.5