Skip to contentSkip to conversation

common/cnxk: limit RSS key config with RTE Flow operations

PATCH In review [email protected] 2 participants 4 messages Sep 4, 2023 – Dec 5, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

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

From: Kiran Kumar K <[email protected]>

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.

---
 drivers/common/cnxk/roc_npc.c | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)
drivers/common/cnxk/roc_npc.c +26 -7
index c0c168db76..0611a83bba 100644
@@ -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
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 drivers: add represented port flow item for cnxk

From: Kiran Kumar K <[email protected]>

Adding support for represented port flow item for cnxk device.

---
 doc/guides/nics/features/cnxk.ini    |   1 +
 doc/guides/nics/features/cnxk_vf.ini |   1 +
 drivers/common/cnxk/roc_npc.c        |  59 ++++++++++++---
 drivers/common/cnxk/roc_npc.h        |  13 +++-
 drivers/common/cnxk/roc_npc_mcam.c   |  72 +++++++++---------
 drivers/common/cnxk/roc_npc_parse.c  |  11 +++
 drivers/common/cnxk/roc_npc_priv.h   |   1 +
 drivers/net/cnxk/cnxk_flow.c         | 106 ++++++++++++++-------------
 8 files changed, 166 insertions(+), 98 deletions(-)
doc/guides/nics/features/cnxk.ini +1 -0
index ac7de9a0f0..1c7d804aab 100644
@@ -72,6 +72,7 @@ mark                 = Y
 mpls                 = Y
 nvgre                = Y
 raw                  = Y
+represented_port     = Y
 sctp                 = Y
 tcp                  = Y
 tx_queue             = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index b03e8b35c3..96bfd86ac8 100644
@@ -63,6 +63,7 @@ mark                 = Y
 mpls                 = Y
 nvgre                = Y
 raw                  = Y
+represented_port     = Y
 sctp                 = Y
 tcp                  = Y
 tx_queue             = Y
drivers/common/cnxk/roc_npc.c +47 -12

162 lines not on this page · raw message

drivers/common/cnxk/roc_npc.h +12 -1
index 84c92f4c28..036b60b489 100644
@@ -41,6 +41,7 @@ enum roc_npc_item_type {
 	ROC_NPC_ITEM_TYPE_MARK,
 	ROC_NPC_ITEM_TYPE_TX_QUEUE,
 	ROC_NPC_ITEM_TYPE_IPV6_ROUTING_EXT,
+	ROC_NPC_ITEM_TYPE_REPRESENTED_PORT,
 	ROC_NPC_ITEM_TYPE_END,
 };
 
@@ -323,6 +324,13 @@ struct roc_npc_flow {
 	uint64_t timeout_cycles;
 	void *age_context;
 	uint32_t timeout;
+	uint16_t rep_pf_func;
+	uint16_t rep_channel;
+	struct mbox *rep_mbox;
+	bool has_rep;
+	bool is_rep_vf;
+	struct npc *rep_npc;
+	int port_id;
 
 	TAILQ_ENTRY(roc_npc_flow) next;
 };
@@ -391,6 +399,9 @@ struct roc_npc {
 	uint16_t sdp_channel;
 	uint16_t sdp_channel_mask;
 	struct roc_npc_flow_age flow_age;
+	struct roc_npc *rep_npc;
+	uint16_t rep_pf_func;
+	int rep_port_id;
 
 #define ROC_NPC_MEM_SZ (6 * 1024)
 	uint8_t reserved[ROC_NPC_MEM_SZ];
@@ -428,7 +439,7 @@ int __roc_api roc_npc_mcam_clear_counter(struct roc_npc *roc_npc, uint32_t ctr_i
 int __roc_api roc_npc_inl_mcam_read_counter(uint32_t ctr_id, uint64_t *count);
 int __roc_api roc_npc_inl_mcam_clear_counter(uint32_t ctr_id);
 int __roc_api roc_npc_mcam_free_all_resources(struct roc_npc *roc_npc);
-void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc);
+void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc, int rep_port_id);
 void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 				      struct roc_npc_flow *mcam);
 int __roc_api roc_npc_mark_actions_get(struct roc_npc *roc_npc);
drivers/common/cnxk/roc_npc_mcam.c +37 -35

159 lines not on this page · raw message

drivers/common/cnxk/roc_npc_parse.c +11 -0
index ecd1b3e13b..40ed3a55c6 100644
@@ -35,6 +35,17 @@ npc_parse_mark_item(struct npc_parse_state *pst)
 	return 0;
 }
 
+int
+npc_parse_port_representor_id(struct npc_parse_state *pst)
+{
+	if (pst->pattern->type != ROC_NPC_ITEM_TYPE_REPRESENTED_PORT)
+		return 0;
+
+	pst->pattern++;
+
+	return 0;
+}
+
 static int
 npc_flow_raw_item_prepare(const struct roc_npc_flow_item_raw *raw_spec,
 			  const struct roc_npc_flow_item_raw *raw_mask,
drivers/common/cnxk/roc_npc_priv.h +1 -0
index 6d6cb64c65..944af48dcf 100644
@@ -456,6 +456,7 @@ int npc_mask_is_supported(const char *mask, const char *hw_mask, int len);
 int npc_parse_item_basic(const struct roc_npc_item_info *item, struct npc_parse_item_info *info);
 int npc_parse_meta_items(struct npc_parse_state *pst);
 int npc_parse_mark_item(struct npc_parse_state *pst);
+int npc_parse_port_representor_id(struct npc_parse_state *pst);
 int npc_parse_pre_l2(struct npc_parse_state *pst);
 int npc_parse_higig2_hdr(struct npc_parse_state *pst);
 int npc_parse_cpt_hdr(struct npc_parse_state *pst);
drivers/net/cnxk/cnxk_flow.c +56 -50

140 lines not on this page · raw message

Signature · 1 line
2.39.2
#2 lore raw

PATCH v2 1/1 drivers: add represented port flow item for cnxk

From: Satheesh Paul <[email protected]>

Adding support for represented port flow item for cnxk device.

---
v2:
* Fix issue with flow key alg for cnxk.

 doc/guides/nics/features/cnxk.ini    |   1 +
 doc/guides/nics/features/cnxk_vf.ini |   1 +
 drivers/common/cnxk/roc_npc.c        |  61 ++++++++++++---
 drivers/common/cnxk/roc_npc.h        |  13 +++-
 drivers/common/cnxk/roc_npc_mcam.c   |  68 ++++++++---------
 drivers/common/cnxk/roc_npc_parse.c  |  11 +++
 drivers/common/cnxk/roc_npc_priv.h   |   1 +
 drivers/net/cnxk/cnxk_flow.c         | 106 ++++++++++++++-------------
 8 files changed, 166 insertions(+), 96 deletions(-)
doc/guides/nics/features/cnxk.ini +1 -0
index ac7de9a0f0..1c7d804aab 100644
@@ -72,6 +72,7 @@ mark                 = Y
 mpls                 = Y
 nvgre                = Y
 raw                  = Y
+represented_port     = Y
 sctp                 = Y
 tcp                  = Y
 tx_queue             = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index b03e8b35c3..96bfd86ac8 100644
@@ -63,6 +63,7 @@ mark                 = Y
 mpls                 = Y
 nvgre                = Y
 raw                  = Y
+represented_port     = Y
 sctp                 = Y
 tcp                  = Y
 tx_queue             = Y
drivers/common/cnxk/roc_npc.c +49 -12

164 lines not on this page · raw message

drivers/common/cnxk/roc_npc.h +12 -1
index 459fa33de9..97576aa94e 100644
@@ -41,6 +41,7 @@ enum roc_npc_item_type {
 	ROC_NPC_ITEM_TYPE_MARK,
 	ROC_NPC_ITEM_TYPE_TX_QUEUE,
 	ROC_NPC_ITEM_TYPE_IPV6_ROUTING_EXT,
+	ROC_NPC_ITEM_TYPE_REPRESENTED_PORT,
 	ROC_NPC_ITEM_TYPE_END,
 };
 
@@ -321,6 +322,13 @@ struct roc_npc_flow {
 	void *age_context;
 	uint32_t timeout;
 	bool has_age_action;
+	uint16_t rep_pf_func;
+	uint16_t rep_channel;
+	struct mbox *rep_mbox;
+	bool has_rep;
+	bool is_rep_vf;
+	struct npc *rep_npc;
+	int port_id;
 
 	TAILQ_ENTRY(roc_npc_flow) next;
 };
@@ -389,6 +397,9 @@ struct roc_npc {
 	uint16_t sdp_channel;
 	uint16_t sdp_channel_mask;
 	struct roc_npc_flow_age flow_age;
+	struct roc_npc *rep_npc;
+	uint16_t rep_pf_func;
+	int rep_port_id;
 
 #define ROC_NPC_MEM_SZ (6 * 1024)
 	uint8_t reserved[ROC_NPC_MEM_SZ];
@@ -427,7 +438,7 @@ int __roc_api roc_npc_mcam_clear_counter(struct roc_npc *roc_npc, uint32_t ctr_i
 int __roc_api roc_npc_inl_mcam_read_counter(uint32_t ctr_id, uint64_t *count);
 int __roc_api roc_npc_inl_mcam_clear_counter(uint32_t ctr_id);
 int __roc_api roc_npc_mcam_free_all_resources(struct roc_npc *roc_npc);
-void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc);
+void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc, int rep_port_id);
 void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 				      struct roc_npc_flow *mcam);
 int __roc_api roc_npc_mark_actions_get(struct roc_npc *roc_npc);
