Skip to contentSkip to conversation

net/mlx5: fix failed to match on empty gre on root table

PATCH In review Maayan Kashani 2 participants 2 messages Mar 12, 2025 – Mar 13, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix failed to match on empty gre on root table

The currnent implementation sets a gre mask with protocol masked in case the user did not supply the protocol mask.
In template mode, for group 0, the gre translation was called once with the mask and later with the value.
with gre open matcher(mask/value is null) default values were assigned gre protocol mask=0xffff and gre protocol value=0.

Therefore gre packet with protocol value not equal zero, will not match the rule.
Changed the default protocol mask to be zero instead of 0xffff.

In case of empty gre match,
this fix will ignore the protocol field matching, gre will only be matched by the IP next header field in previous header in packet.

Fixes 25ab2cbba31d ("net/mlx5: fix GRE flow item translation for root table")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_dv.c +1 -1
index c77041317b4..3473c6f7713 100644
@@ -9850,7 +9850,7 @@ flow_dv_translate_item_gre(void *key, const struct rte_flow_item *item,
 	/* HWS mask logic only */
 	if (key_type & MLX5_SET_MATCHER_HS_M) {
 		if (!gre_m)
-			gre_m = &rte_flow_item_gre_mask;
+			gre_m = &empty_gre;
 		gre_v = gre_m;
 	} else if (!gre_v) {
 		gre_v = &empty_gre;
Signature · 1 line
2.21.0
Acked-by Bing Zhao on v1 1/1
#1 lore raw

From: Maayan Kashani <[email protected]>
Sent: Wednesday, March 12, 2025 1:23 PM
To: [email protected]
Cc: Maayan Kashani; Dariusz Sosnowski; Raslan Darawsheh; [email protected]; Bing Zhao; Slava Ovsiienko; Ori Kam; Suanming Mou; Matan Azrad; Gregory Etelson
Subject: [PATCH] net/mlx5: fix failed to match on empty gre on root table

The currnent implementation sets a gre mask with protocol masked in case the user did not supply the protocol mask.
In template mode, for group 0, the gre translation was called once with the mask and later with the value.
with gre open matcher(mask/value is null) default values were assigned gre protocol mask=0xffff and gre protocol value=0.

Therefore gre packet with protocol value not equal zero, will not match the rule.
Changed the default protocol mask to be zero instead of 0xffff.

In case of empty gre match,
this fix will ignore the protocol field matching, gre will only be matched by the IP next header field in previous header in packet.

Fixes 25ab2cbba31d ("net/mlx5: fix GRE flow item translation for root table")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh