patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: allow meta modifications in legacy mode
@ 2021-10-26 15:10 Alexander Kozyrev
  2021-10-26 21:21 ` [dpdk-stable] [PATCH v2] " Alexander Kozyrev
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Kozyrev @ 2021-10-26 15:10 UTC (permalink / raw)
  To: dev; +Cc: stable, rasland, viacheslavo, matan

The MODIFY_FIELD RTE action rejects copy to/from metadata
in case of the legacy mode extensive flow metadata support.
It is not consistent with SET_META action that has no such
restriction imposed. Registers A or B are used for META in
legacy mode. Allow meta modifications in legacy mode as well.

On other hand, SET_META rejects actions in case register C
is not available even though it is not needed in legacy mode.
Skip this check for legacy mode and allow setting META.

Fixes: edf325d421 ("net/mlx5: check extended metadata for meta modification")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 9cba22ca2d..2c5cbec71b 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3199,7 +3199,8 @@ flow_dv_validate_action_set_meta(struct rte_eth_dev *dev,
 	uint32_t nic_mask = UINT32_MAX;
 	int reg;
 
-	if (!mlx5_flow_ext_mreg_supported(dev))
+	if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
+	    !mlx5_flow_ext_mreg_supported(dev))
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "extended metadata register"
@@ -4929,15 +4930,27 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				"modifications of the GENEVE Network"
 				" Identifier is not supported");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_MARK ||
-	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK ||
-	    action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
-	    action_modify_field->src.field == RTE_FLOW_FIELD_META) {
+	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK)
 		if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
 		    !mlx5_flow_ext_mreg_supported(dev))
 			return rte_flow_error_set(error, ENOTSUP,
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
-					"cannot modify mark or metadata without"
-					" extended metadata register support");
+					"cannot modify mark in legacy mode"
+					" or without extensive registers");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_META) {
+		if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
+		    !mlx5_flow_ext_mreg_supported(dev))
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"cannot modify meta without"
+					" extensive registers support");
+		ret = flow_dv_get_metadata_reg(dev, attr, error);
+		if (ret < 0 || ret == REG_NON)
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"cannot modify meta without"
+					" extensive registers available");
 	}
 	if (action_modify_field->operation != RTE_FLOW_MODIFY_SET)
 		return rte_flow_error_set(error, ENOTSUP,
-- 
2.18.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH v2] net/mlx5: allow meta modifications in legacy mode
  2021-10-26 15:10 [dpdk-stable] [PATCH] net/mlx5: allow meta modifications in legacy mode Alexander Kozyrev
@ 2021-10-26 21:21 ` Alexander Kozyrev
  2021-10-27  3:52 ` Alexander Kozyrev
  2021-10-31 12:33 ` [dpdk-stable] [PATCH] " Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Kozyrev @ 2021-10-26 21:21 UTC (permalink / raw)
  To: dev; +Cc: stable, rasland, matan, viacheslavo

The MODIFY_FIELD RTE action rejects copy to/from metadata
in case of the legacy mode extensive flow metadata support.
It is not consistent with SET_META action that has no such
restriction imposed. Registers A or B are used for META in
legacy mode. Allow meta modifications in legacy mode as well.

On other hand, SET_META rejects actions in case register C
is not available even though it is not needed in legacy mode.
Skip this check for legacy mode and allow setting META.

Fixes: edf325d421 ("net/mlx5: check extended metadata for meta modification")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2: fixed compilation issue

 drivers/net/mlx5/mlx5_flow_dv.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 9cba22ca2d..2c5cbec71b 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3199,7 +3199,8 @@ flow_dv_validate_action_set_meta(struct rte_eth_dev *dev,
 	uint32_t nic_mask = UINT32_MAX;
 	int reg;
 
-	if (!mlx5_flow_ext_mreg_supported(dev))
+	if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
+	    !mlx5_flow_ext_mreg_supported(dev))
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "extended metadata register"
@@ -4929,15 +4930,27 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				"modifications of the GENEVE Network"
 				" Identifier is not supported");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_MARK ||
