From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9278CA04AC;
	Tue,  1 Sep 2020 05:27:57 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 00A1B1C10A;
	Tue,  1 Sep 2020 05:27:51 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1CBE01C0DC
 for <dev@dpdk.org>; Tue,  1 Sep 2020 05:27:50 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 0813PJR2032072; Mon, 31 Aug 2020 20:27:44 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=Ha0P/P7xMdDgAHwbfSvoBIp6WicUqDULgEmJ8k84Lew=;
 b=OJUa6ARp6YN3oQZujDhC8xzHV9QZS7QyjEZcE2lTEa4NsObYKWKADVq3tHx6v0MbQhvv
 dVGl86PVDOCrEAeVZnH6TbyJpogtVWNLVHH7VziMj2Y+4sKNrJFkLPEP1WyJ4e0bYD7O
 YPpXXGisCQvj3v3N40o0QpML5ybnDoJd4ilWScKlMGceoybYJHo6L9xs0+5h2rxA+7Pt
 ZLaVbtFecX6qr6r9N74V5KH8SkqWoSLHPhHdVeOb/tgXrhZtVyOkkTEaPwb6oZAMV4Cw
 T+p+WmCSlopWe6e3AHjZDwy4nYeXVQUtg792ouSak5+tRZtJjDK8ZJW7Lcvh2zSyKTPn pA== 
Received: from sc-exch02.marvell.com ([199.233.58.182])
 by mx0b-0016f401.pphosted.com with ESMTP id 337phpweak-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Mon, 31 Aug 2020 20:27:44 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com
 (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Mon, 31 Aug 2020 20:27:42 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Mon, 31 Aug 2020 20:27:40 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Mon, 31 Aug 2020 20:27:40 -0700
Received: from localhost.localdomain (unknown [10.28.34.15])
 by maili.marvell.com (Postfix) with ESMTP id 3CB873F7048;
 Mon, 31 Aug 2020 20:27:28 -0700 (PDT)
From: <kirankumark@marvell.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>, Beilei Xing <beilei.xing@intel.com>,
 Bernard Iremonger <bernard.iremonger@intel.com>
CC: <dev@dpdk.org>, <jerinj@marvell.com>, <thomas@monjalon.net>,
 <ferruh.yigit@intel.com>, <arybchenko@solarflare.com>,
 <orika@mellanox.com>, <xuanziyang2@huawei.com>,
 <cloud.wangxiaoyun@huawei.com>, <zhouguoyang@huawei.com>,
 <rosen.xu@intel.com>, <jia.guo@intel.com>, <rmody@marvell.com>,
 <shshaikh@marvell.com>, <ndabilpuram@marvell.com>,
 <qiming.yang@intel.com>, <qi.z.zhang@intel.com>,
 <keith.wiles@intel.com>, <hemant.agrawal@nxp.com>,
 <sachin.saxena@nxp.com>, <wei.zhao1@intel.com>, <johndale@cisco.com>,
 <hyonkim@cisco.com>, <chas3@att.com>, <matan@mellanox.com>,
 <shahafs@mellanox.com>, <viacheslavo@mellanox.com>,
 <rahul.lakkireddy@chelsio.com>, <grive@u256.net>, <lironh@marvell.com>,
 <jingjing.wu@intel.com>, <xavier.huwei@huawei.com>,
 <humin29@huawei.com>, <yisen.zhuang@huawei.com>,
 <ajit.khaparde@broadcom.com>, <somnath.kotur@broadcom.com>,
 <jasvinder.singh@intel.com>, <cristian.dumitrescu@intel.com>,
 Kiran Kumar K <kirankumark@marvell.com>
Date: Tue, 1 Sep 2020 08:57:06 +0530
Message-ID: <20200901032708.58247-2-kirankumark@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200901032708.58247-1-kirankumark@marvell.com>
References: <20200821110330.214931-1-kirankumark@marvell.com>
 <20200901032708.58247-1-kirankumark@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687
 definitions=2020-09-01_01:2020-08-31,
 2020-09-01 signatures=0
Subject: [dpdk-dev] [PATCH v7 2/3] app/testpmd: support ethdev rss level
	config
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Kiran Kumar K <kirankumark@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 <kirankumark@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