net/mlx5: fix validation of drop action

Message ID 7a681061efe7fa66f1827515039f83a2793fee15.1565861079.git.dekelp@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix validation of drop action |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Dekel Peled Aug. 15, 2019, 9:26 a.m. UTC
  Function mlx5_flow_validate_action_drop() checks if another fate
action is already present in this flow rule, using
defined value MLX5_FLOW_FATE_ACTIONS.
This patch enhances the check using value
(MLX5_FLOW_FATE_ACTIONS | MLX5_FLOW_FATE_ESWITCH_ACTIONS)
to make sure all relevant fate actions are checked.

Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Slava Ovsiienko Sept. 4, 2019, 2:10 p.m. UTC | #1
> -----Original Message-----
> From: Dekel Peled <dekelp@mellanox.com>
> Sent: Thursday, August 15, 2019 12:27
> To: Yongseok Koh <yskoh@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>
> Cc: Ori Kam <orika@mellanox.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix validation of drop action
> 
> Function mlx5_flow_validate_action_drop() checks if another fate action is
> already present in this flow rule, using defined value
> MLX5_FLOW_FATE_ACTIONS.
> This patch enhances the check using value (MLX5_FLOW_FATE_ACTIONS |
> MLX5_FLOW_FATE_ESWITCH_ACTIONS) to make sure all relevant fate
> actions are checked.
> 
> Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_flow.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 9d2c8c9..2356c14 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -809,7 +809,8 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION,
> NULL,
>  					  "can't drop and mark in same
> flow");
> -	if (action_flags & MLX5_FLOW_FATE_ACTIONS)
> +	if (action_flags & (MLX5_FLOW_FATE_ACTIONS |
> +			    MLX5_FLOW_FATE_ESWITCH_ACTIONS))
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION,
> NULL,
>  					  "can't have 2 fate actions in"
> --
> 1.8.3.1
  
Raslan Darawsheh Sept. 5, 2019, 8:59 a.m. UTC | #2
Hi,
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Dekel Peled
> Sent: Thursday, August 15, 2019 12:27 PM
> To: Yongseok Koh <yskoh@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>
> Cc: Ori Kam <orika@mellanox.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix validation of drop action
> 
> Function mlx5_flow_validate_action_drop() checks if another fate action is
> already present in this flow rule, using defined value
> MLX5_FLOW_FATE_ACTIONS.
> This patch enhances the check using value (MLX5_FLOW_FATE_ACTIONS |
> MLX5_FLOW_FATE_ESWITCH_ACTIONS) to make sure all relevant fate
> actions are checked.
> 
> Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  
Kevin Traynor Nov. 22, 2019, 1:33 p.m. UTC | #3
Hi Dekel,

On 15/08/2019 10:26, Dekel Peled wrote:
> Function mlx5_flow_validate_action_drop() checks if another fate
> action is already present in this flow rule, using
> defined value MLX5_FLOW_FATE_ACTIONS.
> This patch enhances the check using value
> (MLX5_FLOW_FATE_ACTIONS | MLX5_FLOW_FATE_ESWITCH_ACTIONS)
> to make sure all relevant fate actions are checked.
> 
> Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

MLX5_FLOW_FATE_ESWITCH_ACTIONS is not available and causes build error
for 18.11. I think correct fixes tag is,
Fixes: 2e4c987aad91 ("net/mlx5: validate Direct Rule E-Switch")

which is not part of 18.11 stable. Will drop patch from 18.11 stable.
Let me know if there is something else needed.

thanks,
Kevin.

> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 9d2c8c9..2356c14 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -809,7 +809,8 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
>  					  "can't drop and mark in same flow");
> -	if (action_flags & MLX5_FLOW_FATE_ACTIONS)
> +	if (action_flags & (MLX5_FLOW_FATE_ACTIONS |
> +			    MLX5_FLOW_FATE_ESWITCH_ACTIONS))
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
>  					  "can't have 2 fate actions in"
>
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 9d2c8c9..2356c14 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -809,7 +809,8 @@  uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
 					  "can't drop and mark in same flow");
-	if (action_flags & MLX5_FLOW_FATE_ACTIONS)
+	if (action_flags & (MLX5_FLOW_FATE_ACTIONS |
+			    MLX5_FLOW_FATE_ESWITCH_ACTIONS))
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
 					  "can't have 2 fate actions in"