app/testpmd: add tx_first burst number option
[dpdk.git] / app / test-pmd / cmdline.c
index 8a41ece..030beec 100644 (file)
@@ -5397,6 +5397,46 @@ cmdline_parse_inst_t cmd_start_tx_first = {
        },
 };
 
+/* *** START FORWARDING WITH N TX BURST FIRST *** */
+struct cmd_start_tx_first_n_result {
+       cmdline_fixed_string_t start;
+       cmdline_fixed_string_t tx_first;
+       uint32_t tx_num;
+};
+
+static void
+cmd_start_tx_first_n_parsed(void *parsed_result,
+                         __attribute__((unused)) struct cmdline *cl,
+                         __attribute__((unused)) void *data)
+{
+       struct cmd_start_tx_first_n_result *res = parsed_result;
+
+       start_packet_forwarding(res->tx_num);
+}
+
+cmdline_parse_token_string_t cmd_start_tx_first_n_start =
+       TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_n_result,
+                       start, "start");
+cmdline_parse_token_string_t cmd_start_tx_first_n_tx_first =
+       TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_n_result,
+                       tx_first, "tx_first");
+cmdline_parse_token_num_t cmd_start_tx_first_n_tx_num =
+       TOKEN_NUM_INITIALIZER(struct cmd_start_tx_first_n_result,
+                       tx_num, UINT32);
+
+cmdline_parse_inst_t cmd_start_tx_first_n = {
+       .f = cmd_start_tx_first_n_parsed,
+       .data = NULL,
+       .help_str = "start packet forwarding, after sending <num> "
+               "bursts of packets",
+       .tokens = {
+               (void *)&cmd_start_tx_first_n_start,
+               (void *)&cmd_start_tx_first_n_tx_first,
+               (void *)&cmd_start_tx_first_n_tx_num,
+               NULL,
+       },
+};
+
 /* *** SET LINK UP *** */
 struct cmd_set_link_up_result {
        cmdline_fixed_string_t set;
@@ -10553,6 +10593,7 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_showcfg,
        (cmdline_parse_inst_t *)&cmd_start,
        (cmdline_parse_inst_t *)&cmd_start_tx_first,
+       (cmdline_parse_inst_t *)&cmd_start_tx_first_n,
        (cmdline_parse_inst_t *)&cmd_set_link_up,
        (cmdline_parse_inst_t *)&cmd_set_link_down,
        (cmdline_parse_inst_t *)&cmd_reset,