app/testpmd: add Tx flags in config command
authorMaciej Czekaj <maciej.czekaj@caviumnetworks.com>
Fri, 22 Apr 2016 14:51:20 +0000 (16:51 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 8 Jun 2016 20:38:53 +0000 (22:38 +0200)
"port config all txqflags <value>" allows for
specifying txq_flags value in command line.

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
app/test-pmd/cmdline.c
doc/guides/testpmd_app_ug/testpmd_funcs.rst

index 929d19a..1921612 100644 (file)
@@ -2730,6 +2730,74 @@ cmdline_parse_inst_t cmd_set_txsplit = {
        },
 };
 
+/* *** CONFIG TX QUEUE FLAGS *** */
+
+struct cmd_config_txqflags_result {
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t config;
+       cmdline_fixed_string_t all;
+       cmdline_fixed_string_t what;
+       int32_t hexvalue;
+};
+
+static void cmd_config_txqflags_parsed(void *parsed_result,
+                               __attribute__((unused)) struct cmdline *cl,
+                               __attribute__((unused)) void *data)
+{
+       struct cmd_config_txqflags_result *res = parsed_result;
+
+       if (!all_ports_stopped()) {
+               printf("Please stop all ports first\n");
+               return;
+       }
+
+       if (strcmp(res->what, "txqflags")) {
+               printf("Unknown parameter\n");
+               return;
+       }
+
+       if (res->hexvalue >= 0) {
+               txq_flags = res->hexvalue;
+       } else {
+               printf("txqflags must be >= 0\n");
+               return;
+       }
+
+       init_port_config();
+
+       cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);
+}
+
+cmdline_parse_token_string_t cmd_config_txqflags_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, port,
+                                "port");
+cmdline_parse_token_string_t cmd_config_txqflags_config =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, config,
+                                "config");
+cmdline_parse_token_string_t cmd_config_txqflags_all =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, all,
+                                "all");
+cmdline_parse_token_string_t cmd_config_txqflags_what =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, what,
+                                "txqflags");
+cmdline_parse_token_num_t cmd_config_txqflags_value =
+       TOKEN_NUM_INITIALIZER(struct cmd_config_txqflags_result,
+                               hexvalue, INT32);
+
+cmdline_parse_inst_t cmd_config_txqflags = {
+       .f = cmd_config_txqflags_parsed,
+       .data = NULL,
+       .help_str = "port config all txqflags value",
+       .tokens = {
+               (void *)&cmd_config_txqflags_port,
+               (void *)&cmd_config_txqflags_config,
+               (void *)&cmd_config_txqflags_all,
+               (void *)&cmd_config_txqflags_what,
+               (void *)&cmd_config_txqflags_value,
+               NULL,
+       },
+};
+
 /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */
 struct cmd_rx_vlan_filter_all_result {
        cmdline_fixed_string_t rx_vlan;
@@ -10487,6 +10555,7 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_config_rx_mode_flag,
        (cmdline_parse_inst_t *)&cmd_config_rss,
        (cmdline_parse_inst_t *)&cmd_config_rxtx_queue,
+       (cmdline_parse_inst_t *)&cmd_config_txqflags,
        (cmdline_parse_inst_t *)&cmd_config_rss_reta,
        (cmdline_parse_inst_t *)&cmd_showport_reta,
        (cmdline_parse_inst_t *)&cmd_config_burst,
index f2755cb..1545350 100644 (file)
@@ -1198,6 +1198,15 @@ RX scatter mode is off by default.
 
 The ``on`` option is equivalent to the ``--enable-scatter`` command-line option.
 
+port config - TX queue flags
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set a hexadecimal bitmap of TX queue flags for all ports::
+
+   testpmd> port config all txqflags value
+
+This command is equivalent to the ``--txqflags`` command-line option.
+
 port config - RX Checksum
 ~~~~~~~~~~~~~~~~~~~~~~~~~