[04/11] net/mlx5: fix allow push VLAN without VID value

Message ID dcc91827e7ef417a1c0e5a2a7b793233d36f6ca1.1579703134.git.dekelp@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: vlan actions validation fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Dekel Peled Jan. 22, 2020, 2:27 p.m. UTC
  Currently the push VLAN action requires a VID value, either from
existing VLAN item, or from following 'set VLAN vid' action.

This patch removes this limitation, allowing a push VLAN action with
vid value 0.

Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
  

Comments

Slava Ovsiienko Jan. 23, 2020, 7:57 a.m. UTC | #1
> -----Original Message-----
> From: Dekel Peled <dekelp@mellanox.com>
> Sent: Wednesday, January 22, 2020 16:27
> To: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Cc: Raslan Darawsheh <rasland@mellanox.com>; Ori Kam
> <orika@mellanox.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH 04/11] net/mlx5: fix allow push VLAN without VID value
> 
> Currently the push VLAN action requires a VID value, either from existing
> VLAN item, or from following 'set VLAN vid' action.
> 
> This patch removes this limitation, allowing a push VLAN action with vid value
> 0.
> 
> Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index d7176c8..59ece01 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1734,7 +1734,7 @@ struct field_modify_info modify_tcp[] = {
>   */
>  static int
>  flow_dv_validate_action_push_vlan(uint64_t action_flags,
> -				  uint64_t item_flags,
> +				  uint64_t item_flags __rte_unused,
>  				  const struct rte_flow_action *action,
>  				  const struct rte_flow_attr *attr,
>  				  struct rte_flow_error *error)
> @@ -1751,14 +1751,6 @@ struct field_modify_info modify_tcp[] = {
>  					  RTE_FLOW_ERROR_TYPE_ACTION,
> action,
>  					  "no support for multiple VLAN "
>  					  "actions");
> -	if (!mlx5_flow_find_action
> -			(action + 1,
> RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID) &&
> -	    !(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
> -		return rte_flow_error_set(error, ENOTSUP,
> -				RTE_FLOW_ERROR_TYPE_ACTION, action,
> -				"push VLAN needs to match on VLAN in order
> to "
> -				"get VLAN VID information because there is "
> -				"no followed set VLAN VID action");
>  	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION,
> action,
> --
> 1.8.3.1
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d7176c8..59ece01 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1734,7 +1734,7 @@  struct field_modify_info modify_tcp[] = {
  */
 static int
 flow_dv_validate_action_push_vlan(uint64_t action_flags,
-				  uint64_t item_flags,
+				  uint64_t item_flags __rte_unused,
 				  const struct rte_flow_action *action,
 				  const struct rte_flow_attr *attr,
 				  struct rte_flow_error *error)
@@ -1751,14 +1751,6 @@  struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "no support for multiple VLAN "
 					  "actions");
-	if (!mlx5_flow_find_action
-			(action + 1, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID) &&
-	    !(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
-		return rte_flow_error_set(error, ENOTSUP,
-				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"push VLAN needs to match on VLAN in order to "
-				"get VLAN VID information because there is "
-				"no followed set VLAN VID action");
 	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,