DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] Non template to HWS fixes
@ 2025-01-28  7:54 Maayan Kashani
  2025-01-28  7:54 ` [PATCH 1/3] net/mlx5: fix limitation of actions per rule Maayan Kashani
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maayan Kashani @ 2025-01-28  7:54 UTC (permalink / raw)
  To: dev; +Cc: mkashani, dsosnowski, rasland

Few fixes for non template mode on top of HWS.

Maayan Kashani (3):
  net/mlx5: fix limitation of actions per rule
  net/mlx5: fix crash in non template metadata split
  net/mlx5: fix flow flush for non-template flows

 drivers/net/mlx5/mlx5_flow.c      |  1 -
 drivers/net/mlx5/mlx5_flow.h      |  2 +-
 drivers/net/mlx5/mlx5_flow_hw.c   |  3 ---
 drivers/net/mlx5/mlx5_nta_split.c | 28 +++++++++++++++-------------
 4 files changed, 16 insertions(+), 18 deletions(-)

-- 
2.21.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] net/mlx5: fix limitation of actions per rule
  2025-01-28  7:54 [PATCH 0/3] Non template to HWS fixes Maayan Kashani
@ 2025-01-28  7:54 ` Maayan Kashani
  2025-01-28  7:54 ` [PATCH 2/3] net/mlx5: fix crash in non template metadata split Maayan Kashani
  2025-01-28  7:54 ` [PATCH 3/3] net/mlx5: fix flow flush for non-template flows Maayan Kashani
  2 siblings, 0 replies; 4+ messages in thread
From: Maayan Kashani @ 2025-01-28  7:54 UTC (permalink / raw)
  To: dev
  Cc: mkashani, dsosnowski, rasland, Viacheslav Ovsiienko, Bing Zhao,
	Ori Kam, Suanming Mou, Matan Azrad

HWS implementation added a limitation of 16 actions per rule,
which was incompatible with SWS limitation of 32 actions per rule.

Changing the hard coded limitation in PMD to 32.

Fixes: f13fab23922b ("net/mlx5: add flow jump action")
Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    | 2 +-
 drivers/net/mlx5/mlx5_flow_hw.c | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 93c2406abc9..445c9cdb4bf 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -1583,7 +1583,7 @@ struct mlx5_hw_modify_header_action {
 };
 
 /* The maximum actions support in the flow. */
