[dpdk-stable] patch 'net/mlx5: fix zero value validation for metadata' has been queued to stable release 19.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 15:02:39 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.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 05/21/20. 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.

Thanks.

Luca Boccassi

---
>From d9a7bf74e175f3712637342639e2acf108be99ea Mon Sep 17 00:00:00 2001
From: Wisam Jaddo <wisamm at mellanox.com>
Date: Thu, 26 Mar 2020 10:22:00 +0000
Subject: [PATCH] net/mlx5: fix zero value validation for metadata

[ upstream commit dac98e878043bbdc11a9bc3eaff3c46321730ea7 ]

MARK and META items are interrelated with datapath -
they might move from/to the applications in mbuf.

zero value for these items has the special meaning -
it means "no metadata are provided", not zero values
are treated by applications and PMD as valid ones.

Moreover in the flow engine domain the value zero is
acceptable to match and set, and we should allow to
specify zero values as rte_flow parameters for the
META and MARK items and actions. In the same time
zero mask has no meaning and should be rejected
on validation stage.

Fixes: fcc8d2f716fd ("net/mlx5: extend flow metadata support")
Fixes: e554b672aa05 ("net/mlx5: support flow tag")
Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support")

Signed-off-by: Wisam Jaddo <wisamm at mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at mellanox.com>
---
 doc/guides/nics/mlx5.rst        | 13 +++++++++++++
 drivers/net/mlx5/mlx5_flow_dv.c | 19 +++++++++++++++----
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 86ad404513..830a02dc90 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -1214,6 +1214,19 @@ Supported hardware offloads
    |                       | |  ConnectX-5   | | ConnectX-5    |
    +-----------------------+-----------------+-----------------+
 
+Notes for metadata
+------------------
+
+MARK and META items are interrelated with datapath - they might move from/to
+the applications in mbuf fields. Hence, zero value for these items has the
+special meaning - it means "no metadata are provided", not zero values are
+treated by applications and PMD as valid ones.
+
+Moreover in the flow engine domain the value zero is acceptable to match and
+set, and we should allow to specify zero values as rte_flow parameters for the
+META and MARK items and actions. In the same time zero mask has no meaning and
+should be rejected on validation stage.
+
 Notes for testpmd
 -----------------
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 076a30544f..f0edb98c02 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1325,6 +1325,11 @@ flow_dv_validate_item_mark(struct rte_eth_dev *dev,
 					  "mark id exceeds the limit");
 	if (!mask)
 		mask = &nic_mask;
+	if (!mask->id)
+		return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
+					"mask cannot be zero");
+
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_mark),
@@ -1370,10 +1375,6 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
 					  RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
 					  item->spec,
 					  "data cannot be empty");
-	if (!spec->data)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
-					  "data cannot be zero");
 	if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) {
 		if (!mlx5_flow_ext_mreg_supported(dev))
 			return rte_flow_error_set(error, ENOTSUP,
@@ -1393,6 +1394,11 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
 	}
 	if (!mask)
 		mask = &rte_flow_item_meta_mask;
+	if (!mask->data)
+		return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
+					"mask cannot be zero");
+
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_meta),
@@ -1441,6 +1447,11 @@ flow_dv_validate_item_tag(struct rte_eth_dev *dev,
 					  "data cannot be empty");
 	if (!mask)
 		mask = &rte_flow_item_tag_mask;
+	if (!mask->data)
+		return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
+					"mask cannot be zero");
+
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_tag),
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 14:04:45.596467218 +0100
+++ 0024-net-mlx5-fix-zero-value-validation-for-metadata.patch	2020-05-19 14:04:44.156647285 +0100
@@ -1,8 +1,10 @@
-From dac98e878043bbdc11a9bc3eaff3c46321730ea7 Mon Sep 17 00:00:00 2001
+From d9a7bf74e175f3712637342639e2acf108be99ea Mon Sep 17 00:00:00 2001
 From: Wisam Jaddo <wisamm at mellanox.com>
 Date: Thu, 26 Mar 2020 10:22:00 +0000
 Subject: [PATCH] net/mlx5: fix zero value validation for metadata
 
+[ upstream commit dac98e878043bbdc11a9bc3eaff3c46321730ea7 ]
+
 MARK and META items are interrelated with datapath -
 they might move from/to the applications in mbuf.
 
@@ -20,7 +22,6 @@
 Fixes: fcc8d2f716fd ("net/mlx5: extend flow metadata support")
 Fixes: e554b672aa05 ("net/mlx5: support flow tag")
 Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support")
-Cc: stable at dpdk.org
 
 Signed-off-by: Wisam Jaddo <wisamm at mellanox.com>
 Acked-by: Viacheslav Ovsiienko <viacheslavo at mellanox.com>
@@ -30,10 +31,10 @@
  2 files changed, 28 insertions(+), 4 deletions(-)
 
 diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
-index e8f9984df0..ca4ded2f22 100644
+index 86ad404513..830a02dc90 100644
 --- a/doc/guides/nics/mlx5.rst
 +++ b/doc/guides/nics/mlx5.rst
-@@ -1275,6 +1275,19 @@ Supported hardware offloads
+@@ -1214,6 +1214,19 @@ Supported hardware offloads
     |                       | |  ConnectX-5   | | ConnectX-5    |
     +-----------------------+-----------------+-----------------+
  
@@ -54,10 +55,10 @@
  -----------------
  
 diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
-index b9bf83a4b7..7b3d419bf8 100644
+index 076a30544f..f0edb98c02 100644
 --- a/drivers/net/mlx5/mlx5_flow_dv.c
 +++ b/drivers/net/mlx5/mlx5_flow_dv.c
-@@ -1406,6 +1406,11 @@ flow_dv_validate_item_mark(struct rte_eth_dev *dev,
+@@ -1325,6 +1325,11 @@ flow_dv_validate_item_mark(struct rte_eth_dev *dev,
  					  "mark id exceeds the limit");
  	if (!mask)
  		mask = &nic_mask;
@@ -69,7 +70,7 @@
  	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
  					(const uint8_t *)&nic_mask,
  					sizeof(struct rte_flow_item_mark),
-@@ -1451,10 +1456,6 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
+@@ -1370,10 +1375,6 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
  					  RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
  					  item->spec,
  					  "data cannot be empty");
@@ -80,7 +81,7 @@
  	if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) {
  		if (!mlx5_flow_ext_mreg_supported(dev))
  			return rte_flow_error_set(error, ENOTSUP,
-@@ -1474,6 +1475,11 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
+@@ -1393,6 +1394,11 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
  	}
  	if (!mask)
  		mask = &rte_flow_item_meta_mask;
@@ -92,7 +93,7 @@
  	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
  					(const uint8_t *)&nic_mask,
  					sizeof(struct rte_flow_item_meta),
-@@ -1522,6 +1528,11 @@ flow_dv_validate_item_tag(struct rte_eth_dev *dev,
+@@ -1441,6 +1447,11 @@ flow_dv_validate_item_tag(struct rte_eth_dev *dev,
  					  "data cannot be empty");
  	if (!mask)
  		mask = &rte_flow_item_tag_mask;


More information about the stable mailing list