From 62d52dedf08e47fb65674209cf5b7f9d62eb7e4f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 25 Oct 2017 11:13:42 -0400 Subject: [PATCH] zebra: Add Hidden 'zebra zapi-packets (1-10000)' command Allow the end user to specify how many packets we want to process at one time coming down the zapi, before we yield and let other things process. This is a Hidden command because it is not necessarily something that we want end users to be able to play with Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 21a3331f33..e6563c4f54 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2696,6 +2696,33 @@ DEFUN (ip_zebra_import_table_distance, return ret; } +DEFUN_HIDDEN (zebra_packet_process, + zebra_packet_process_cmd, + "zebra zapi-packets (1-10000)", + ZEBRA_STR + "Zapi Protocol\n" + "Number of packets to process before relinquishing thread\n") +{ + uint32_t packets = strtoul(argv[2]->arg, NULL, 10); + + zebrad.packets_to_process = packets; + + return CMD_SUCCESS; +} + +DEFUN_HIDDEN (no_zebra_packet_process, + no_zebra_packet_process_cmd, + "no zebra zapi-packets [(1-10000)]", + NO_STR + ZEBRA_STR + "Zapi Protocol\n" + "Number of packets to process before relinquishing thread\n") +{ + zebrad.packets_to_process = ZEBRA_ZAPI_PACKETS_TO_PROCESS; + + return CMD_SUCCESS; +} + DEFUN_HIDDEN (zebra_workqueue_timer, zebra_workqueue_timer_cmd, "zebra work-queue (0-10000)", @@ -2770,6 +2797,10 @@ static int config_write_protocol(struct vty *vty) if (zebrad.ribq->spec.hold != ZEBRA_RIB_PROCESS_HOLD_TIME) vty_out(vty, "zebra work-queue %u\n", zebrad.ribq->spec.hold); + if (zebrad.packets_to_process != ZEBRA_ZAPI_PACKETS_TO_PROCESS) + vty_out(vty, + "zebra zapi-packets %u\n", zebrad.packets_to_process); + enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get(); if (ipv4_multicast_mode != MCAST_NO_CONFIG) @@ -2813,6 +2844,8 @@ void zebra_vty_init(void) install_element(CONFIG_NODE, &no_ip_zebra_import_table_cmd); install_element(CONFIG_NODE, &zebra_workqueue_timer_cmd); install_element(CONFIG_NODE, &no_zebra_workqueue_timer_cmd); + install_element(CONFIG_NODE, &zebra_packet_process_cmd); + install_element(CONFIG_NODE, &no_zebra_packet_process_cmd); install_element(VIEW_NODE, &show_vrf_cmd); install_element(VIEW_NODE, &show_ip_route_cmd);