patch 'net/mlx5: fix flow action template expansion' has been queued to stable release 23.11.1

Xueming Li xuemingl at nvidia.com
Sat Apr 13 14:49:01 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/15/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=a10a65c3967651721c6a09c6d554536c2b769ac5

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From a10a65c3967651721c6a09c6d554536c2b769ac5 Mon Sep 17 00:00:00 2001
From: Gregory Etelson <getelson at nvidia.com>
Date: Thu, 29 Feb 2024 12:19:55 +0200
Subject: [PATCH] net/mlx5: fix flow action template expansion
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 487191742f4620392ca103c4e2a3a69491a2ea2c ]

MLX5 PMD actions template compilation may implicitly add MODIFY_HEADER
to actions list provided by application.
MLX5 actions in a template list must be arranged according to the HW
supported order.
The PMD must place new MODIFY_HEADER in the correct location relative
to existing actions.

The patch adds indirect actions list to calculation of the new
MODIFY_HEADER location.

Fixes: e26f50adbf38 ("net/mlx5: support indirect list meter mark action")

Signed-off-by: Gregory Etelson <getelson at nvidia.com>
Acked-by: Suanming Mou <suanmingm at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 80 +++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 7cef9bd3ff..7e4ead1875 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -110,6 +110,9 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev,
 			       struct mlx5_tbl_multi_pattern_ctx *mpat,
 			       struct rte_flow_error *error);
 
+static __rte_always_inline enum mlx5_indirect_list_type
+flow_hw_inlist_type_get(const struct rte_flow_action *actions);
+
 static __rte_always_inline int
 mlx5_multi_pattern_reformat_to_index(enum mlx5dr_action_type type)
 {
@@ -5456,6 +5459,69 @@ mlx5_decap_encap_reformat_type(const struct rte_flow_action *actions,
 	       MLX5_FLOW_ACTION_ENCAP : MLX5_FLOW_ACTION_DECAP;
 }
 
+enum mlx5_hw_indirect_list_relative_position {
+	MLX5_INDIRECT_LIST_POSITION_UNKNOWN = -1,
+	MLX5_INDIRECT_LIST_POSITION_BEFORE_MH = 0,
+	MLX5_INDIRECT_LIST_POSITION_AFTER_MH,
+};
+
+static enum mlx5_hw_indirect_list_relative_position
+mlx5_hw_indirect_list_mh_position(const struct rte_flow_action *action)
+{
+	const struct rte_flow_action_indirect_list *conf = action->conf;
+	enum mlx5_indirect_list_type list_type = mlx5_get_indirect_list_type(conf->handle);
+	enum mlx5_hw_indirect_list_relative_position pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN;
+	const union {
+		struct mlx5_indlst_legacy *legacy;
+		struct mlx5_hw_encap_decap_action *reformat;
+		struct rte_flow_action_list_handle *handle;
+	} h = { .handle = conf->handle};
+
+	switch (list_type) {
+	case  MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
+		switch (h.legacy->legacy_type) {
+		case RTE_FLOW_ACTION_TYPE_AGE:
+		case RTE_FLOW_ACTION_TYPE_COUNT:
+		case RTE_FLOW_ACTION_TYPE_CONNTRACK:
+		case RTE_FLOW_ACTION_TYPE_METER_MARK:
+		case RTE_FLOW_ACTION_TYPE_QUOTA:
+			pos = MLX5_INDIRECT_LIST_POSITION_BEFORE_MH;
+			break;
+		case RTE_FLOW_ACTION_TYPE_RSS:
+			pos = MLX5_INDIRECT_LIST_POSITION_AFTER_MH;
+			break;
+		default:
+			pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN;
+			break;
+		}
+		break;
+	case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
+		pos = MLX5_INDIRECT_LIST_POSITION_AFTER_MH;
+		break;
+	case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+		switch (h.reformat->action_type) {
+		case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
+		case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
+			pos = MLX5_INDIRECT_LIST_POSITION_BEFORE_MH;
+			break;
+		case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
+		case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
+			pos = MLX5_INDIRECT_LIST_POSITION_AFTER_MH;
+			break;
+		default:
+			pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN;
+			break;
+		}
+		break;
+	default:
+		pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN;
+		break;
+	}
+	return pos;
+}
+
+#define MLX5_HW_EXPAND_MH_FAILED 0xffff
+
 static inline uint16_t
 flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
 				     struct rte_flow_action masks[],
@@ -5492,6 +5558,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
 	 * @see action_order_arr[]
 	 */
 	for (i = act_num - 2; (int)i >= 0; i--) {
+		enum mlx5_hw_indirect_list_relative_position pos;
 		enum rte_flow_action_type type = actions[i].type;
 		uint64_t reformat_type;
 
@@ -5522,6 +5589,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
 			if (actions[i - 1].type == RTE_FLOW_ACTION_TYPE_RAW_DECAP)
 				i--;
 			break;
+		case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST:
+			pos = mlx5_hw_indirect_list_mh_position(&actions[i]);
+			if (pos == MLX5_INDIRECT_LIST_POSITION_UNKNOWN)
+				return MLX5_HW_EXPAND_MH_FAILED;
+			if (pos == MLX5_INDIRECT_LIST_POSITION_BEFORE_MH)
+				goto insert;
+			break;
 		default:
 			i++; /* new MF inserted AFTER actions[i] */
 			goto insert;
@@ -6476,6 +6550,12 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,
 							   action_flags,
 							   act_num,
 							   expand_mf_num);
+		if (pos == MLX5_HW_EXPAND_MH_FAILED) {
+			rte_flow_error_set(error, ENOMEM,
+					   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+					   NULL, "modify header expansion failed");
+			return NULL;
+		}
 		act_num += expand_mf_num;
 		for (i = pos + expand_mf_num; i < act_num; i++)
 			src_off[i] += expand_mf_num;
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-04-13 20:43:06.928512110 +0800
+++ 0061-net-mlx5-fix-flow-action-template-expansion.patch	2024-04-13 20:43:05.007753918 +0800
@@ -1 +1 @@
-From 487191742f4620392ca103c4e2a3a69491a2ea2c Mon Sep 17 00:00:00 2001
+From a10a65c3967651721c6a09c6d554536c2b769ac5 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 487191742f4620392ca103c4e2a3a69491a2ea2c ]
@@ -17 +19,0 @@
-Cc: stable at dpdk.org
@@ -26 +28 @@
-index c1dbdc5f19..f3f4649c5d 100644
+index 7cef9bd3ff..7e4ead1875 100644
@@ -29,3 +31,3 @@
-@@ -88,6 +88,9 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev,
- static void
- mlx5_destroy_multi_pattern_segment(struct mlx5_multi_pattern_segment *segment);
+@@ -110,6 +110,9 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev,
+ 			       struct mlx5_tbl_multi_pattern_ctx *mpat,
+ 			       struct rte_flow_error *error);
@@ -39 +41 @@
-@@ -5820,6 +5823,69 @@ mlx5_decap_encap_reformat_type(const struct rte_flow_action *actions,
+@@ -5456,6 +5459,69 @@ mlx5_decap_encap_reformat_type(const struct rte_flow_action *actions,
@@ -109 +111 @@
-@@ -5856,6 +5922,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
+@@ -5492,6 +5558,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
@@ -117 +119 @@
-@@ -5886,6 +5953,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
+@@ -5522,6 +5589,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
@@ -131 +133 @@
-@@ -6891,6 +6965,12 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,
+@@ -6476,6 +6550,12 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,


More information about the stable mailing list