patch 'net/mlx5: fix modify flex item' has been queued to stable release 23.11.1

Xueming Li xuemingl at nvidia.com
Sat Apr 13 14:48:16 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=61ce57b13af50c7ccb2dd937fc1d3e82e45d5bcf

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 61ce57b13af50c7ccb2dd937fc1d3e82e45d5bcf Mon Sep 17 00:00:00 2001
From: Rongwei Liu <rongweil at nvidia.com>
Date: Fri, 23 Feb 2024 05:21:55 +0200
Subject: [PATCH] net/mlx5: fix modify flex item
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 74f98c1586e73663b4ed69b7dbd3d085776d93df ]

In the rte_flow_field_data structure, the flex item handle is part
of union with other members like level/tag_index.

If the user wants to modify the flex item as source or destination,
there should not be any checking against zero.

Fixes: c23626f27b09 ("ethdev: add MPLS header modification")

Signed-off-by: Rongwei Liu <rongweil at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c    |  2 +-
 drivers/net/mlx5/mlx5_flow_hw.c | 40 ++++++++++++++++++---------------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 85e8c77c81..3e31945f99 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2504,7 +2504,7 @@ int
 flow_validate_modify_field_level(const struct rte_flow_action_modify_data *data,
 				 struct rte_flow_error *error)
 {
-	if (data->level == 0)
+	if (data->level == 0 || data->field == RTE_FLOW_FIELD_FLEX_ITEM)
 		return 0;
 	if (data->field != RTE_FLOW_FIELD_TAG &&
 	    data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG)
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index da873ae2e2..bda1ecf121 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -4975,15 +4975,17 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev,
 	ret = flow_validate_modify_field_level(&action_conf->dst, error);
 	if (ret)
 		return ret;
-	if (action_conf->dst.tag_index &&
-	    !flow_modify_field_support_tag_array(action_conf->dst.field))
-		return rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"destination tag index is not supported");
-	if (action_conf->dst.class_id)
-		return rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"destination class id is not supported");
+	if (action_conf->dst.field != RTE_FLOW_FIELD_FLEX_ITEM) {
+		if (action_conf->dst.tag_index &&
+		    !flow_modify_field_support_tag_array(action_conf->dst.field))
+			return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"destination tag index is not supported");
+		if (action_conf->dst.class_id)
+			return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"destination class id is not supported");
+	}
 	if (mask_conf->dst.level != UINT8_MAX)
 		return rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ACTION, action,
@@ -4998,15 +5000,17 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev,
 				"destination field mask and template are not equal");
 	if (action_conf->src.field != RTE_FLOW_FIELD_POINTER &&
 	    action_conf->src.field != RTE_FLOW_FIELD_VALUE) {
-		if (action_conf->src.tag_index &&
-		    !flow_modify_field_support_tag_array(action_conf->src.field))
-			return rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"source tag index is not supported");
-		if (action_conf->src.class_id)
-			return rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"source class id is not supported");
+		if (action_conf->src.field != RTE_FLOW_FIELD_FLEX_ITEM) {
+			if (action_conf->src.tag_index &&
+			    !flow_modify_field_support_tag_array(action_conf->src.field))
+				return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"source tag index is not supported");
+			if (action_conf->src.class_id)
+				return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"source class id is not supported");
+		}
 		if (mask_conf->src.level != UINT8_MAX)
 			return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-04-13 20:43:05.641364891 +0800
