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 sample flow action on trusted device' has been queued to stable release 21.11.1
Date: Wed, 16 Mar 2022 15:15:03 +0000	[thread overview]
Message-ID: <20220316151524.1242199-2-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/52b3a9ca6dfdca45075d11d521eb7ce08ab3732a

Thanks.

Kevin

---
From 52b3a9ca6dfdca45075d11d521eb7ce08ab3732a Mon Sep 17 00:00:00 2001
From: Jiawei Wang <jiaweiw@nvidia.com>
Date: Wed, 9 Mar 2022 12:19:46 +0200
Subject: [PATCH] net/mlx5: fix sample flow action on trusted device

[ upstream commit 9a726360dd3010a4c664e37682826b68a0a7f7fe ]

A flow rule with sample action will be split into two sub flows,
and a tag action was added implicitly in the sample prefix sub flow,
the reserved metadata regC index was used for this tag action.

The reserved metadata regC was shared with metering action,
for ConnectX-5 trusted device (VF/SF), the reserved metadata regC was
invalid since PF only supported the legacy metering.

This patch adds the checking for the tag index and back to use the
application tag if a failure happened.

Fixes: a9b6ea45bed6 ("net/mlx5: fix tag ID conflict with sample action")

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 doc/guides/nics/mlx5.rst        | 2 ++
 drivers/net/mlx5/mlx5_flow.c    | 6 ++++++
 drivers/net/mlx5/mlx5_flow_dv.c | 8 ++++++++
 3 files changed, 16 insertions(+)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 8610ffb25a..9519265939 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -421,4 +421,6 @@ Limitations
   - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID``,
     ``VXLAN ENCAP``, ``NVGRE ENCAP`` in the sample actions list.
+  - For ConnectX-5 trusted device, the application metadata with SET_TAG index 0
+    is not supported before ``RTE_FLOW_ACTION_TYPE_SAMPLE`` action.
 
 - Modify Field flow:
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 41a648ff3f..a7c8c92ce4 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -5653,4 +5653,10 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
 		set_tag = (void *)(actions_pre + actions_n + append_index);
 		ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error);
+		/* Trust VF/SF on CX5 not supported meter so that the reserved
+		 * metadata regC is REG_NON, back to use application tag
+		 * index 0.
+		 */
+		if (unlikely(ret == REG_NON))
+			ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, 0, error);
 		if (ret < 0)
 			return ret;
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index b8a4edae65..bfc65186f3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -6922,4 +6922,5 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 	bool shared_count = false;
 	uint16_t udp_dport = 0;
+	uint32_t tag_id = 0;
 
 	if (items == NULL)
@@ -7391,4 +7392,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 			if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
 				modify_after_mirror = 1;
+			tag_id = ((const struct rte_flow_action_set_tag *)
+				  actions->conf)->index;
 			action_flags |= MLX5_FLOW_ACTION_SET_TAG;
 			rw_act_num += MLX5_ACT_NUM_SET_TAG;
@@ -7825,4 +7828,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 			if (ret < 0)
 				return ret;
+			if ((action_flags & MLX5_FLOW_ACTION_SET_TAG) &&
+			    tag_id == 0 && priv->mtr_color_reg == REG_NON)
+				return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+					"sample after tag action causes metadata tag index 0 corruption");
 			action_flags |= MLX5_FLOW_ACTION_SAMPLE;
 			++actions_n;
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-16 15:14:12.185287699 +0000
+++ 0002-net-mlx5-fix-sample-flow-action-on-trusted-device.patch	2022-03-16 15:14:12.077847503 +0000
@@ -1 +1 @@
-From 9a726360dd3010a4c664e37682826b68a0a7f7fe Mon Sep 17 00:00:00 2001
+From 52b3a9ca6dfdca45075d11d521eb7ce08ab3732a Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 9a726360dd3010a4c664e37682826b68a0a7f7fe ]
+
@@ -18 +19,0 @@
-Cc: stable@dpdk.org
@@ -29 +30 @@
-index a734d10d3f..ca7ebbe9cd 100644
+index 8610ffb25a..9519265939 100644
@@ -32 +33 @@
-@@ -401,4 +401,6 @@ Limitations
+@@ -421,4 +421,6 @@ Limitations
@@ -40 +41 @@
-index ffcaef0baa..e2bc6ce8ad 100644
+index 41a648ff3f..a7c8c92ce4 100644
@@ -43 +44 @@
-@@ -5882,4 +5882,10 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
+@@ -5653,4 +5653,10 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
@@ -55 +56 @@
-index 1746ef37bd..d553e9dee3 100644
+index b8a4edae65..bfc65186f3 100644
@@ -58 +59 @@
-@@ -6914,4 +6914,5 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
+@@ -6922,4 +6922,5 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
@@ -64 +65 @@
-@@ -7390,4 +7391,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
+@@ -7391,4 +7392,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
@@ -71 +72 @@
-@@ -7824,4 +7827,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
+@@ -7825,4 +7828,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,


  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 ` Kevin Traynor [this message]
2022-03-16 15:15 ` patch 'net/mlx5: forbid multiple ASO actions in a single rule' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix implicit tag insertion with sample action' " Kevin Traynor
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-2-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).