patch 'net/mlx5: fix implicit tag insertion with sample action' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Wed Mar 16 16:15:05 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.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 03/21/22. 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://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/5b6b7475f27b00358cc548cb4b88f8bbd970322b

Thanks.

Kevin

---
>From 5b6b7475f27b00358cc548cb4b88f8bbd970322b Mon Sep 17 00:00:00 2001
From: Jiawei Wang <jiaweiw at nvidia.com>
Date: Thu, 10 Mar 2022 06:00:10 +0200
Subject: [PATCH] net/mlx5: fix implicit tag insertion with sample action

[ upstream commit 0f845cc7264a8b56225a28cb4584095cbbf88869 ]

A flow rule with sample action was split into two sub-flows,
and the implicit tag action with unique id was added in the prefix
sub-flow, the suffix sub-flow used the tag item to match with that
unique id, and the implicit set tag action was inserted next to
the sample action.

While there's either PUSH VLAN action or ENCAP action preceding the
sample action, implicit set tag action was added after PUSH VLAN or
ENCAP actions, causing flow creation failure due to rdma-core
does not support this action order.

This patch ensures the implicit set tag action is inserted before
either PUSH VLAN or encap action (if any) in the prefix sub-flow.

Fixes: 6a951567c159 ("net/mlx5: support E-Switch mirroring and jump in one flow")

Signed-off-by: Jiawei Wang <jiaweiw at nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 63 ++++++++++++++++++++++++++++++++++--
 1 file changed, 61 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index a7c8c92ce4..10afd96fea 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -5612,6 +5612,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
 	struct rte_flow_action_jump *jump_action;
 	uint32_t tag_id = 0;
-	int index;
 	int append_index = 0;
+	int set_tag_idx = -1;
+	int index;
 	int ret;
 
@@ -5622,4 +5623,50 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
 					  "action in list");
 	/* Prepare the actions for prefix and suffix flow. */
+	if (add_tag) {
+		/* Update the new added tag action index preceding
+		 * the PUSH_VLAN or ENCAP action.
+		 */
+		const struct rte_flow_action_raw_encap *raw_encap;
+		const struct rte_flow_action *action = actions;
+		int encap_idx;
+		int action_idx = 0;
+		int raw_decap_idx = -1;
+		int push_vlan_idx = -1;
+		for (; action->type != RTE_FLOW_ACTION_TYPE_END; action++) {
+			switch (action->type) {
+			case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
+				raw_decap_idx = action_idx;
+				break;
+			case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
+				raw_encap = action->conf;
+				if (raw_encap->size >
+					MLX5_ENCAPSULATION_DECISION_SIZE) {
+					encap_idx = raw_decap_idx != -1 ?
+						    raw_decap_idx : action_idx;
+					if (encap_idx < sample_action_pos &&
+					    push_vlan_idx == -1)
+						set_tag_idx = encap_idx;
+				}
+				break;
+			case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+			case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
+				encap_idx = action_idx;
+				if (encap_idx < sample_action_pos &&
+				    push_vlan_idx == -1)
+					set_tag_idx = encap_idx;
+				break;
+			case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
+			case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:
+				push_vlan_idx = action_idx;
+				if (push_vlan_idx < sample_action_pos)
+					set_tag_idx = action_idx;
+				break;
+			default:
+				break;
+			}
+			action_idx++;
+		}
+	}
+	/* Prepare the actions for prefix and suffix flow. */
 	if (qrss_action_pos >= 0 && qrss_action_pos < sample_action_pos) {
 		index = qrss_action_pos;
@@ -5638,4 +5685,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
 		       sizeof(struct rte_flow_action));
 		actions_sfx++;
+	} else if (add_tag && set_tag_idx >= 0) {
+		if (set_tag_idx > 0)
+			memcpy(actions_pre, actions,
+			       sizeof(struct rte_flow_action) * set_tag_idx);
+		memcpy(actions_pre + set_tag_idx + 1, actions + set_tag_idx,
+		       sizeof(struct rte_flow_action) *
+		       (sample_action_pos - set_tag_idx));
+		index = sample_action_pos;
 	} else {
 		index = sample_action_pos;
@@ -5685,5 +5740,6 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
 		};
 		/* Prepare the tag action in prefix subflow. */
-		actions_pre[index++] =
+		set_tag_idx = (set_tag_idx == -1) ? index : set_tag_idx;
+		actions_pre[set_tag_idx] =
 			(struct rte_flow_action){
 			.type = (enum rte_flow_action_type)
@@ -5691,5 +5747,8 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
 			.conf = set_tag,
 		};
+		/* Update next sample position due to add one tag action */
+		index += 1;
 	}
+	/* Copy the sample action into prefix flow. */
 	memcpy(actions_pre + index, actions + sample_action_pos,
 	       sizeof(struct rte_flow_action));
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-16 15:14:12.260861396 +0000
+++ 0004-net-mlx5-fix-implicit-tag-insertion-with-sample-acti.patch	2022-03-16 15:14:12.098847571 +0000
@@ -1 +1 @@
-From 0f845cc7264a8b56225a28cb4584095cbbf88869 Mon Sep 17 00:00:00 2001
+From 5b6b7475f27b00358cc548cb4b88f8bbd970322b Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 0f845cc7264a8b56225a28cb4584095cbbf88869 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -30 +31 @@
-index e2bc6ce8ad..cd55bdc2c0 100644
+index a7c8c92ce4..10afd96fea 100644
@@ -33 +34 @@
-@@ -5841,6 +5841,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
+@@ -5612,6 +5612,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
@@ -42 +43 @@
-@@ -5851,4 +5852,50 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
+@@ -5622,4 +5623,50 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
@@ -93 +94 @@
-@@ -5867,4 +5914,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
+@@ -5638,4 +5685,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
@@ -106 +107 @@
-@@ -5914,5 +5969,6 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
+@@ -5685,5 +5740,6 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
@@ -114 +115 @@
-@@ -5920,5 +5976,8 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
+@@ -5691,5 +5747,8 @@ flow_sample_split_prep(struct rte_eth_dev *dev,



More information about the stable mailing list