[dpdk-dev] [PATCH 1/2] common/cnxk: limit RSS key config with RTE Flow operations

psatheesh at marvell.com psatheesh at marvell.com
Mon Sep 4 12:57:41 CEST 2023


From: Kiran Kumar K <kirankumark at marvell.com>

Limit the configuring RSS key with RTE Flow operations for cnxk
device. Key can be update only with dev operations using
rte_eth_dev_rss_hash_update.

Signed-off-by: Kiran Kumar K <kirankumark at marvell.com>
Reviewed-by: Jerin Jacob <jerinj at marvell.com>
---
 drivers/common/cnxk/roc_npc.c | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index c0c168db76..0611a83bba 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -943,9 +943,35 @@ npc_rss_action_configure(struct roc_npc *roc_npc,
 	uint8_t key[ROC_NIX_RSS_KEY_LEN];
 	const uint8_t *key_ptr;
 	uint8_t flowkey_algx;
+	uint32_t key_len;
 	uint16_t *reta;
 	int rc;
 
+	roc_nix_rss_key_get(roc_nix, key);
+	if (rss->key == NULL) {
+		key_ptr = key;
+	} else {
+		key_len = rss->key_len;
+		if (key_len > ROC_NIX_RSS_KEY_LEN)
+			key_len = ROC_NIX_RSS_KEY_LEN;
+
+		for (i = 0; i < key_len; i++) {
+			if (key[i] != rss->key[i]) {
+				plt_err("RSS key config not supported");
+				plt_err("New Key:");
+				for (i = 0; i < key_len; i++)
+					plt_dump_no_nl("0x%.2x ", rss->key[i]);
+				plt_dump_no_nl("\n");
+				plt_err("Configured Key:");
+				for (i = 0; i < ROC_NIX_RSS_KEY_LEN; i++)
+					plt_dump_no_nl("0x%.2x ", key[i]);
+				plt_dump_no_nl("\n");
+				return -ENOTSUP;
+			}
+		}
+		key_ptr = rss->key;
+	}
+
 	rc = npc_rss_free_grp_get(npc, &rss_grp_idx);
 	/* RSS group :0 is not usable for flow rss action */
 	if (rc < 0 || rss_grp_idx == 0)
@@ -960,13 +986,6 @@ npc_rss_action_configure(struct roc_npc *roc_npc,
 
 	*rss_grp = rss_grp_idx;
 
-	if (rss->key == NULL) {
-		roc_nix_rss_key_default_fill(roc_nix, key);
-		key_ptr = key;
-	} else {
-		key_ptr = rss->key;
-	}
-
 	roc_nix_rss_key_set(roc_nix, key_ptr);
 
 	/* If queue count passed in the rss action is less than
-- 
2.39.2



More information about the dev mailing list