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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-10-25 11:13:42 -04:00
parent a37ef435e9
commit 62d52dedf0

View file

@ -2696,6 +2696,33 @@ DEFUN (ip_zebra_import_table_distance,
return ret; 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, DEFUN_HIDDEN (zebra_workqueue_timer,
zebra_workqueue_timer_cmd, zebra_workqueue_timer_cmd,
"zebra work-queue (0-10000)", "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) if (zebrad.ribq->spec.hold != ZEBRA_RIB_PROCESS_HOLD_TIME)
vty_out(vty, "zebra work-queue %u\n", zebrad.ribq->spec.hold); 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(); enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get();
if (ipv4_multicast_mode != MCAST_NO_CONFIG) 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, &no_ip_zebra_import_table_cmd);
install_element(CONFIG_NODE, &zebra_workqueue_timer_cmd); install_element(CONFIG_NODE, &zebra_workqueue_timer_cmd);
install_element(CONFIG_NODE, &no_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_vrf_cmd);
install_element(VIEW_NODE, &show_ip_route_cmd); install_element(VIEW_NODE, &show_ip_route_cmd);