Skip to contentSkip to conversation

doc: fix MPLS limitations under HWS

PATCH In review Maayan Kashani 2 participants 3 messages Feb 26, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 doc: fix MPLS limitations under HWS

Update missing limitations.

Fixes 1e2a51f545b6 ("net/mlx5: support MPLS tunnel with HWS")
---
 doc/guides/nics/mlx5.rst | 8 ++++++++
 1 file changed, 8 insertions(+)
doc/guides/nics/mlx5.rst +8 -0
index 690b46a9743..316c3397d2e 100644
@@ -279,6 +279,14 @@ Limitations
        which results in L3 encap.
     d. Only in transfer (switchdev) mode.
 
+  - MPLS:
+
+    - RTE_FLOW_ITEM_TYPE_MPLS matching is not supported for mlxcfg ``FLEX_PARSER_PROFILE_ENABLE`` = 1.
+    - RTE_FLOW_ITEM_TYPE_MPLS matching is not supported on group 0.
+    - Testpmd commands "set mplsoudp_encap" and "set mplsoudp_decap" support only one MPLS.
+    - For non relaxed pattern template, MPLSoUDP match is assumed when trying to match MPLS w/o former
+      protocol match.
+
 - When using Verbs flow engine (``dv_flow_en`` = 0), flow pattern without any
   specific VLAN will match for VLAN packets as well:
 
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/2 net/mlx5: add MPLSoGRE matching in HWS

Remove limitations in validation and MPLS match translation.

For non relaxed mode, assume MPLSoUDP if no protocol is mentioned. Set UDP dest port to MPLS type only for UDP protocol.

---
 doc/guides/nics/mlx5.rst              |  2 --
 drivers/net/mlx5/hws/mlx5dr_definer.c | 28 +++++++++++++--------------
 drivers/net/mlx5/mlx5_flow.c          |  7 -------
 3 files changed, 13 insertions(+), 24 deletions(-)
doc/guides/nics/mlx5.rst +0 -2
index 316c3397d2e..204572c885e 100644
@@ -356,8 +356,6 @@ Limitations
 
 - L3 VXLAN and VXLAN-GPE tunnels cannot be supported together with MPLSoGRE and MPLSoUDP.
 
-- MPLSoGRE is not supported in HW steering (``dv_flow_en`` = 2).
-
 - MPLSoUDP with multiple MPLS headers is only supported in HW steering (``dv_flow_en`` = 2).
 
 - Match on Geneve header supports the following fields only:
drivers/net/mlx5/hws/mlx5dr_definer.c +13 -15
index 837e0c47bda..ba4053c552f 100644
@@ -1644,14 +1644,9 @@ mlx5dr_definer_conv_item_mpls(struct mlx5dr_definer_conv_data *cd,
 {
 	const struct rte_flow_item_mpls *m = item->mask;
 	struct mlx5dr_definer_fc *fc;
-	bool inner = cd->tunnel;
-
-	if (inner) {
-		DR_LOG(ERR, "Inner MPLS item not supported");
-		rte_errno = ENOTSUP;
-		return rte_errno;
-	}
+	bool is_udp;
 
+	/* If no protocol is set - assume MPLSoUDP */
 	if (!cd->relaxed) {
 		/* In order to match on MPLS we must match on ip_protocol and l4_dport. */
 		fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, false)];
@@ -1661,14 +1656,17 @@ mlx5dr_definer_conv_item_mpls(struct mlx5dr_definer_conv_data *cd,
 			fc->tag_set = &mlx5dr_definer_udp_protocol_set;
 			DR_CALC_SET(fc, eth_l2, l4_type_bwc, false);
 		}
-
-		/* Currently support only MPLSoUDP */
-		fc = &cd->fc[DR_CALC_FNAME(L4_DPORT, false)];
-		if (!fc->tag_set) {
-			fc->item_idx = item_idx;
-			fc->tag_mask_set = &mlx5dr_definer_ones_set;
-			fc->tag_set = &mlx5dr_definer_mpls_udp_port_set;
-			DR_CALC_SET(fc, eth_l4, destination_port, false);
+		is_udp = (fc->tag_set == &mlx5dr_definer_udp_protocol_set);
+
+		if (is_udp) {
+			/* Set UDP dest port to MPLS. */
+			fc = &cd->fc[DR_CALC_FNAME(L4_DPORT, false)];
+			if (!fc->tag_set) {
+				fc->item_idx = item_idx;
+				fc->tag_mask_set = &mlx5dr_definer_ones_set;
+				fc->tag_set = &mlx5dr_definer_mpls_udp_port_set;
+				DR_CALC_SET(fc, eth_l4, destination_port, false);
+			}
 		}
 	}
 
drivers/net/mlx5/mlx5_flow.c +0 -7
index 3fbe89a9d42..69d7621d0bf 100644
@@ -3812,13 +3812,6 @@ mlx5_flow_validate_item_mpls(struct rte_eth_dev *dev __rte_unused,
 			return rte_flow_error_set(error, ENOTSUP,
 						  RTE_FLOW_ERROR_TYPE_ITEM, item,
 						  "multiple tunnel layers not supported");
-	} else {
-		/* Multi-tunnel isn't allowed but MPLS over GRE is an exception. */
-		if ((item_flags & MLX5_FLOW_LAYER_TUNNEL) &&
-		    !(item_flags & MLX5_FLOW_LAYER_MPLS))
-			return rte_flow_error_set(error, ENOTSUP,
-						  RTE_FLOW_ERROR_TYPE_ITEM, item,
-						  "multiple tunnel layers not supported");
 	}
 	if (!mask)
 		mask = nic_mask;
Signature · 1 line
2.21.0
Acked-by Dariusz Sosnowski on v1 1/2
#2 lore raw
In reply to Maayan Kashani

Hi,

From: Maayan Kashani <[email protected]>
Sent: Wednesday, February 26, 2025 10:02 AM
To: [email protected]
Cc: Maayan Kashani; Dariusz Sosnowski; Raslan Darawsheh; [email protected]; Slava Ovsiienko; Bing Zhao; Ori Kam; Suanming Mou; Matan Azrad; Michael Baum
Subject: [PATCH 1/2] doc: fix MPLS limitations under HWS

Update missing limitations.

Fixes 1e2a51f545b6 ("net/mlx5: support MPLS tunnel with HWS")

series squashed and applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh