examples/vmdq: fix RSS configuration
diff mbox series

Message ID 20200303091621.30114-1-junyux.jiang@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • examples/vmdq: fix RSS configuration
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Junyu Jiang March 3, 2020, 9:16 a.m. UTC
In order that all queues of pools can receive packets,
add enable-rss argument to change rss configuration.

Fixes: 6bb97df521aa ("examples/vmdq: new app")
Cc: stable@dpdk.org

Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
---
 examples/vmdq/main.c | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)

Comments

Xiaoyun Li March 5, 2020, 2:02 a.m. UTC | #1
> -----Original Message-----
> From: Jiang, JunyuX
> Sent: Tuesday, March 3, 2020 17:16
> To: dev@dpdk.org
> Cc: Li, Xiaoyun <xiaoyun.li@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Jiang, JunyuX <junyux.jiang@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] examples/vmdq: fix RSS configuration
> 
> In order that all queues of pools can receive packets, add enable-rss
> argument to change rss configuration.
> 
> Fixes: 6bb97df521aa ("examples/vmdq: new app")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
> ---

Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
Ferruh Yigit March 9, 2020, 4:44 p.m. UTC | #2
On 3/3/2020 9:16 AM, Junyu Jiang wrote:
> In order that all queues of pools can receive packets,
> add enable-rss argument to change rss configuration.
> 
> Fixes: 6bb97df521aa ("examples/vmdq: new app")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>

Hi Junyu,

I was about to ask to document new 'enable-rss' argument in the sample app
documentation, but it seems there is no documentation for it, if I am not
missing anything.

Would it be possible to add some documentation for it, later update the
documentation with new 'enable-rss' argument in this patch?

Thanks,
ferruh
Han, YingyaX March 27, 2020, 8:33 a.m. UTC | #3
Tested-by: Han,YingyaX <yingyax.han@intel.com>

BRs,
Yingya
-----Original Message-----
From: stable <stable-bounces@dpdk.org> On Behalf Of Li, Xiaoyun
Sent: Thursday, March 5, 2020 10:03 AM
To: Jiang, JunyuX <junyux.jiang@intel.com>; dev@dpdk.org
Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH] examples/vmdq: fix RSS configuration

> -----Original Message-----
> From: Jiang, JunyuX
> Sent: Tuesday, March 3, 2020 17:16
> To: dev@dpdk.org
> Cc: Li, Xiaoyun <xiaoyun.li@intel.com>; Yang, Qiming 
> <qiming.yang@intel.com>; Jiang, JunyuX <junyux.jiang@intel.com>; 
> stable@dpdk.org
> Subject: [PATCH] examples/vmdq: fix RSS configuration
> 
> In order that all queues of pools can receive packets, add enable-rss 
> argument to change rss configuration.
> 
> Fixes: 6bb97df521aa ("examples/vmdq: new app")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
> ---

Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>

Patch
diff mbox series

diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index 011110920..98032e6a3 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -59,6 +59,7 @@  static uint32_t enabled_port_mask;
 /* number of pools (if user does not specify any, 8 by default */
 static uint32_t num_queues = 8;
 static uint32_t num_pools = 8;
+static uint8_t rss_enable;
 
 /* empty vmdq configuration structure. Filled in programatically */
 static const struct rte_eth_conf vmdq_conf_default = {
@@ -143,6 +144,13 @@  get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools)
 	(void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
 	(void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &conf,
 		   sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
+	if (rss_enable) {
+		eth_conf->rxmode.mq_mode = ETH_MQ_RX_VMDQ_RSS;
+		eth_conf->rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP |
+							ETH_RSS_UDP |
+							ETH_RSS_TCP |
+							ETH_RSS_SCTP;
+	}
 	return 0;
 }
 
@@ -164,6 +172,7 @@  port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	uint16_t q;
 	uint16_t queues_per_pool;
 	uint32_t max_nb_pools;
+	uint64_t rss_hf_tmp;
 
 	/*
 	 * The max pool number from dev_info will be used to validate the pool
@@ -209,6 +218,17 @@  port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	if (!rte_eth_dev_is_valid_port(port))
 		return -1;
 
+	rss_hf_tmp = port_conf.rx_adv_conf.rss_conf.rss_hf;
+	port_conf.rx_adv_conf.rss_conf.rss_hf &=
+		dev_info.flow_type_rss_offloads;
+	if (port_conf.rx_adv_conf.rss_conf.rss_hf != rss_hf_tmp) {
+		printf("Port %u modified RSS hash function based on hardware support,"
+			"requested:%#"PRIx64" configured:%#"PRIx64"\n",
+			port,
+			rss_hf_tmp,
+			port_conf.rx_adv_conf.rss_conf.rss_hf);
+	}
+
 	/*
 	 * Though in this example, we only receive packets from the first queue
 	 * of each pool and send packets through first rte_lcore_count() tx
@@ -363,7 +383,8 @@  static void
 vmdq_usage(const char *prgname)
 {
 	printf("%s [EAL options] -- -p PORTMASK]\n"
-	"  --nb-pools NP: number of pools\n",
+	"  --nb-pools NP: number of pools\n"
+	"  --enable-rss: enable RSS (disabled by default)\n",
 	       prgname);
 }
 
@@ -377,6 +398,7 @@  vmdq_parse_args(int argc, char **argv)
 	const char *prgname = argv[0];
 	static struct option long_option[] = {
 		{"nb-pools", required_argument, NULL, 0},
+		{"enable-rss", 0, NULL, 0},
 		{NULL, 0, 0, 0}
 	};
 
@@ -394,11 +416,18 @@  vmdq_parse_args(int argc, char **argv)
 			}
 			break;
 		case 0:
-			if (vmdq_parse_num_pools(optarg) == -1) {
-				printf("invalid number of pools\n");
-				vmdq_usage(prgname);
-				return -1;
+			if (!strcmp(long_option[option_index].name,
+			    "nb-pools")) {
+				if (vmdq_parse_num_pools(optarg) == -1) {
+					printf("invalid number of pools\n");
+					vmdq_usage(prgname);
+					return -1;
+				}
 			}
+
+			if (!strcmp(long_option[option_index].name,
+			    "enable-rss"))
+				rss_enable = 1;
 			break;
 
 		default: