Skip to contentSkip to conversation

MPLS RSS fixs

PATCH In review Xiaoyu Min 3 participants 6 messages Jul 2, 2021 – Jul 6, 2021 Network drivers

lore
Share & tools
lore

Xiaoyu Min

author
#0 lore raw

cover MPLS RSS fixs

This patch set fixs several problems of MPLS RSS:

- removed MPLSoIP(HW doesn't support) related code
- support MPLSoUDP, MPLSoGRE RSS expansion
- reduced number of expanded sub-flows for inner MPLS

Xiaoyu Min (3):
net/mlx5: fix MPLS over IP
net/mlx5: fix MPLS RSS expansion
net/mlx5: limit inner RSS expansion for MPLS

 drivers/net/mlx5/mlx5_flow.c    | 31 +++++++++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_dv.c |  3 ---
 2 files changed, 21 insertions(+), 13 deletions(-)
Signature · 1 line
2.32.0
author
#1 lore raw

PATCH 1/3 net/mlx5: fix MPLS over IP

HW doesn't support match MPLS over IP traffic.

Remove related code.

Fixes d1abe664ddde ("net/mlx5: add MPLS to Direct Verbs flow engine")
---
 drivers/net/mlx5/mlx5_flow.c    | 5 ++---
 drivers/net/mlx5/mlx5_flow_dv.c | 3 ---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/mlx5/mlx5_flow.c +2 -3
index 3b7c94d92f..21032a29a3 100644
@@ -2920,9 +2920,8 @@ mlx5_flow_validate_item_mpls(struct rte_eth_dev *dev __rte_unused,
 					  "MPLS not supported or"
 					  " disabled in firmware"
 					  " configuration.");
-	/* MPLS over IP, UDP, GRE is allowed */
-	if (!(prev_layer & (MLX5_FLOW_LAYER_OUTER_L3 |
-			    MLX5_FLOW_LAYER_OUTER_L4_UDP |
+	/* MPLS over UDP, GRE is allowed */
+	if (!(prev_layer & (MLX5_FLOW_LAYER_OUTER_L4_UDP |
 			    MLX5_FLOW_LAYER_GRE |
 			    MLX5_FLOW_LAYER_GRE_KEY)))
 		return rte_flow_error_set(error, EINVAL,
drivers/net/mlx5/mlx5_flow_dv.c +0 -3
index a04a3c2bb8..86ba9ffde3 100644
@@ -9032,9 +9032,6 @@ flow_dv_translate_item_mpls(void *matcher, void *key,
 			 RTE_ETHER_TYPE_MPLS);
 		break;
 	default:
-		MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff);
-		MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
-			 IPPROTO_MPLS);
 		break;
 	}
 	if (!in_mpls_v)
Signature · 1 line
2.32.0
author
#2 lore raw

PATCH 2/3 net/mlx5: fix MPLS RSS expansion

In reply to Xiaoyu Min

MPLSoUDP and MPLSoGRE are supported by PMD from
rte flow point of view.

RSS expansion doesn't support above but, instead, supports normal MPLS over L2, which actually will be rejected by PMD.

This patch removes RSS expansion support of the MPLS over L2 and adds support of MPLSoUDP and MPLSoGRE.

In addition to above, support for eth over MPLS expansion is added too.

Fixes a4a5cd21d20a ("net/mlx5: add flow MPLS item")
---
 drivers/net/mlx5/mlx5_flow.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow.c +12 -7
index 21032a29a3..a13b89e3a7 100644
@@ -131,6 +131,7 @@ mlx5_flow_is_rss_expandable_item(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_NVGRE:
 	case RTE_FLOW_ITEM_TYPE_GRE:
 	case RTE_FLOW_ITEM_TYPE_GENEVE:
+	case RTE_FLOW_ITEM_TYPE_MPLS:
 		return true;
 	default:
 		break;
@@ -474,8 +475,7 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_OUTER_ETH] = {
 		.next = MLX5_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_OUTER_IPV4,
-						  MLX5_EXPANSION_OUTER_IPV6,
-						  MLX5_EXPANSION_MPLS),
+						  MLX5_EXPANSION_OUTER_IPV6),
 		.type = RTE_FLOW_ITEM_TYPE_ETH,
 		.rss_types = 0,
 	},
@@ -503,7 +503,8 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_OUTER_IPV4_UDP] = {
 		.next = MLX5_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_VXLAN,
-						  MLX5_EXPANSION_VXLAN_GPE),
+						  MLX5_EXPANSION_VXLAN_GPE,
+						  MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_UDP,
 		.rss_types = ETH_RSS_NONFRAG_IPV4_UDP,
 	},
@@ -525,7 +526,8 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_OUTER_IPV6_UDP] = {
 		.next = MLX5_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_VXLAN,
-						  MLX5_EXPANSION_VXLAN_GPE),
+						  MLX5_EXPANSION_VXLAN_GPE,
+						  MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_UDP,
 		.rss_types = ETH_RSS_NONFRAG_IPV6_UDP,
 	},
