Skip to contentSkip to conversation

net/mlx5: fix IPv6 flow item validation for VERB API

PATCH In review Gregory Etelson 2 participants 3 messages Mar 7, 2022 – Mar 8, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix IPv6 flow item validation for VERB API

In case the PMD was activated over VERB API,
limit IPv6 flow item next protocol mask value to 0 or 0xFF. The limitation is required for RSS flow action TCP and UDP types.

Fixes 491757372f98 ("net/mlx5: enforce limitation on IPv6 next protocol")
---
 drivers/net/mlx5/mlx5_flow.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/net/mlx5/mlx5_flow.c +15 -12
index 312649b732..97f05d7d30 100644
@@ -2562,8 +2562,6 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "IPv6 cannot follow L2/VLAN layer "
 					  "which ether type is not IPv6");
-	if (mask && mask->hdr.proto == UINT8_MAX && spec)
-		next_proto = spec->hdr.proto;
 	if (item_flags & MLX5_FLOW_LAYER_TUNNEL) {
 		if (next_proto == IPPROTO_IPIP || next_proto == IPPROTO_IPV6)
 			return rte_flow_error_set(error, EINVAL,
@@ -2572,16 +2570,6 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 						  "multiple tunnel "
 						  "not supported");
 	}
-	if (next_proto == IPPROTO_HOPOPTS  ||
-	    next_proto == IPPROTO_ROUTING  ||
-	    next_proto == IPPROTO_FRAGMENT ||
-	    next_proto == IPPROTO_ESP	   ||
-	    next_proto == IPPROTO_AH	   ||
-	    next_proto == IPPROTO_DSTOPTS)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ITEM, item,
-					  "IPv6 proto (next header) should "
-					  "not be set as extension header");
 	if (item_flags & MLX5_FLOW_LAYER_IPIP)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -2609,6 +2597,21 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
+	if (mask->hdr.proto != 0 && mask->hdr.proto != 0xff)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK, mask,
+					  "partial mask is not supported for protocol");
+	next_proto = spec->hdr.proto & mask->hdr.proto;
+	if (next_proto == IPPROTO_HOPOPTS  ||
+	    next_proto == IPPROTO_ROUTING  ||
+	    next_proto == IPPROTO_FRAGMENT ||
+	    next_proto == IPPROTO_ESP	   ||
+	    next_proto == IPPROTO_AH	   ||
+	    next_proto == IPPROTO_DSTOPTS)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "IPv6 proto (next header) should "
+					  "not be set as extension header");
 	return 0;
 }
 
Signature · 1 line
2.35.1
#1 lore raw

Hi,

Quoted 14 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Monday, March 7, 2022 7:18 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Slava Ovsiienko <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>
Subject: [PATCH] net/mlx5: fix IPv6 flow item validation for VERB API

In case the PMD was activated over VERB API, limit IPv6 flow item next protocol mask value to 0 or 0xFF.
The limitation is required for RSS flow action TCP and UDP types.

Quoted 5 lines
Fixes 491757372f98 ("net/mlx5: enforce limitation on IPv6 next protocol")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#2 lore raw

Hi,

Quoted 32 lines

-----Original Message-----
From: Raslan Darawsheh
Sent: Tuesday, March 8, 2022 11:10 AM
To: Gregory Etelson <[email protected]>; [email protected]
Cc: Matan Azrad <[email protected]>; [email protected]; Slava Ovsiienko <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>
Subject: RE: [PATCH] net/mlx5: fix IPv6 flow item validation for VERB API

Hi,

Quoted 14 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Monday, March 7, 2022 7:18 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Slava Ovsiienko <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>
Subject: [PATCH] net/mlx5: fix IPv6 flow item validation for VERB API

In case the PMD was activated over VERB API, limit IPv6 flow item next protocol mask value to 0 or 0xFF.
The limitation is required for RSS flow action TCP and UDP types.

Quoted 6 lines
Fixes 491757372f98 ("net/mlx5: enforce limitation on IPv6 next

protocol")

Quoted 4 lines

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

Dropping this patch from next-net-mlx as it introduces a new bug with dv_flow_en,

Kindest regards,
Raslan Darawsheh