[dpdk-dev] [PATCH] net/mlx5: fix MPLS item validation

Ori Kam orika at mellanox.com
Mon Nov 12 10:52:40 CET 2018


PSB

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Dekel Peled
> Sent: Monday, November 12, 2018 11:20 AM
> To: Yongseok Koh <yskoh at mellanox.com>; Shahaf Shuler
> <shahafs at mellanox.com>
> Cc: dev at dpdk.org; Ori Kam <orika at mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix MPLS item validation
> 
> Update the mlx5_flow_validate_item_mpls() function to allow
> MPLS over UDP as well as MPLS over IP.
> 
> Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
> Cc: orika at mellanox.com
> 
> Signed-off-by: Dekel Peled <dekelp at mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 21d65f4..0db862b 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -1626,7 +1626,9 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
>  	const struct rte_flow_item_mpls *mask = item->mask;
>  	int ret;
> 
> -	if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS)
> +	/* MPLS over IP and MPLS over UDP is allowed */
> +	if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS &&
> +	    target_protocol != IPPROTO_UDP)

I don' t think this is the solution. 
First before MPLS we can have GRE so this also need to be tested.
Second I don't think that the validation should use the target_protocol 
since it holds value that is not relevant to the question. For example if 
a user inserted the following rule eth / ipv4 proto = udp / mpls 
The flow will be O.K which clearly it is not.

>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ITEM,
> item,
>  					  "protocol filtering not compatible"
> --
> 1.8.3.1

Best,
Ori



More information about the dev mailing list