-	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK ||
-	    action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
-	    action_modify_field->src.field == RTE_FLOW_FIELD_META) {
+	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK)
 		if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
 		    !mlx5_flow_ext_mreg_supported(dev))
 			return rte_flow_error_set(error, ENOTSUP,
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
-					"cannot modify mark or metadata without"
-					" extended metadata register support");
+					"cannot modify mark in legacy mode"
+					" or without extensive registers");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_META) {
+		if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
+		    !mlx5_flow_ext_mreg_supported(dev))
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"cannot modify meta without"
+					" extensive registers support");
+		ret = flow_dv_get_metadata_reg(dev, attr, error);
+		if (ret < 0 || ret == REG_NON)
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"cannot modify meta without"
+					" extensive registers available");
 	}
 	if (action_modify_field->operation != RTE_FLOW_MODIFY_SET)
 		return rte_flow_error_set(error, ENOTSUP,
-- 
2.18.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH v2] net/mlx5: allow meta modifications in legacy mode
  2021-10-26 15:10 [dpdk-stable] [PATCH] net/mlx5: allow meta modifications in legacy mode Alexander Kozyrev
  2021-10-26 21:21 ` [dpdk-stable] [PATCH v2] " Alexander Kozyrev
@ 2021-10-27  3:52 ` Alexander Kozyrev
  2021-10-31 12:33 ` [dpdk-stable] [PATCH] " Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Kozyrev @ 2021-10-27  3:52 UTC (permalink / raw)
  To: dev; +Cc: stable, rasland, matan, viacheslavo

The MODIFY_FIELD RTE action rejects copy to/from metadata
in case of the legacy mode extensive flow metadata support.
It is not consistent with SET_META action that has no such
restriction imposed. Registers A or B are used for META in
legacy mode. Allow meta modifications in legacy mode as well.

On other hand, SET_META rejects actions in case register C
is not available even though it is not needed in legacy mode.
Skip this check for legacy mode and allow setting META.

Fixes: edf325d421 ("net/mlx5: check extended metadata for meta modification")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2: fixed compilation issue

 drivers/net/mlx5/mlx5_flow_dv.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 9cba22ca2d..69db683576 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3195,11 +3195,14 @@ flow_dv_validate_action_set_meta(struct rte_eth_dev *dev,
 				 const struct rte_flow_attr *attr,
 				 struct rte_flow_error *error)
 {
+	struct mlx5_priv *priv = dev->data->dev_private;
+	struct mlx5_dev_config *config = &priv->config;
 	const struct rte_flow_action_set_meta *conf;
 	uint32_t nic_mask = UINT32_MAX;
 	int reg;
 
-	if (!mlx5_flow_ext_mreg_supported(dev))
+	if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
+	    !mlx5_flow_ext_mreg_supported(dev))
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "extended metadata register"
@@ -4929,15 +4932,27 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				"modifications of the GENEVE Network"
 				" Identifier is not supported");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_MARK ||
-	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK ||
-	    action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
-	    action_modify_field->src.field == RTE_FLOW_FIELD_META) {
+	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK)
 		if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
 		    !mlx5_flow_ext_mreg_supported(dev))
 			return rte_flow_error_set(error, ENOTSUP,
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
-					"cannot modify mark or metadata without"
-					" extended metadata register support");
+					"cannot modify mark in legacy mode"
+					" or without extensive registers");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_META) {
+		if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
+		    !mlx5_flow_ext_mreg_supported(dev))
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"cannot modify meta without"
+					" extensive registers support");
+		ret = flow_dv_get_metadata_reg(dev, attr, error);
+		if (ret < 0 || ret == REG_NON)
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"cannot modify meta without"
+					" extensive registers available");
 	}
 	if (action_modify_field->operation != RTE_FLOW_MODIFY_SET)
 		return rte_flow_error_set(error, ENOTSUP,
-- 
2.18.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH] net/mlx5: allow meta modifications in legacy mode
  2021-10-26 15:10 [dpdk-stable] [PATCH] net/mlx5: allow meta modifications in legacy mode Alexander Kozyrev
  2021-10-26 21:21 ` [dpdk-stable] [PATCH v2] " Alexander Kozyrev
  2021-10-27  3:52 ` Alexander Kozyrev
@ 2021-10-31 12:33 ` Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2021-10-31 12:33 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: stable, Slava Ovsiienko, Matan Azrad

Hi,

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Tuesday, October 26, 2021 6:10 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>
> Subject: [PATCH] net/mlx5: allow meta modifications in legacy mode
> 
> The MODIFY_FIELD RTE action rejects copy to/from metadata in case of the
> legacy mode extensive flow metadata support.
> It is not consistent with SET_META action that has no such restriction
> imposed. Registers A or B are used for META in legacy mode. Allow meta
> modifications in legacy mode as well.
> 
> On other hand, SET_META rejects actions in case register C is not available
> even though it is not needed in legacy mode.
> Skip this check for legacy mode and allow setting META.
> 
> Fixes: edf325d421 ("net/mlx5: check extended metadata for meta
> modification")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-31 12:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 15:10 [dpdk-stable] [PATCH] net/mlx5: allow meta modifications in legacy mode Alexander Kozyrev
2021-10-26 21:21 ` [dpdk-stable] [PATCH v2] " Alexander Kozyrev
2021-10-27  3:52 ` Alexander Kozyrev
2021-10-31 12:33 ` [dpdk-stable] [PATCH] " Raslan Darawsheh

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).