Skip to contentSkip to conversation

net/mlx5: fix fragmented ptype match

PATCH Superseded Alexander Kozyrev 3 participants 4 messages Dec 19, 2024 – Feb 23, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix fragmented ptype match

Fragmented PTYPE macthing requires the setting the mask to the exact RTE_PTYPE_L4_FRAG value to avoid conflicts with other L4 types. Adding L2 or L3 types to the same mask should be allowed, but there is a check for the exact value for setting the definer. This prevents the fragmented packets from matching in case of L2/L3 mask is provided as well. Mask out L2/L3 types when setting L4_FRAG.

Fixes 761439a20f net/mlx5/hws: support fragmented packet type matching
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_definer.c +2 -2
index e6d3dbfa46..837e0c47bd 100644
@@ -2205,7 +2205,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 		 * Cannot be combined with Layer 4 Types (TCP/UDP).
 		 * The exact value must be specified in the mask.
 		 */
-		if (m->packet_type == RTE_PTYPE_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, false)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
@@ -2227,7 +2227,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 	}
 
 	if (m->packet_type & RTE_PTYPE_INNER_L4_MASK) {
-		if (m->packet_type == RTE_PTYPE_INNER_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, true)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
Signature · 1 line
2.43.5
#1 lore raw

PATCH v2 1/1 net/mlx5/hws: fix fragmented ptype match

Fragmented PTYPE matching requires setting the mask to the exact RTE_PTYPE_L4_FRAG value to avoid conflicts with other L4 types. Adding L2 or L3 types to the same mask should be allowed, but there is a check for the exact value for setting the definer. This prevents the fragmented packets from matching in case of L2/L3 mask is provided as well. Mask out L2/L3 types when setting L4_FRAG.

Fixes 761439a20f net/mlx5/hws: support fragmented packet type matching
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_definer.c +2 -2
index e6d3dbfa46..837e0c47bd 100644
@@ -2205,7 +2205,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 		 * Cannot be combined with Layer 4 Types (TCP/UDP).
 		 * The exact value must be specified in the mask.
 		 */
-		if (m->packet_type == RTE_PTYPE_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, false)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
@@ -2227,7 +2227,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 	}
 
 	if (m->packet_type & RTE_PTYPE_INNER_L4_MASK) {
-		if (m->packet_type == RTE_PTYPE_INNER_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, true)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
Signature · 1 line
2.43.5
Acked-by on v2 1/1
#2 lore raw

RE: [PATCH v2] net/mlx5/hws: fix fragmented ptype match

Quoted 19 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Thursday, December 19, 2024 17:06
To: [email protected]
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Dariusz Sosnowski <[email protected]>; Bing Zhao <[email protected]>; Suanming Mou <[email protected]>; Michael Baum <[email protected]>
Subject: [PATCH v2] net/mlx5/hws: fix fragmented ptype match

Fragmented PTYPE matching requires setting the mask to the exact RTE_PTYPE_L4_FRAG value to avoid conflicts with other L4 types. Adding L2 or L3 types to the same mask should be allowed, but there is a check for the exact value for setting the definer.
This prevents the fragmented packets from matching in case of L2/L3 mask is provided as well. Mask out L2/L3 types when setting L4_FRAG.

Quoted 4 lines
Fixes 761439a20f net/mlx5/hws: support fragmented packet type matching

Best regards,
Dariusz Sosnowski

#3 lore raw

Re: [PATCH v2] net/mlx5/hws: fix fragmented ptype match

In reply to Alexander Kozyrev

Hi,

From: Alexander Kozyrev <[email protected]>
Sent: Thursday, December 19, 2024 6:05 PM
To: [email protected]
Cc: [email protected]; Raslan Darawsheh; Slava Ovsiienko; Dariusz Sosnowski; Bing Zhao; Suanming Mou; Michael Baum
Subject: [PATCH v2] net/mlx5/hws: fix fragmented ptype match

Fragmented PTYPE matching requires setting the mask to the exact RTE_PTYPE_L4_FRAG value to avoid conflicts with other L4 types. Adding L2 or L3 types to the same mask should be allowed, but there is a check for the exact value for setting the definer. This prevents the fragmented packets from matching in case of L2/L3 mask is provided as well. Mask out L2/L3 types when setting L4_FRAG.

Fixes 761439a20f net/mlx5/hws: support fragmented packet type matching

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh