]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Move ribq from zebrad to zrouter
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 Jan 2019 20:11:38 +0000 (15:11 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 31 Jan 2019 14:20:46 +0000 (09:20 -0500)
The zrouter should own this data structure and it should not
be defined in zserv.h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/main.c
zebra/zebra_rib.c
zebra/zebra_router.c
zebra/zebra_router.h
zebra/zebra_vty.c
zebra/zserv.h

index faace9306138ed56fdad09df65bd822ad52b7d3d..6b58f4a137786262f18703d426475d59a45aef82 100644 (file)
@@ -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();
index fb9f1331c44994709d6d3c7a3526eae695e5df4b..81c74a9df88cb0c054c6084cb1a37b4478d3ae22 100644 (file)
@@ -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,
index 1cf73b7b2ff63eeeb6889f1baf315fb61077f6eb..dde0e1bf629448b37898b8432c4ac0789b6f30c0 100644 (file)
@@ -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();
 
index 17db34b3465da58c0625e08b764e77ef9e7af32f..7f3a1a3e098b51e35e394f51e3e421111a228a9a 100644 (file)
@@ -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;
index 704b729fbadf5ee776e6c9b3fbb553b9cf4a3e62..874ab3edac5f564e5713f4cebb1faeb876dc9d3f 100644 (file)
@@ -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",
index 856a6debbdeb03f47f82d363283fc2a81887609d..a6a35a81c965e0eb292a53ab223aa9dac5ba41b0 100644 (file)
@@ -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 */