[PATCH] app/testpmd: fix hash key update problem

Chaoyong He chaoyong.he at corigine.com
Tue Apr 1 09:48:36 CEST 2025


There has logic problem in 'port_rss_hash_key_update()', the user input
will be overwritten by the call to 'rte_eth_dev_rss_hash_conf_get()',
so the RSS functions will not get update as expected.

------
testpmd> show port 0 rss-hash key
RSS functions:
  ipv4 ipv6
RSS key:
6D5A56DA255B0EC24167253D43A38FB0D0CA2BCBAE7B30B477CB2DA38030F20C6A42B7
3BBEAC01FA
testpmd> port config 0 rss-hash-key ipv6-tcp 6D5A56DA255B0EC24167253D
43A38FB0D0CA2BCBAE7B30B477CB2DA38030F20C6A42B73BBEAC01FA
testpmd> show port 0 rss-hash key
RSS functions:
  ipv4 ipv6
RSS key:
6D5A56DA255B0EC24167253D43A38FB0D0CA2BCBAE7B30B477CB2DA38030F20C6A42B7
3BBEAC01FA
testpmd>
------

Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash commands")
Cc: nelio.laranjeiro at 6wind.com
Cc: stable at dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index e89af21cec..c32e011fa6 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4806,11 +4806,12 @@ port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
 
 	rss_conf.rss_key = NULL;
 	rss_conf.rss_key_len = 0;
-	rss_conf.rss_hf = str_to_rsstypes(rss_type);
+	rss_conf.rss_hf = 0;
 	diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
 	if (diag == 0) {
 		rss_conf.rss_key = hash_key;
 		rss_conf.rss_key_len = hash_key_len;
+		rss_conf.rss_hf = str_to_rsstypes(rss_type);
 		diag = rte_eth_dev_rss_hash_update(port_id, &rss_conf);
 	}
 	if (diag == 0)
-- 
2.43.5



More information about the dev mailing list