Skip to contentSkip to conversation

Support IPIP Tunnel in NT2HWS and HWS

PATCH Applied Junfeng Guo 2 participants 4 messages Jun 20, 2025 – Jun 27, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

cover Support IPIP Tunnel in NT2HWS and HWS

This patchset support IPIP Tunnel in NT2HWS and HWS, including the following {IPv4 x IPv6} combinations:
- IPv4 over IPv4
- IPv4 over IPv6
- IPv6 over IPv4
- IPv6 over IPv6

This feature cover both basic IPIP and IPIP over VXLAN Tunnel types.

Junfeng Guo (2):
net/mlx5/hws: recognize IPIP in definer layer net/mlx5: support IPIP flow for all combinations

 drivers/net/mlx5/hws/mlx5dr_definer.c | 10 ++++++++++
 drivers/net/mlx5/mlx5_flow.c          |  5 -----
 drivers/net/mlx5/mlx5_flow_hw.c       |  3 ++-
 3 files changed, 12 insertions(+), 6 deletions(-)
Signature · 1 line
2.45.0
#1 lore raw

PATCH 1/2 net/mlx5/hws: recognize IPIP in definer layer

Definers are HW objects that are used for matching, rte items are translated to definers, each definer holds the fields and bit-masks used for HW flow matching.

This patch recognize IP-in-IP tunnel type in definer layer, including the following combinations:
- IPv4 over IPv4
- IPv4 over IPv6
- IPv6 over IPv4
- IPv6 over IPv6

---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/mlx5/hws/mlx5dr_definer.c +10 -0
index 9c11d6c2cb..7464d95373 100644
@@ -3322,11 +3322,21 @@ mlx5dr_definer_conv_items_to_hl(struct mlx5dr_context *ctx,
 				(MLX5_FLOW_LAYER_OUTER_VLAN | MLX5_FLOW_LAYER_OUTER_L2);
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
+			if (cd.last_item == RTE_FLOW_ITEM_TYPE_IPV4 ||
+			    cd.last_item == RTE_FLOW_ITEM_TYPE_IPV6) {
+				cd.tunnel = true;
+				item_flags |= MLX5_FLOW_LAYER_IPIP;
+			}
 			ret = mlx5dr_definer_conv_item_ipv4(&cd, items, i);
 			item_flags |= cd.tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
 						  MLX5_FLOW_LAYER_OUTER_L3_IPV4;
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV6:
+			if (cd.last_item == RTE_FLOW_ITEM_TYPE_IPV4 ||
+			    cd.last_item == RTE_FLOW_ITEM_TYPE_IPV6) {
+				cd.tunnel = true;
+				item_flags |= MLX5_FLOW_LAYER_IPIP;
+			}
 			ret = mlx5dr_definer_conv_item_ipv6(&cd, items, i);
 			item_flags |= cd.tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 :
 						  MLX5_FLOW_LAYER_OUTER_L3_IPV6;
Signature · 1 line
2.45.0
#2 lore raw

PATCH 2/2 net/mlx5: support IPIP flow for all combinations

In reply to Junfeng Guo

IP-in-IP tunnel type includes the following combination:
- IPv4 over IPv4
- IPv4 over IPv6
- IPv6 over IPv4
- IPv6 over IPv6

It's okay to have MLX5_FLOW_LAYER_IPIP flag when validate IPv6 item. And it's okay to have outer L3 layer as either IPv4 or IPv6 when setting the IP-in-IP tunnel item flag.

---
 drivers/net/mlx5/mlx5_flow.c    | 5 -----
 drivers/net/mlx5/mlx5_flow_hw.c | 3 ++-
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/mlx5/mlx5_flow.c +0 -5
index 3d49a2d833..8db372123c 100644
@@ -2973,11 +2973,6 @@ mlx5_flow_validate_item_ipv6(const struct rte_eth_dev *dev,
 					  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,
-					  "wrong tunnel type - IPv4 specified "
-					  "but IPv6 item provided");
 	if (item_flags & l3m)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
drivers/net/mlx5/mlx5_flow_hw.c +2 -1
index af2e7a84a5..0aaa8fe2a6 100644
@@ -8325,7 +8325,8 @@ mlx5_hw_flow_tunnel_ip_check(uint64_t last_item, uint64_t *item_flags)
 {
 	bool tunnel;
 
-	if (last_item == MLX5_FLOW_LAYER_OUTER_L3_IPV4) {
+	if (last_item == MLX5_FLOW_LAYER_OUTER_L3_IPV4 ||
+	    last_item == MLX5_FLOW_LAYER_OUTER_L3_IPV6) {
 		tunnel = true;
 		*item_flags |= MLX5_FLOW_LAYER_IPIP;
 	} else if (last_item == MLX5_FLOW_LAYER_OUTER_L3_IPV6 ||
Signature · 1 line
2.45.0
#3 lore raw
In reply to Junfeng Guo

20/06/2025 12:42, Junfeng Guo:

Quoted 7 lines

This patchset support IPIP Tunnel in NT2HWS and HWS, including the following {IPv4 x IPv6} combinations:
- IPv4 over IPv4
- IPv4 over IPv6
- IPv6 over IPv4
- IPv6 over IPv6

Quoted 5 lines

This feature cover both basic IPIP and IPIP over VXLAN Tunnel types.

Junfeng Guo (2):
net/mlx5/hws: recognize IPIP in definer layer net/mlx5: support IPIP flow for all combinations

Applied, thanks.