Skip to contentSkip to conversation

app/testpmd: fixed get RSS conf

PATCH In review Qiming Yang 3 participants 6 messages Dec 21, 2018 – Dec 29, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fixed get RSS conf

I40e do not allow to get rss hena only, need to get rss key meanwhile.

Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")
---
 app/test-pmd/config.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
app/test-pmd/config.c +3 -2
index b9e5dd9..482c4f5 100644
@@ -1764,8 +1764,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 		return;
 	}
 
-	/* Get RSS hash key if asked to display it */
-	rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
+	rss_conf.rss_key = rss_key;
 	rss_conf.rss_key_len = hash_key_size;
 	diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
 	if (diag != 0) {
@@ -1793,6 +1792,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 			printf("%s ", rss_type_table[i].str);
 	}
 	printf("\n");
+
+	/* Get RSS hash key if asked to display it */
 	if (!show_rss_key)
 		return;
 	printf("RSS key:\n");
Signature · 1 line
2.9.5
#1 lore raw
Quoted 2 lines · Qiming Yang

I40e do not allow to get rss hena only, need to get rss key meanwhile.

i40e_get_rss_key() returns error if 'rss_conf.rss_key' is NULL, this patch is fixing the error case.

But instead of fixing this in application level, it can be better to fix in driver level. Because 'rte_eth_dev_rss_hash_conf_get()' API doesn't dictate 'rss_conf.rss_key' to be not NULL, so any other application can cause same problem.

Possible solution can be to have an interim 'key' buffer in 'i40e_dev_rss_hash_conf_get()' and copy it to 'rss_conf.rss_key' if it is not NULL.

Quoted 33 lines
Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")
---
 app/test-pmd/config.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
app/test-pmd/config.c +3 -2
index b9e5dd9..482c4f5 100644
@@ -1764,8 +1764,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 		return;
 	}
 
-	/* Get RSS hash key if asked to display it */
-	rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
+	rss_conf.rss_key = rss_key;
 	rss_conf.rss_key_len = hash_key_size;
 	diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
 	if (diag != 0) {
@@ -1793,6 +1792,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 			printf("%s ", rss_type_table[i].str);
 	}
 	printf("\n");
+
+	/* Get RSS hash key if asked to display it */
 	if (!show_rss_key)
 		return;
 	printf("RSS key:\n");
#2 lore raw

Thanks Ferruh, will fix in driver level and then send v2 later.

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, December 21, 2018 10:26 PM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fixed get RSS conf

Quoted 1 line · Qiming Yang

I40e do not allow to get rss hena only, need to get rss key meanwhile.

i40e_get_rss_key() returns error if 'rss_conf.rss_key' is NULL, this patch is fixing the error case.

But instead of fixing this in application level, it can be better to fix in driver level. Because 'rte_eth_dev_rss_hash_conf_get()' API doesn't dictate 'rss_conf.rss_key' to be not NULL, so any other application can cause same problem.

Possible solution can be to have an interim 'key' buffer in 'i40e_dev_rss_hash_conf_get()' and copy it to 'rss_conf.rss_key' if it is not NULL.

Quoted 34 lines
Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and

key")
Cc: [email protected]

---
 app/test-pmd/config.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
app/test-pmd/config.c index renamed from app/test-pmd/config.c +0 -0

b9e5dd9..482c4f5 100644

app/test-pmd/config.c +3 -2
@@ -1764,8 +1764,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 		return;
 	}
 
-	/* Get RSS hash key if asked to display it */
-	rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
+	rss_conf.rss_key = rss_key;
 	rss_conf.rss_key_len = hash_key_size;
 	diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
 	if (diag != 0) {
@@ -1793,6 +1792,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 			printf("%s ", rss_type_table[i].str);
 	}
 	printf("\n");
+
+	/* Get RSS hash key if asked to display it */
 	if (!show_rss_key)
 		return;
 	printf("RSS key:\n");
#3 lore raw

PATCH v2 1/1 net/i40e: fixed get RSS conf

In reply to Qiming Yang

rte_eth_dev_rss_hash_conf_get API doesn't force 'rss_conf.rss_key' to be not NULL, so rss_key = NULL should be alllowed in i40e driver.

Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")
---
 drivers/net/i40e/i40e_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +4 -1
index 8dc1a4a..a6b97e1 100644
@@ -7407,7 +7407,7 @@ i40e_get_rss_key(struct i40e_vsi *vsi, uint8_t *key, uint8_t *key_len)
 	int ret;
 
 	if (!key || !key_len)
-		return -EINVAL;
+		return 0;
 
 	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE) {
 		ret = i40e_aq_get_rss_key(hw, vsi->vsi_id,
@@ -7492,6 +7492,9 @@ i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 	uint64_t hena;
 	int ret;
 
+	if (!rss_conf)
+		return -EINVAL;
+
 	ret = i40e_get_rss_key(pf->main_vsi, rss_conf->rss_key,
 			 &rss_conf->rss_key_len);
 	if (ret)
Signature · 1 line
2.9.5
Acked-by on v2 1/1 Applied
#4 lore raw

Re: [PATCH v2] net/i40e: fixed get RSS conf

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Monday, December 24, 2018 11:34 PM
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] net/i40e: fixed get RSS conf

s/fixed/fix

Quoted 3 lines

rte_eth_dev_rss_hash_conf_get API doesn't force 'rss_conf.rss_key' to be not NULL, so rss_key = NULL should be alllowed in i40e driver.

s/alllowed/allowed

Quoted 5 lines
Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")

Applied to dpdk-next-net-intel with above typo fix.

Thanks
Qi

#5 lore raw

PATCH v3 1/1 net/i40e: fix get RSS conf issue

In reply to Qiming Yang

rte_eth_dev_rss_hash_conf_get API doesn't force 'rss_conf.rss_key' to be not NULL, so rss_key = NULL should be allowed in i40e driver.

Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")
Change-Id I992847995cac44172694ea15ab30c4d1e7e48957
---
 drivers/net/i40e/i40e_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +4 -1
index 8dc1a4a..a6b97e1 100644
@@ -7407,7 +7407,7 @@ i40e_get_rss_key(struct i40e_vsi *vsi, uint8_t *key, uint8_t *key_len)
 	int ret;
 
 	if (!key || !key_len)
-		return -EINVAL;
+		return 0;
 
 	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE) {
 		ret = i40e_aq_get_rss_key(hw, vsi->vsi_id,
@@ -7492,6 +7492,9 @@ i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 	uint64_t hena;
 	int ret;
 
+	if (!rss_conf)
+		return -EINVAL;
+
 	ret = i40e_get_rss_key(pf->main_vsi, rss_conf->rss_key,
 			 &rss_conf->rss_key_len);
 	if (ret)
Signature · 1 line
2.9.5