From: Kiran Kumar K <kirankum...@marvell.com>

Adding support to set RSS level from ethdev config.
level-0 will requests the default behavior.
level-1 will requests RSS to be performed on the outermost packet
encapsulation level.
level-2 will request RSS to be performed on the specified inner packet
encapsulation level, from outermost to innermost.

Signed-off-by: Kiran Kumar K <kirankum...@marvell.com>
---
 app/test-pmd/cmdline.c    | 17 ++++++++++++++---
 app/test-pmd/parameters.c | 10 +++++++++-
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0a6ed85f3..36111b465 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -794,7 +794,8 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "receive buffers available.\n\n"
 
                        "port config all rss (all|default|ip|tcp|udp|sctp|"
-                       
"ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|<flowtype_id>)\n"
+                       "ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|level-0|"
+                       "level-1|level-2|<flowtype_id>)\n"
                        "    Set the RSS mode.\n\n"
 
                        "port config port-id rss reta 
(hash,queue)[,(hash,queue)]\n"
@@ -2334,7 +2335,16 @@ cmd_config_rss_parsed(void *parsed_result,
                rss_conf.rss_hf = ETH_RSS_GTPU;
        else if (!strcmp(res->value, "none"))
                rss_conf.rss_hf = 0;
-       else if (!strcmp(res->value, "default"))
+       else if (!strcmp(res->value, "level-0")) {
+               rss_hf &= (~ETH_RSS_LEVEL_MASK);
+               rss_conf.rss_hf = (rss_hf | ETH_RSS_LEVEL_0);
+       } else if (!strcmp(res->value, "level-1")) {
+               rss_hf &= (~ETH_RSS_LEVEL_MASK);
+               rss_conf.rss_hf = (rss_hf | ETH_RSS_LEVEL_1);
+       } else if (!strcmp(res->value, "level-2")) {
+               rss_hf &= (~ETH_RSS_LEVEL_MASK);
+               rss_conf.rss_hf = (rss_hf | ETH_RSS_LEVEL_2);
+       } else if (!strcmp(res->value, "default"))
                use_default = 1;
        else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
                                                atoi(res->value) < 64)
@@ -2393,7 +2403,8 @@ cmdline_parse_inst_t cmd_config_rss = {
        .data = NULL,
        .help_str = "port config all rss "
                "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
-               "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|none|<flowtype_id>",
+               "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|none|level-0|level-1|"
+               "level-2|<flowtype_id>",
        .tokens = {
                (void *)&cmd_config_rss_port,
                (void *)&cmd_config_rss_keyword,
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 7cb0e3d6e..9c357879e 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -66,7 +66,7 @@ usage(char* progname)
               "--tx-ip=SRC,DST | --tx-udp=PORT | "
 #endif
               "--pkt-filter-mode= |"
-              "--rss-ip | --rss-udp | "
+              "--rss-ip | --rss-udp | --rss-level-1 | --rss-level-2 |"
               "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
               "--txpt= | --txht= | --txwt= | --txfreet= | "
               "--txrst= | --tx-offloads= | | --rx-offloads= | "
@@ -151,6 +151,8 @@ usage(char* progname)
                        "swap L2,L3,L4 for MAC, IPv4/IPv6 and TCP/UDP only.\n");
        printf("  --rss-ip: set RSS functions to IPv4/IPv6 only .\n");
        printf("  --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n");
+       printf("  --rss-level-1: set RSS hash level to 1\n");
+       printf("  --rss-level-2: set RSS hash level to 2\n");
        printf("  --rxq=N: set the number of RX queues per port to N.\n");
        printf("  --rxd=N: set the number of descriptors in RX rings to N.\n");
        printf("  --txq=N: set the number of TX queues per port to N.\n");
@@ -632,6 +634,8 @@ launch_args_parse(int argc, char** argv)
                { "forward-mode",               1, 0, 0 },
                { "rss-ip",                     0, 0, 0 },
                { "rss-udp",                    0, 0, 0 },
+               { "rss-level-1",                0, 0, 0 },
+               { "rss-level-2",                0, 0, 0 },
                { "rxq",                        1, 0, 0 },
                { "txq",                        1, 0, 0 },
                { "rxd",                        1, 0, 0 },
@@ -1051,6 +1055,10 @@ launch_args_parse(int argc, char** argv)
                                rss_hf = ETH_RSS_IP;
                        if (!strcmp(lgopts[opt_idx].name, "rss-udp"))
                                rss_hf = ETH_RSS_UDP;
+                       if (!strcmp(lgopts[opt_idx].name, "rss-level-1"))
+                               rss_hf |= ETH_RSS_LEVEL_1;
+                       if (!strcmp(lgopts[opt_idx].name, "rss-level-2"))
+                               rss_hf |= ETH_RSS_LEVEL_2;
                        if (!strcmp(lgopts[opt_idx].name, "rxq")) {
                                n = atoi(optarg);
                                if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
-- 
2.25.1

Reply via email to