@@ -548,12 +550,14 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
 	[MLX5_EXPANSION_GRE] = {
 		.next = MLX5_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
 						  MLX5_EXPANSION_IPV6,
-						  MLX5_EXPANSION_GRE_KEY),
+						  MLX5_EXPANSION_GRE_KEY,
+						  MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_GRE,
 	},
 	[MLX5_EXPANSION_GRE_KEY] = {
 		.next = MLX5_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
-						  MLX5_EXPANSION_IPV6),
+						  MLX5_EXPANSION_IPV6,
+						  MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_GRE_KEY,
 		.optional = 1,
 	},
@@ -563,7 +567,8 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_MPLS] = {
 		.next = MLX5_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
-						  MLX5_EXPANSION_IPV6),
+						  MLX5_EXPANSION_IPV6,
+						  MLX5_EXPANSION_ETH),
 		.type = RTE_FLOW_ITEM_TYPE_MPLS,
 	},
 	[MLX5_EXPANSION_ETH] = {
Signature · 1 line
2.32.0
author
#3 lore raw

PATCH 3/3 net/mlx5: limit inner RSS expansion for MPLS

In reply to Xiaoyu Min

If user wants to do MPLS inner RSS and only provides pattern till MPLS without inner items [1], RSS expansion will expand flows into 13 sub-flows[2] which is too many and it impacts flow insert rate, stack usage becomes large as well.

This expansion into 13 sub-flows seems not worthy of and it can be significantly reduced (i.e, 7 sub-flows [3]) by user providing at least one inner L2/L3 item [4].

[1]:
pattern eth / ipv4 / udp / mpls / end actions rss type tcp udp ip end level 2 / end

[2]:
eth / ipv4 / udp / mpls
eth / ipv4 / udp / mpls / ipv4
eth / ipv4 / udp / mpls / ipv4 / udp
eth / ipv4 / udp / mpls / ipv4 / tcp
eth / ipv4 / udp / mpls / ipv6
eth / ipv4 / udp / mpls / ipv6 / udp
eth / ipv4 / udp / mpls / ipv6 / tcp
eth / ipv4 / udp / mpls / eth / ipv4
eth / ipv4 / udp / mpls / eth / ipv4 / udp
eth / ipv4 / udp / mpls / eth / ipv4 / tcp
eth / ipv4 / udp / mpls / eth / ipv6
eth / ipv4 / udp / mpls / eth / ipv6 / udp
eth / ipv4 / udp / mpls / eth / ipv6 / tcp

[3]:
eth / ipv4 / udp / mpls / eth
eth / ipv4 / udp / mpls / eth / ipv4 / udp
eth / ipv4 / udp / mpls / eth / ipv4 / tcp
eth / ipv4 / udp / mpls / eth / ipv6
eth / ipv4 / udp / mpls / eth / ipv6 / udp
eth / ipv4 / udp / mpls / eth / ipv6 / tcp

[4]:
pattern eth / ipv4 / udp / mpls / eth / end actions rss type tcp udp ip level 2 / end

---
 drivers/net/mlx5/mlx5_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/mlx5/mlx5_flow.c +7 -0
index a13b89e3a7..673e7d55fc 100644
@@ -1671,6 +1671,13 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL,
 					  "RSS on eCPRI is not supported now");
 	}
+	if ((item_flags & MLX5_FLOW_LAYER_MPLS) &&
+	    !(item_flags &
+	      (MLX5_FLOW_LAYER_INNER_L2 | MLX5_FLOW_LAYER_INNER_L3)) &&
+	    rss->level > 1)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+					  "MPLS inner RSS needs to specify inner L2/L3 items after MPLS in pattern");
 	return 0;
 }
 
Signature · 1 line
2.32.0
#4 lore raw
In reply to Xiaoyu Min

From: Xiaoyu Min

Quoted 10 lines

This patch set fixs several problems of MPLS RSS:

- removed MPLSoIP(HW doesn't support) related code
- support MPLSoUDP, MPLSoGRE RSS expansion
- reduced number of expanded sub-flows for inner MPLS

Xiaoyu Min (3):
net/mlx5: fix MPLS over IP
net/mlx5: fix MPLS RSS expansion
net/mlx5: limit inner RSS expansion for MPLS

Series-acked by Matan Azrad <[email protected]>

Quoted 6 lines
 drivers/net/mlx5/mlx5_flow.c    | 31 +++++++++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_dv.c |  3 ---
 2 files changed, 21 insertions(+), 13 deletions(-)

--
2.32.0

#5 lore raw
In reply to Xiaoyu Min

Hi,

Quoted 17 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Xiaoyu Min
Sent: Friday, July 2, 2021 11:35 AM
Cc: [email protected]
Subject: [dpdk-dev] [PATCH 0/3] MPLS RSS fixs

This patch set fixs several problems of MPLS RSS:

- removed MPLSoIP(HW doesn't support) related code
- support MPLSoUDP, MPLSoGRE RSS expansion
- reduced number of expanded sub-flows for inner MPLS

Xiaoyu Min (3):
net/mlx5: fix MPLS over IP
net/mlx5: fix MPLS RSS expansion
net/mlx5: limit inner RSS expansion for MPLS

Quoted 6 lines
 drivers/net/mlx5/mlx5_flow.c    | 31 +++++++++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_dv.c |  3 ---
 2 files changed, 21 insertions(+), 13 deletions(-)

--
2.32.0

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh