patch 'net/mlx5: forbid duplicated tag index in pattern template' has been queued to stable release 22.11.3

Xueming Li xuemingl at nvidia.com
Sun Jun 25 08:35:08 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/27/23. 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=22.11-staging

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

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 124a919b4e64a96ef61c072db5c287b4f878534d Mon Sep 17 00:00:00 2001
From: Rongwei Liu <rongweil at nvidia.com>
Date: Tue, 16 May 2023 08:43:28 +0300
Subject: [PATCH] net/mlx5: forbid duplicated tag index in pattern template
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit ad4d51d277fa23a2266c6a098ce51cfa07b3fbbd ]

Duplicated tag index in pattern template will most likely cause
matching failures such as "template tag index is 0 data mask 0xff /
tag index is 0 data mask 0xffff / end"

If the upper layer application needs to match the same tag twice
with different masks, it should be consolidated into one rte_item
with the desired mask.

"template tag index is 0 data mask 0xff / tag index is 0 data mask
0xff00 / end" should be present as "template tag index is 0 data mask
0xffff / end"

Signed-off-by: Rongwei Liu <rongweil at nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index ead14a0530..ea0159406f 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -4621,8 +4621,9 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
 			 struct rte_flow_error *error)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	int i;
+	int i, tag_idx;
 	bool items_end = false;
+	uint32_t tag_bitmap = 0;
 
 	if (!attr->ingress && !attr->egress && !attr->transfer)
 		return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR, NULL,
@@ -4664,16 +4665,26 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
 		switch (type) {
 		case RTE_FLOW_ITEM_TYPE_TAG:
 		{
-			int reg;
 			const struct rte_flow_item_tag *tag =
 				(const struct rte_flow_item_tag *)items[i].spec;
 
-			reg = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_TAG, tag->index);
-			if (reg == REG_NON)
+			if (tag == NULL)
+				return rte_flow_error_set(error, EINVAL,
+							  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+							  NULL,
+							  "Tag spec is NULL");
+			tag_idx = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_TAG, tag->index);
+			if (tag_idx == REG_NON)
 				return rte_flow_error_set(error, EINVAL,
 							  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 							  NULL,
 							  "Unsupported tag index");
+			if (tag_bitmap & (1 << tag_idx))
+				return rte_flow_error_set(error, EINVAL,
+							  RTE_FLOW_ERROR_TYPE_ITEM,
+							  NULL,
+							  "Duplicated tag index");
+			tag_bitmap |= 1 << tag_idx;
 			break;
 		}
 		case MLX5_RTE_FLOW_ITEM_TYPE_TAG:
@@ -4687,6 +4698,12 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
 							  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 							  NULL,
 							  "Unsupported internal tag index");
+			if (tag_bitmap & (1 << tag->index))
+				return rte_flow_error_set(error, EINVAL,
+							  RTE_FLOW_ERROR_TYPE_ITEM,
+							  NULL,
+							  "Duplicated tag index");
+			tag_bitmap |= 1 << tag->index;
 			break;
 		}
 		case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT:
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-06-25 14:32:00.923549100 +0800
+++ 0090-net-mlx5-forbid-duplicated-tag-index-in-pattern-temp.patch	2023-06-25 14:31:58.495773900 +0800
@@ -1 +1 @@
-From ad4d51d277fa23a2266c6a098ce51cfa07b3fbbd Mon Sep 17 00:00:00 2001
+From 124a919b4e64a96ef61c072db5c287b4f878534d Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit ad4d51d277fa23a2266c6a098ce51cfa07b3fbbd ]
@@ -18,2 +20,0 @@
-Cc: stable at dpdk.org
-
@@ -28 +29 @@
-index afc42ac7e7..5df439105a 100644
+index ead14a0530..ea0159406f 100644
@@ -31 +32 @@
-@@ -4840,8 +4840,9 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
+@@ -4621,8 +4621,9 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
@@ -42 +43 @@
-@@ -4883,16 +4884,26 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
+@@ -4664,16 +4665,26 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
@@ -72 +73 @@
-@@ -4906,6 +4917,12 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
+@@ -4687,6 +4698,12 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,


More information about the stable mailing list