-#define MLX5_HW_MAX_ACTS 16
+#define MLX5_HW_MAX_ACTS 32
 
 /* DR action set struct. */
 struct mlx5_hw_actions {
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 2b627114131..501bf33f941 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -21,9 +21,6 @@
 /** Fast path async flow API functions. */
 static struct rte_flow_fp_ops mlx5_flow_hw_fp_ops;
 
-/* The maximum actions support in the flow. */
-#define MLX5_HW_MAX_ACTS 16
-
 /*
  * The default ipool threshold value indicates which per_core_cache
  * value to set.
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] net/mlx5: fix crash in non template metadata split
  2025-01-28  7:54 [PATCH 0/3] Non template to HWS fixes Maayan Kashani
  2025-01-28  7:54 ` [PATCH 1/3] net/mlx5: fix limitation of actions per rule Maayan Kashani
@ 2025-01-28  7:54 ` Maayan Kashani
  2025-01-28  7:54 ` [PATCH 3/3] net/mlx5: fix flow flush for non-template flows Maayan Kashani
  2 siblings, 0 replies; 4+ messages in thread
From: Maayan Kashani @ 2025-01-28  7:54 UTC (permalink / raw)
  To: dev
  Cc: mkashani, dsosnowski, rasland, stable, Bing Zhao,
	Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad

For switch dev mode, there is a rule split in case of using mark action.
First rule will have the mark action, tag it with rule ID number
and jump to the second rule that matches the tag and perform
the rest of the actions (like RSS or queue).

First, fix the crash when accessing RSS queue[0] instead of
queue index, same as for queue action handling for
hairpin RX queue check.
Second, set tag action is not supported in HWS,
so, replaced set tag action with modify field action.
Used same tag index for both action and matching.

Fixes: 821a6a5cc495 ("net/mlx5: add metadata split for compatibility")
Cc: stable@dpdk.org
Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
Acked-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5_nta_split.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_nta_split.c b/drivers/net/mlx5/mlx5_nta_split.c
index b26f305bcab..6a85ab7fd12 100644
--- a/drivers/net/mlx5/mlx5_nta_split.c
+++ b/drivers/net/mlx5/mlx5_nta_split.c
@@ -13,6 +13,8 @@
 
 #ifdef HAVE_MLX5_HWS_SUPPORT
 
+#define BITS_PER_BYTE	8
+
 /*
  * Generate new actions lists for prefix and suffix flows.
  *
@@ -44,11 +46,10 @@ mlx5_flow_nta_split_qrss_actions_prep(struct rte_eth_dev *dev,
 				      struct rte_flow_error *error)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	struct mlx5_rte_flow_action_set_tag *set_tag;
+	struct rte_flow_action_modify_field *set_tag;
 	struct rte_flow_action_jump *jump;
 	const int qrss_idx = qrss - actions;
 	uint32_t flow_id = 0;
-	int ret = 0;
 
 	/* Allocate the new subflow ID and used to be matched later. */
 	mlx5_ipool_malloc(priv->sh->ipool[MLX5_IPOOL_RSS_EXPANTION_FLOW_ID], &flow_id);
@@ -67,16 +68,16 @@ mlx5_flow_nta_split_qrss_actions_prep(struct rte_eth_dev *dev,
 	/* Count MLX5_RTE_FLOW_ACTION_TYPE_TAG. */
 	actions_n++;
 	set_tag = (void *)(prefix_act + actions_n);
-	/* Reuse ASO reg, should always succeed. Consider to use REG_C_6. */
-	ret = flow_hw_get_reg_id_by_domain(dev, RTE_FLOW_ITEM_TYPE_METER_COLOR,
-					   MLX5DR_TABLE_TYPE_NIC_RX, 0);
-	MLX5_ASSERT(ret != (int)REG_NON);
-	set_tag->id = (enum modify_reg)ret;
 	/* Internal SET_TAG action to set flow ID. */
-	set_tag->data = flow_id;
+	set_tag->operation = RTE_FLOW_MODIFY_SET;
+	set_tag->width = sizeof(flow_id) * BITS_PER_BYTE;
+	set_tag->src.field = RTE_FLOW_FIELD_VALUE;
+	memcpy(&set_tag->src.value, &flow_id, sizeof(flow_id));
+	set_tag->dst.field = RTE_FLOW_FIELD_TAG;
+	set_tag->dst.tag_index = RTE_PMD_MLX5_LINEAR_HASH_TAG_INDEX;
 	/* Construct new actions array and replace QUEUE/RSS action. */
 	prefix_act[qrss_idx] = (struct rte_flow_action) {
-		.type = (enum rte_flow_action_type)MLX5_RTE_FLOW_ACTION_TYPE_TAG,
+		.type = RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
 		.conf = set_tag,
 	};
 	/* JUMP action to jump to mreg copy table (CP_TBL). */
@@ -132,8 +133,9 @@ mlx5_flow_nta_split_qrss_items_prep(struct rte_eth_dev *dev,
 	split_items[1].type = RTE_FLOW_ITEM_TYPE_END;
 	q_tag_spec->data = qrss_id;
 	q_tag_spec->id = (enum modify_reg)
-			 flow_hw_get_reg_id_by_domain(dev, RTE_FLOW_ITEM_TYPE_METER_COLOR,
-						      MLX5DR_TABLE_TYPE_NIC_RX, 0);
+			 flow_hw_get_reg_id_by_domain(dev, RTE_FLOW_ITEM_TYPE_TAG,
+						      MLX5DR_TABLE_TYPE_NIC_RX,
+						      RTE_PMD_MLX5_LINEAR_HASH_TAG_INDEX);
 	MLX5_ASSERT(q_tag_spec->id != REG_NON);
 }
 
@@ -211,12 +213,12 @@ mlx5_flow_nta_split_metadata(struct rte_eth_dev *dev,
 			return 0;
 	} else if (action_flags & MLX5_FLOW_ACTION_RSS) {
 		rss = (const struct rte_flow_action_rss *)actions->conf;
-		if (mlx5_rxq_is_hairpin(dev, rss->queue[0]))
+		if (mlx5_rxq_is_hairpin(dev, rss->queue_num))
 			return 0;
 	}
 	/* The prefix and suffix flows' actions. */
 	pefx_act_size = sizeof(struct rte_flow_action) * (actions_n + 1) +
-			sizeof(struct rte_flow_action_set_tag) +
+			sizeof(struct rte_flow_action_modify_field) +
 			sizeof(struct rte_flow_action_jump);
 	sfx_act_size = sizeof(struct rte_flow_action) * 2;
 	/* The suffix attribute. */
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] net/mlx5: fix flow flush for non-template flows
  2025-01-28  7:54 [PATCH 0/3] Non template to HWS fixes Maayan Kashani
  2025-01-28  7:54 ` [PATCH 1/3] net/mlx5: fix limitation of actions per rule Maayan Kashani
  2025-01-28  7:54 ` [PATCH 2/3] net/mlx5: fix crash in non template metadata split Maayan Kashani
@ 2025-01-28  7:54 ` Maayan Kashani
  2 siblings, 0 replies; 4+ messages in thread
From: Maayan Kashani @ 2025-01-28  7:54 UTC (permalink / raw)
  To: dev
  Cc: mkashani, dsosnowski, rasland, stable, Bing Zhao,
	Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad

Fix flow flush for non template flows on top of HWS,
in another fix it was added return after releasing template flows.
Need to drop the return in order to release non template list of flows.

Fixes: 1ea333d2de22 ("net/mlx5: fix Rx queue reference count in flushing flows")
Cc: stable@dpdk.org
Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
Acked-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 9203643300d..3d3b422f057 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -8121,7 +8121,6 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type,
 		priv->hws_rule_flushing = true;
 		flow_hw_q_flow_flush(dev, NULL);
 		priv->hws_rule_flushing = false;
-		return;
 	}
 #endif
 	MLX5_IPOOL_FOREACH(priv->flows[type], fidx, flow) {
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-28  7:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-28  7:54 [PATCH 0/3] Non template to HWS fixes Maayan Kashani
2025-01-28  7:54 ` [PATCH 1/3] net/mlx5: fix limitation of actions per rule Maayan Kashani
2025-01-28  7:54 ` [PATCH 2/3] net/mlx5: fix crash in non template metadata split Maayan Kashani
2025-01-28  7:54 ` [PATCH 3/3] net/mlx5: fix flow flush for non-template flows Maayan Kashani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).