app/testpmd: set maximum LRO packet size
authorDekel Peled <dekelp@mellanox.com>
Mon, 11 Nov 2019 17:47:35 +0000 (19:47 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 12 Nov 2019 00:44:05 +0000 (01:44 +0100)
This patch implements use of the API for LRO aggregated packet
max size.
It adds command-line and runtime commands to configure this value,
and adds option to show the supported value.
Documentation is updated accordingly.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test-pmd/cmdline.c
app/test-pmd/config.c
app/test-pmd/parameters.c
doc/guides/testpmd_app_ug/run_app.rst
doc/guides/testpmd_app_ug/testpmd_funcs.rst

index ff2d18f..7d48fed 100644 (file)
@@ -780,6 +780,9 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "port config all max-pkt-len (value)\n"
                        "    Set the max packet length.\n\n"
 
+                       "port config all max-lro-pkt-size (value)\n"
+                       "    Set the max LRO aggregated packet size.\n\n"
+
                        "port config all drop-en (on|off)\n"
                        "    Enable or disable packet drop on all RX queues of all ports when no "
                        "receive buffers available.\n\n"
@@ -2043,6 +2046,78 @@ cmdline_parse_inst_t cmd_config_max_pkt_len = {
        },
 };
 
+/* *** config max LRO aggregated packet size *** */
+struct cmd_config_max_lro_pkt_size_result {
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t keyword;
+       cmdline_fixed_string_t all;
+       cmdline_fixed_string_t name;
+       uint32_t value;
+};
+
+static void
+cmd_config_max_lro_pkt_size_parsed(void *parsed_result,
+                               __attribute__((unused)) struct cmdline *cl,
+                               __attribute__((unused)) void *data)
+{
+       struct cmd_config_max_lro_pkt_size_result *res = parsed_result;
+       portid_t pid;
+
+       if (!all_ports_stopped()) {
+               printf("Please stop all ports first\n");
+               return;
+       }
+
+       RTE_ETH_FOREACH_DEV(pid) {
+               struct rte_port *port = &ports[pid];
+
+               if (!strcmp(res->name, "max-lro-pkt-size")) {
+                       if (res->value ==
+                                       port->dev_conf.rxmode.max_lro_pkt_size)
+                               return;
+
+                       port->dev_conf.rxmode.max_lro_pkt_size = res->value;
+               } else {
+                       printf("Unknown parameter\n");
+                       return;
+               }
+       }
+
+       init_port_config();
+
+       cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);
+}
+
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+                                port, "port");
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_keyword =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+                                keyword, "config");
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_all =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+                                all, "all");
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_name =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+                                name, "max-lro-pkt-size");
+cmdline_parse_token_num_t cmd_config_max_lro_pkt_size_value =
+       TOKEN_NUM_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+                             value, UINT32);
+
+cmdline_parse_inst_t cmd_config_max_lro_pkt_size = {
+       .f = cmd_config_max_lro_pkt_size_parsed,
+       .data = NULL,
+       .help_str = "port config all max-lro-pkt-size <value>",
+       .tokens = {
+               (void *)&cmd_config_max_lro_pkt_size_port,
+               (void *)&cmd_config_max_lro_pkt_size_keyword,
+               (void *)&cmd_config_max_lro_pkt_size_all,
+               (void *)&cmd_config_max_lro_pkt_size_name,
+               (void *)&cmd_config_max_lro_pkt_size_value,
+               NULL,
+       },
+};
+
 /* *** configure port MTU *** */
 struct cmd_config_mtu_result {
        cmdline_fixed_string_t port;
@@ -19209,6 +19284,7 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_config_rx_tx,
        (cmdline_parse_inst_t *)&cmd_config_mtu,
        (cmdline_parse_inst_t *)&cmd_config_max_pkt_len,
+       (cmdline_parse_inst_t *)&cmd_config_max_lro_pkt_size,
        (cmdline_parse_inst_t *)&cmd_config_rx_mode_flag,
        (cmdline_parse_inst_t *)&cmd_config_rss,
        (cmdline_parse_inst_t *)&cmd_config_rxtx_ring_size,
index 2a51d96..d599682 100644 (file)
@@ -624,6 +624,8 @@ port_infos_display(portid_t port_id)
        printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
        printf("Maximum configurable length of RX packet: %u\n",
                dev_info.max_rx_pktlen);
+       printf("Maximum configurable size of LRO aggregated packet: %u\n",
+               dev_info.max_lro_pkt_size);
        if (dev_info.max_vfs)
                printf("Maximum number of VFs: %u\n", dev_info.max_vfs);
        if (dev_info.max_vmdq_pools)
index 9b6e35b..deca7a6 100644 (file)
@@ -107,6 +107,8 @@ usage(char* progname)
        printf("  --total-num-mbufs=N: set the number of mbufs to be allocated "
               "in mbuf pools.\n");
        printf("  --max-pkt-len=N: set the maximum size of packet to N bytes.\n");
+       printf("  --max-lro-pkt-size=N: set the maximum LRO aggregated packet "
+              "size to N bytes.\n");
 #ifdef RTE_LIBRTE_CMDLINE
        printf("  --eth-peers-configfile=name: config file with ethernet addresses "
               "of peer ports.\n");
@@ -594,6 +596,7 @@ launch_args_parse(int argc, char** argv)
                { "mbuf-size",                  1, 0, 0 },
                { "total-num-mbufs",            1, 0, 0 },
                { "max-pkt-len",                1, 0, 0 },
+               { "max-lro-pkt-size",           1, 0, 0 },
                { "pkt-filter-mode",            1, 0, 0 },
                { "pkt-filter-report-hash",     1, 0, 0 },
                { "pkt-filter-size",            1, 0, 0 },
@@ -891,6 +894,10 @@ launch_args_parse(int argc, char** argv)
                                                 "Invalid max-pkt-len=%d - should be > %d\n",
                                                 n, RTE_ETHER_MIN_LEN);
                        }
+                       if (!strcmp(lgopts[opt_idx].name, "max-lro-pkt-size")) {
+                               n = atoi(optarg);
+                               rx_mode.max_lro_pkt_size = (uint32_t) n;
+                       }
                        if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
                                if (!strcmp(optarg, "signature"))
                                        fdir_conf.mode =
index 8c7fe44..9ab4d70 100644 (file)
@@ -112,6 +112,10 @@ The command line options are:
 
     Set the maximum packet size to N bytes, where N >= 64. The default value is 1518.
 
+*   ``--max-lro-pkt-size=N``
+
+    Set the maximum LRO aggregated packet size to N bytes, where N >= 64.
+
 *   ``--eth-peers-configfile=name``
 
     Use a configuration file containing the Ethernet addresses of the peer ports.
index f09fa3f..48473d8 100644 (file)
@@ -2154,6 +2154,15 @@ Set the maximum packet length::
 
 This is equivalent to the ``--max-pkt-len`` command-line option.
 
+port config - max-lro-pkt-size
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the maximum LRO aggregated packet size::
+
+   testpmd> port config all max-lro-pkt-size (value)
+
+This is equivalent to the ``--max-lro-pkt-size`` command-line option.
+
 port config - Drop Packets
 ~~~~~~~~~~~~~~~~~~~~~~~~~~