+++ 0016-net-mlx5-fix-modify-flex-item.patch	2024-04-13 20:43:04.927754023 +0800
@@ -1 +1 @@
-From 74f98c1586e73663b4ed69b7dbd3d085776d93df Mon Sep 17 00:00:00 2001
+From 61ce57b13af50c7ccb2dd937fc1d3e82e45d5bcf Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 74f98c1586e73663b4ed69b7dbd3d085776d93df ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -18,3 +20,3 @@
- drivers/net/mlx5/mlx5_flow.c    | 2 +-
- drivers/net/mlx5/mlx5_flow_hw.c | 6 ++++--
- 2 files changed, 5 insertions(+), 3 deletions(-)
+ drivers/net/mlx5/mlx5_flow.c    |  2 +-
+ drivers/net/mlx5/mlx5_flow_hw.c | 40 ++++++++++++++++++---------------
+ 2 files changed, 23 insertions(+), 19 deletions(-)
@@ -23 +25 @@
-index 2b2ae62618..d8ed1ed6f6 100644
+index 85e8c77c81..3e31945f99 100644
@@ -26,2 +28,2 @@
-@@ -2384,7 +2384,7 @@ int
- flow_validate_modify_field_level(const struct rte_flow_field_data *data,
+@@ -2504,7 +2504,7 @@ int
+ flow_validate_modify_field_level(const struct rte_flow_action_modify_data *data,
@@ -36 +38 @@
-index bcf43f5457..5b269b9c82 100644
+index da873ae2e2..bda1ecf121 100644
@@ -39 +41 @@
-@@ -5036,7 +5036,8 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev,
+@@ -4975,15 +4975,17 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev,
@@ -43,7 +45,24 @@
--	if (!flow_hw_modify_field_is_geneve_opt(action_conf->dst.field)) {
-+	if (action_conf->dst.field != RTE_FLOW_FIELD_FLEX_ITEM &&
-+	    !flow_hw_modify_field_is_geneve_opt(action_conf->dst.field)) {
- 		if (action_conf->dst.tag_index &&
- 		    !flow_modify_field_support_tag_array(action_conf->dst.field))
- 			return rte_flow_error_set(error, EINVAL,
-@@ -5061,7 +5062,8 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev,
+-	if (action_conf->dst.tag_index &&
+-	    !flow_modify_field_support_tag_array(action_conf->dst.field))
+-		return rte_flow_error_set(error, EINVAL,
+-				RTE_FLOW_ERROR_TYPE_ACTION, action,
+-				"destination tag index is not supported");
+-	if (action_conf->dst.class_id)
+-		return rte_flow_error_set(error, EINVAL,
+-				RTE_FLOW_ERROR_TYPE_ACTION, action,
+-				"destination class id is not supported");
++	if (action_conf->dst.field != RTE_FLOW_FIELD_FLEX_ITEM) {
++		if (action_conf->dst.tag_index &&
++		    !flow_modify_field_support_tag_array(action_conf->dst.field))
++			return rte_flow_error_set(error, EINVAL,
++					RTE_FLOW_ERROR_TYPE_ACTION, action,
++					"destination tag index is not supported");
++		if (action_conf->dst.class_id)
++			return rte_flow_error_set(error, EINVAL,
++					RTE_FLOW_ERROR_TYPE_ACTION, action,
++					"destination class id is not supported");
++	}
+ 	if (mask_conf->dst.level != UINT8_MAX)
+ 		return rte_flow_error_set(error, EINVAL,
+ 			RTE_FLOW_ERROR_TYPE_ACTION, action,
+@@ -4998,15 +5000,17 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev,
@@ -53,6 +72,23 @@
--		if (!flow_hw_modify_field_is_geneve_opt(action_conf->src.field)) {
-+		if (action_conf->src.field != RTE_FLOW_FIELD_FLEX_ITEM &&
-+		    !flow_hw_modify_field_is_geneve_opt(action_conf->src.field)) {
- 			if (action_conf->src.tag_index &&
- 			    !flow_modify_field_support_tag_array(action_conf->src.field))
- 				return rte_flow_error_set(error, EINVAL,
+-		if (action_conf->src.tag_index &&
+-		    !flow_modify_field_support_tag_array(action_conf->src.field))
+-			return rte_flow_error_set(error, EINVAL,
+-				RTE_FLOW_ERROR_TYPE_ACTION, action,
+-				"source tag index is not supported");
+-		if (action_conf->src.class_id)
+-			return rte_flow_error_set(error, EINVAL,
+-				RTE_FLOW_ERROR_TYPE_ACTION, action,
+-				"source class id is not supported");
++		if (action_conf->src.field != RTE_FLOW_FIELD_FLEX_ITEM) {
++			if (action_conf->src.tag_index &&
++			    !flow_modify_field_support_tag_array(action_conf->src.field))
++				return rte_flow_error_set(error, EINVAL,
++					RTE_FLOW_ERROR_TYPE_ACTION, action,
++					"source tag index is not supported");
++			if (action_conf->src.class_id)
++				return rte_flow_error_set(error, EINVAL,
++					RTE_FLOW_ERROR_TYPE_ACTION, action,
++					"source class id is not supported");
++		}
+ 		if (mask_conf->src.level != UINT8_MAX)
+ 			return rte_flow_error_set(error, EINVAL,
+ 				RTE_FLOW_ERROR_TYPE_ACTION, action,


More information about the stable mailing list