DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix set VLAN vid size check
@ 2020-04-30  8:31 Wisam Jaddo
  2020-04-30  8:55 ` Slava Ovsiienko
  2020-05-04  7:51 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Wisam Jaddo @ 2020-04-30  8:31 UTC (permalink / raw)
  To: dev, dekelp, viacheslavo, rasland; +Cc: motih, stable

All comparison should be done in CPU endianness, otherwise
it will not give right results.

for example:
255 after converting into RTE_BE16 will be biger than 4096 after
converting into RTE_BE16.

Fixes: a5f2da0b816b ("net/mlx5: support modify VLAN ID on new VLAN header")
Cc: motih@mellanox.com
Cc: stable@dpdk.org backport

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 6263ecc731..2b88e85248 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1965,7 +1965,7 @@ flow_dv_validate_action_set_vlan_vid(uint64_t item_flags,
 	const struct rte_flow_action *action = actions;
 	const struct rte_flow_action_of_set_vlan_vid *conf = action->conf;
 
-	if (conf->vlan_vid > RTE_BE16(0xFFE))
+	if (rte_be_to_cpu_16(conf->vlan_vid) > 0xFFE)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "VLAN VID value is too big");
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix set VLAN vid size check
  2020-04-30  8:31 [dpdk-dev] [PATCH] net/mlx5: fix set VLAN vid size check Wisam Jaddo
@ 2020-04-30  8:55 ` Slava Ovsiienko
  2020-05-04  7:51 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2020-04-30  8:55 UTC (permalink / raw)
  To: Wisam Monther, dev, Dekel Peled, Raslan Darawsheh; +Cc: Moti Haimovsky, stable

> -----Original Message-----
> From: Wisam Monther <wisamm@mellanox.com>
> Sent: Thursday, April 30, 2020 11:31
> To: dev@dpdk.org; Dekel Peled <dekelp@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Raslan Darawsheh <rasland@mellanox.com>
> Cc: Moti Haimovsky <motih@mellanox.com>; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix set VLAN vid size check
> 
> All comparison should be done in CPU endianness, otherwise it will not give
> right results.
> 
> for example:
> 255 after converting into RTE_BE16 will be biger than 4096 after converting
> into RTE_BE16.
> 
> Fixes: a5f2da0b816b ("net/mlx5: support modify VLAN ID on new VLAN
> header")
> Cc: motih@mellanox.com
> Cc: stable@dpdk.org backport
> 
> Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index 6263ecc731..2b88e85248 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1965,7 +1965,7 @@ flow_dv_validate_action_set_vlan_vid(uint64_t
> item_flags,
>  	const struct rte_flow_action *action = actions;
>  	const struct rte_flow_action_of_set_vlan_vid *conf = action->conf;
> 
> -	if (conf->vlan_vid > RTE_BE16(0xFFE))
> +	if (rte_be_to_cpu_16(conf->vlan_vid) > 0xFFE)
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION,
> action,
>  					  "VLAN VID value is too big");
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix set VLAN vid size check
  2020-04-30  8:31 [dpdk-dev] [PATCH] net/mlx5: fix set VLAN vid size check Wisam Jaddo
  2020-04-30  8:55 ` Slava Ovsiienko
@ 2020-05-04  7:51 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-05-04  7:51 UTC (permalink / raw)
  To: Wisam Monther, dev, Dekel Peled, Slava Ovsiienko; +Cc: Moti Haimovsky, stable

Hi,

> -----Original Message-----
> From: Wisam Monther <wisamm@mellanox.com>
> Sent: Thursday, April 30, 2020 11:31 AM
> To: dev@dpdk.org; Dekel Peled <dekelp@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Raslan Darawsheh <rasland@mellanox.com>
> Cc: Moti Haimovsky <motih@mellanox.com>; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix set VLAN vid size check
> 
> All comparison should be done in CPU endianness, otherwise
> it will not give right results.
> 
> for example:
> 255 after converting into RTE_BE16 will be biger than 4096 after
> converting into RTE_BE16.
> 
> Fixes: a5f2da0b816b ("net/mlx5: support modify VLAN ID on new VLAN
> header")
> Cc: motih@mellanox.com
> Cc: stable@dpdk.org backport
> 
> Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 6263ecc731..2b88e85248 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1965,7 +1965,7 @@ flow_dv_validate_action_set_vlan_vid(uint64_t
> item_flags,
>  	const struct rte_flow_action *action = actions;
>  	const struct rte_flow_action_of_set_vlan_vid *conf = action->conf;
> 
> -	if (conf->vlan_vid > RTE_BE16(0xFFE))
> +	if (rte_be_to_cpu_16(conf->vlan_vid) > 0xFFE)
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION,
> action,
>  					  "VLAN VID value is too big");
> --
> 2.17.1


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2020-05-04  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  8:31 [dpdk-dev] [PATCH] net/mlx5: fix set VLAN vid size check Wisam Jaddo
2020-04-30  8:55 ` Slava Ovsiienko
2020-05-04  7:51 ` 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).