net/mlx5: do not allow copy to mark via modify field

Message ID 20210616183444.2815030-1-akozyrev@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: do not allow copy to mark via modify field |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/iol-abi-testing success Testing PASS
ci/iol-testing fail Testing issues
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Functional fail Functional Testing issues

Commit Message

Alexander Kozyrev June 16, 2021, 6:34 p.m. UTC
  Mark requires a tag resource to be registered as part of
the value assigning. It is not possible during a copy
operation from a packet field. Forbid this in MODIFY_FIELD.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Slava Ovsiienko July 14, 2021, 6:30 a.m. UTC | #1
Hi, Alexander

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, June 16, 2021 21:35
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>
> Subject: [PATCH] net/mlx5: do not allow copy to mark via modify field
> 
> Mark requires a tag resource to be registered as part of the value assigning. It
> is not possible during a copy operation from a packet field. Forbid this in
> MODIFY_FIELD.

Sorry, commit message seems not to be clear even for one who is in context.
"tag resource" - is this hardware resource?
"not possible" - due to hardware limitation?

And I would add few words about the final table "match-set flow tag resource" -
not too many details, just explain - if we copy packet field to MARK substitution register -
we can't handle actual value copying in the "match-set" table.

With best regards,
Slava

> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index dafd37ab93..26b901e32e 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -4797,10 +4797,11 @@ flow_dv_validate_action_modify_field(struct
> rte_eth_dev *dev,
>  				"source and destination fields"
>  				" cannot be the same");
>  	if (action_modify_field->dst.field == RTE_FLOW_FIELD_VALUE ||
> -	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER)
> +	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER ||
> +	    action_modify_field->dst.field == RTE_FLOW_FIELD_MARK)
>  		return rte_flow_error_set(error, EINVAL,
>  				RTE_FLOW_ERROR_TYPE_ACTION, action,
> -				"immediate value or a pointer to it"
> +				"mark, immediate value or a pointer to it"
>  				" cannot be used as a destination");
>  	if (action_modify_field->dst.field == RTE_FLOW_FIELD_START ||
>  	    action_modify_field->src.field == RTE_FLOW_FIELD_START)
> --
> 2.18.2
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index dafd37ab93..26b901e32e 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4797,10 +4797,11 @@  flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				"source and destination fields"
 				" cannot be the same");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_VALUE ||
-	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER)
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER ||
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_MARK)
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"immediate value or a pointer to it"
+				"mark, immediate value or a pointer to it"
 				" cannot be used as a destination");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_START ||
 	    action_modify_field->src.field == RTE_FLOW_FIELD_START)