patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Jiawei Wang <jiaweiw@nvidia.com>
Cc: Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	dpdk stable <stable@dpdk.org>
Subject: patch 'net/mlx5: fix implicit tag insertion with sample action' has been queued to stable release 21.11.1
Date: Wed, 16 Mar 2022 15:15:05 +0000	[thread overview]
Message-ID: <20220316151524.1242199-4-ktraynor@redhat.com> (raw)
In-Reply-To: <20220316151524.1242199-1-ktraynor@redhat.com>

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@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@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@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@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,


  parent reply	other threads:[~2022-03-16 15:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 15:15 patch 'net/mlx5: fix VLAN push action validation' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix sample flow action on trusted device' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: forbid multiple ASO actions in a single rule' " Kevin Traynor
2022-03-16 15:15 ` Kevin Traynor [this message]
2022-03-16 15:15 ` patch 'doc: fix modify field action description for mlx5' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/qede: fix Tx completion' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/qede: fix Rx bulk' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/qede: fix maximum Rx packet length' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/af_xdp: fix custom program loading with multiple queues' " Kevin Traynor
2022-03-16 15:15 ` patch 'crypto/ipsec_mb: fix GCM requested digest length' " Kevin Traynor
2022-03-16 15:15 ` patch 'bpf: fix build with some libpcap version on FreeBSD' " Kevin Traynor
2022-03-16 15:15 ` patch 'app/regex: fix number of matches' " Kevin Traynor
2022-03-16 15:15 ` patch 'app/testpmd: fix show RSS RETA on Windows' " Kevin Traynor
2022-03-16 15:15 ` patch 'app/testpmd: fix GTP header parsing in checksum engine' " Kevin Traynor
2022-03-16 15:15 ` patch 'app/testpmd: fix flow rule with flex input link' " Kevin Traynor
2022-03-16 15:15 ` patch 'examples/l3fwd: fix buffer overflow in Tx' " Kevin Traynor
2022-03-16 15:15 ` patch 'eal/freebsd: add missing C++ include guards' " Kevin Traynor
2022-03-16 15:15 ` patch 'compressdev: fix missing space in log macro' " Kevin Traynor
2022-03-16 15:15 ` patch 'cryptodev: fix clang C++ include' " Kevin Traynor
2022-03-16 15:15 ` patch 'eventdev: " Kevin Traynor
2022-03-16 15:15 ` patch 'build: suppress rte_crypto_asym_op abi check' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix port matching in sample flow rule' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix CPU socket ID for Rx queue creation' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220316151524.1242199-4-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=jiaweiw@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).