From 5ec5a7160a9e61ce6e84a65648c345cb10b160c4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 11 Jan 2019 15:35:45 -0500 Subject: [PATCH] zebra: Move packets_to_process to zrouter Signed-off-by: Donald Sharp --- zebra/main.c | 1 - zebra/zebra_router.c | 1 + zebra/zebra_router.h | 3 +++ zebra/zebra_vty.c | 8 ++++---- zebra/zserv.c | 4 ++-- zebra/zserv.h | 2 -- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/zebra/main.c b/zebra/main.c index 811c4dd70b..c9fc0f8381 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -64,7 +64,6 @@ /* Zebra instance */ struct zebra_t zebrad = { - .packets_to_process = ZEBRA_ZAPI_PACKETS_TO_PROCESS, }; /* process id. */ diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index 24dd2691c7..c3b861c242 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -210,6 +210,7 @@ void zebra_router_init(void) zrouter.sequence_num = 0; zrouter.rtm_table_default = 0; + zrouter.packets_to_process = ZEBRA_ZAPI_PACKETS_TO_PROCESS; zebra_vxlan_init(); zebra_mlag_init(); diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h index 39a7c9f875..332a4c3f95 100644 --- a/zebra/zebra_router.h +++ b/zebra/zebra_router.h @@ -84,6 +84,9 @@ struct zebra_router { /* LSP work queue */ struct work_queue *lsp_process_q; + +#define ZEBRA_ZAPI_PACKETS_TO_PROCESS 1000 + _Atomic uint32_t packets_to_process; }; extern struct zebra_router zrouter; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 874ab3edac..4e7bf33db2 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2456,7 +2456,7 @@ DEFUN_HIDDEN (zebra_packet_process, { uint32_t packets = strtoul(argv[2]->arg, NULL, 10); - atomic_store_explicit(&zebrad.packets_to_process, packets, + atomic_store_explicit(&zrouter.packets_to_process, packets, memory_order_relaxed); return CMD_SUCCESS; @@ -2470,7 +2470,7 @@ DEFUN_HIDDEN (no_zebra_packet_process, "Zapi Protocol\n" "Number of packets to process before relinquishing thread\n") { - atomic_store_explicit(&zebrad.packets_to_process, + atomic_store_explicit(&zrouter.packets_to_process, ZEBRA_ZAPI_PACKETS_TO_PROCESS, memory_order_relaxed); @@ -2551,9 +2551,9 @@ static int config_write_protocol(struct vty *vty) 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) + if (zrouter.packets_to_process != ZEBRA_ZAPI_PACKETS_TO_PROCESS) vty_out(vty, "zebra zapi-packets %u\n", - zebrad.packets_to_process); + zrouter.packets_to_process); enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get(); diff --git a/zebra/zserv.c b/zebra/zserv.c index e20c0daaa6..c6b0d84a15 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -316,7 +316,7 @@ static int zserv_read(struct thread *thread) uint32_t p2p; struct zmsghdr hdr; - p2p_orig = atomic_load_explicit(&zebrad.packets_to_process, + p2p_orig = atomic_load_explicit(&zrouter.packets_to_process, memory_order_relaxed); cache = stream_fifo_new(); p2p = p2p_orig; @@ -496,7 +496,7 @@ static int zserv_process_messages(struct thread *thread) struct zserv *client = THREAD_ARG(thread); struct stream *msg; struct stream_fifo *cache = stream_fifo_new(); - uint32_t p2p = zebrad.packets_to_process; + uint32_t p2p = zrouter.packets_to_process; bool need_resched = false; pthread_mutex_lock(&client->ibuf_mtx); diff --git a/zebra/zserv.h b/zebra/zserv.h index 9a07adb216..4461ea5cd5 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 { -#define ZEBRA_ZAPI_PACKETS_TO_PROCESS 1000 - _Atomic uint32_t packets_to_process; }; extern struct zebra_t zebrad; extern unsigned int multipath_num; -- 2.39.5