From: Wisam Jaddo Date: Thu, 30 Apr 2020 08:31:03 +0000 (+0000) Subject: net/mlx5: fix VLAN ID check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b756f2980718bf2cb1c8f57762f42c656986998d;p=dpdk.git net/mlx5: fix VLAN ID 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: stable@dpdk.org Signed-off-by: Wisam Jaddo Acked-by: Viacheslav Ovsiienko --- diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 794afcf18c..8aba5c774a 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");