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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2019-01-11 15:11:38 -05:00
parent b3d43ff471
commit 489a961429
6 changed files with 25 additions and 25 deletions

View 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();

View 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,

View 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();

View 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;

View 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",

View 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 */