]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Add Hidden 'zebra zapi-packets (1-10000)' command
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 25 Oct 2017 15:13:42 +0000 (11:13 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 25 Oct 2017 15:13:42 +0000 (11:13 -0400)
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>
zebra/zebra_vty.c

index 21a3331f3345806aac6af47d90db65c1b3e71437..e6563c4f54e4bf5e5daf76f72381673c757deb68 100644 (file)
@@ -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);