drivers/common/cnxk/roc_npc_mcam.c +35 -33

155 lines not on this page · raw message

drivers/common/cnxk/roc_npc_parse.c +11 -0
index ecd1b3e13b..40ed3a55c6 100644
@@ -35,6 +35,17 @@ npc_parse_mark_item(struct npc_parse_state *pst)
 	return 0;
 }
 
+int
+npc_parse_port_representor_id(struct npc_parse_state *pst)
+{
+	if (pst->pattern->type != ROC_NPC_ITEM_TYPE_REPRESENTED_PORT)
+		return 0;
+
+	pst->pattern++;
+
+	return 0;
+}
+
 static int
 npc_flow_raw_item_prepare(const struct roc_npc_flow_item_raw *raw_spec,
 			  const struct roc_npc_flow_item_raw *raw_mask,
drivers/common/cnxk/roc_npc_priv.h +1 -0
index 424f8e207a..009b1d7b3e 100644
@@ -456,6 +456,7 @@ int npc_mask_is_supported(const char *mask, const char *hw_mask, int len);
 int npc_parse_item_basic(const struct roc_npc_item_info *item, struct npc_parse_item_info *info);
 int npc_parse_meta_items(struct npc_parse_state *pst);
 int npc_parse_mark_item(struct npc_parse_state *pst);
+int npc_parse_port_representor_id(struct npc_parse_state *pst);
 int npc_parse_pre_l2(struct npc_parse_state *pst);
 int npc_parse_higig2_hdr(struct npc_parse_state *pst);
 int npc_parse_cpt_hdr(struct npc_parse_state *pst);
drivers/net/cnxk/cnxk_flow.c +56 -50

140 lines not on this page · raw message

Signature · 1 line
2.39.2
Reviewed-by on v1 1/2
#3 lore raw
In reply to [email protected]
Quoted 9 lines · On Mon, Sep 4, 2023 at 4:27 PM <[email protected]> wrote:

From: Kiran Kumar K <[email protected]>

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.

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")