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

Message ID 20230904105742.1159342-1-psatheesh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/2] common/cnxk: limit RSS key config with RTE Flow operations |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Satheesh Paul Antonysamy Sept. 4, 2023, 10:57 a.m. UTC
  From: Kiran Kumar K <kirankumark@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@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
 drivers/common/cnxk/roc_npc.c | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)
  

Comments

Jerin Jacob Sept. 20, 2023, 3:46 a.m. UTC | #1
On Mon, Sep 4, 2023 at 4:27 PM <psatheesh@marvell.com> wrote:
>
> From: Kiran Kumar K <kirankumark@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@marvell.com>
> Reviewed-by: Jerin Jacob <jerinj@marvell.com>

Updated the git commit for 1/2 patch as follows and applied to
dpdk-next-net-mrvl/for-next-net. Thanks

2/2 patch can be merged along with port representor changes.
Holding2/2 patch now.


    common/cnxk: fix RSS key configuration

    Limit the configuring RSS key with rte_flow operations as
    it is a global resource. Key can be update only with ethdev dev
    operations using rte_eth_dev_rss_hash_update().

    Fixes: 51dc6a80f843 ("common/cnxk: support RSS action in NPC rule")
    Cc: stable@dpdk.org

    Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
    Reviewed-by: Jerin Jacob <jerinj@marvell.com>
  

Patch

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