net/mlx5: fix NVGRE item validation for template API
PATCH 1/1 net/mlx5: fix NVGRE item validation for template API
The template API NVGRE item can support full mask. This patch updates default NVGRE item mask for the template API.
Fixes 80c676259a04 ("net/mlx5: validate HWS template items")
Signed-off-by Jiawei Wang <[email protected]>
Acked-by Bing Zhao <[email protected]>
--- drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.c +11 -2
@@ -3867,6 +3867,15 @@ mlx5_flow_validate_item_nvgre(const struct rte_eth_dev *dev,const struct rte_flow_item_nvgre *mask = item->mask;int ret; +const struct rte_flow_item_nvgre hws_nic_mask = { + .c_k_s_rsvd0_ver =RTE_BE16 (0xB000 ), + .protocol =RTE_BE16 (UINT16_MAX ), + .tni = {0xff ,0xff ,0xff }, + .flow_id =0xff + }; +const struct rte_flow_item_nvgre *nic_mask = !mlx5_hws_active (dev) ? + &rte_flow_item_nvgre_mask : &hws_nic_mask; +if (target_protocol !=0xff && target_protocol !=IPPROTO_GRE ) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -3884,10 +3893,10 @@ mlx5_flow_validate_item_nvgre(const struct rte_eth_dev *dev, item, "L3 Layer is missing"); }if (!mask) - mask = &rte_flow_item_nvgre_mask; + mask = nic_mask; ret =mlx5_flow_item_acceptable (dev, item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_nvgre_mask, + (const uint8_t *)nic_mask,sizeof (struct rte_flow_item_nvgre ),MLX5_ITEM_RANGE_NOT_ACCEPTED , error);if (ret <0 )
Signature · 1 line
2.18.1
Hi,
From: Jiawei(Jonny) Wang <[email protected]>
Sent: Friday, July 26, 2024 4:49 AM
To: Bing Zhao; Slava Ovsiienko; Dariusz Sosnowski; Ori Kam; Suanming Mou; Matan Azrad; Gregory Etelson
Cc: [email protected]; Raslan Darawsheh; [email protected]
Subject: [PATCH] net/mlx5: fix NVGRE item validation for template API
The template API NVGRE item can support full mask. This patch updates default NVGRE item mask for the template API.
Fixes 80c676259a04 ("net/mlx5: validate HWS template items")
Signed-off-by Jiawei Wang <[email protected]>
Acked-by Bing Zhao <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh