DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/rte_net: fix inner L2 length for tunneled Ethernet packets
@ 2025-07-28 12:30 Khadem Ullah
  0 siblings, 0 replies; 5+ messages in thread
From: Khadem Ullah @ 2025-07-28 12:30 UTC (permalink / raw)
  To: dev, jasvinder.singh, bruce.richardson
  Cc: thomas, andrew.rybchenko, stable, Khadem Ullah

Fix incorrect inner_l2_len values for VXLAN, VXLAN-GPE, GTPU, and Geneve.
These protocols carry full Ethernet frames, so inner_l2_len should be
set to the size of an Ethernet header (14 bytes), not include tunnel or
UDP headers.

Fixes: 64ed7f854c ('net: add tunnel packet type parsing')
Cc: stable@dpdk.org

Signed-off-by: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk>
---
 lib/net/rte_net.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 44fb6c0f51..ca9260a67b 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -198,7 +198,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 	case RTE_VXLAN_DEFAULT_PORT: {
 		*off += sizeof(struct rte_vxlan_hdr);
 		hdr_lens->tunnel_len = sizeof(struct rte_vxlan_hdr);
-		hdr_lens->inner_l2_len = RTE_ETHER_VXLAN_HLEN;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = RTE_VXLAN_GPE_TYPE_ETH; /* just for eth header parse. */
 		return RTE_PTYPE_TUNNEL_VXLAN;
 	}
@@ -210,7 +210,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 			return 0;
 		*off += sizeof(struct rte_vxlan_gpe_hdr);
 		hdr_lens->tunnel_len = sizeof(struct rte_vxlan_gpe_hdr);
-		hdr_lens->inner_l2_len = RTE_ETHER_VXLAN_GPE_HLEN;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = vgh->proto;
 
 		return RTE_PTYPE_TUNNEL_VXLAN_GPE;
@@ -244,7 +244,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 			*proto = 0;
 		}
 		*off += gtp_len;
-		hdr_lens->inner_l2_len = gtp_len + sizeof(struct rte_udp_hdr);
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		hdr_lens->tunnel_len = gtp_len;
 		if (port_no == RTE_GTPC_UDP_PORT)
 			return RTE_PTYPE_TUNNEL_GTPC;
@@ -262,7 +262,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 		geneve_len = sizeof(*gnh) + gnh->opt_len * 4;
 		*off += geneve_len;
 		hdr_lens->tunnel_len = geneve_len;
-		hdr_lens->inner_l2_len = sizeof(struct rte_udp_hdr) + geneve_len;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = gnh->proto;
 		if (gnh->proto == 0)
 			*proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] net/rte_net: fix inner L2 length for tunneled Ethernet packets
@ 2025-07-28 13:12 Khadem Ullah
  2025-07-28 13:28 ` Ivan Malov
  0 siblings, 1 reply; 5+ messages in thread
From: Khadem Ullah @ 2025-07-28 13:12 UTC (permalink / raw)
  To: dev, jasvinder.singh, bruce.richardson
  Cc: thomas, andrew.rybchenko, stable, Khadem Ullah

Fix incorrect inner_l2_len values for VXLAN, VXLAN-GPE, GTPU, and Geneve.
These protocols carry full Ethernet frames, so inner_l2_len should be
set to the size of an Ethernet header (14 bytes), not include tunnel or
UDP headers.

Fixes: 64ed7f854c ('net: add tunnel packet type parsing')
Cc: stable@dpdk.org

Signed-off-by: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk>
---
 lib/net/rte_net.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 44fb6c0f51..adcddeb670 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -198,7 +198,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 	case RTE_VXLAN_DEFAULT_PORT: {
 		*off += sizeof(struct rte_vxlan_hdr);
 		hdr_lens->tunnel_len = sizeof(struct rte_vxlan_hdr);
-		hdr_lens->inner_l2_len = RTE_ETHER_VXLAN_HLEN;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = RTE_VXLAN_GPE_TYPE_ETH; /* just for eth header parse. */
 		return RTE_PTYPE_TUNNEL_VXLAN;
 	}
@@ -210,7 +210,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 			return 0;
 		*off += sizeof(struct rte_vxlan_gpe_hdr);
 		hdr_lens->tunnel_len = sizeof(struct rte_vxlan_gpe_hdr);
-		hdr_lens->inner_l2_len = RTE_ETHER_VXLAN_GPE_HLEN;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = vgh->proto;
 
 		return RTE_PTYPE_TUNNEL_VXLAN_GPE;
@@ -244,7 +244,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 			*proto = 0;
 		}
 		*off += gtp_len;
-		hdr_lens->inner_l2_len = gtp_len + sizeof(struct rte_udp_hdr);
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		hdr_lens->tunnel_len = gtp_len;
 		if (port_no == RTE_GTPC_UDP_PORT)
 			return RTE_PTYPE_TUNNEL_GTPC;
@@ -262,7 +262,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 		geneve_len = sizeof(*gnh) + gnh->opt_len * 4;
 		*off += geneve_len;
 		hdr_lens->tunnel_len = geneve_len;
-		hdr_lens->inner_l2_len = sizeof(struct rte_udp_hdr) + geneve_len;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = gnh->proto;
 		if (gnh->proto == 0)
 			*proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
@@ -498,7 +498,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 		pkt_type |= RTE_PTYPE_INNER_L2_ETHER;
 		proto = eh->ether_type;
 		off += sizeof(*eh);
-		hdr_lens->inner_l2_len += sizeof(*eh);
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 	}
 
 	if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {
@@ -511,7 +511,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 		if (unlikely(vh == NULL))
 			return pkt_type;
 		off += sizeof(*vh);
-		hdr_lens->inner_l2_len += sizeof(*vh);
+		hdr_lens->inner_l2_len += sizeof(struct rte_vlan_hdr);
 		proto = vh->eth_proto;
 	} else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) {
 		const struct rte_vlan_hdr *vh;
@@ -524,7 +524,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 		if (unlikely(vh == NULL))
 			return pkt_type;
 		off += 2 * sizeof(*vh);
-		hdr_lens->inner_l2_len += 2 * sizeof(*vh);
+		hdr_lens->inner_l2_len += 2 * sizeof(struct rte_vlan_hdr);
 		proto = vh->eth_proto;
 	}
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] net/rte_net: fix inner L2 length for tunneled Ethernet packets
@ 2025-07-28 12:21 Khadem Ullah
  0 siblings, 0 replies; 5+ messages in thread
From: Khadem Ullah @ 2025-07-28 12:21 UTC (permalink / raw)
  To: dev, jasvinder.singh, bruce.richardson
  Cc: thomas, andrew.rybchenko, stable, Khadem Ullah

Fix incorrect inner_l2_len values for VXLAN, VXLAN-GPE, GTPU, and Geneve.
These protocols carry full Ethernet frames, so inner_l2_len should be
set to the size of an Ethernet header (14 bytes), not include tunnel or
UDP headers.

Fixes: 44fb6c0f51 ('net: initial tunnel type parser')
Cc: stable@dpdk.org

Signed-off-by: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk>
---
 lib/net/rte_net.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 44fb6c0f51..ca9260a67b 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -198,7 +198,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 	case RTE_VXLAN_DEFAULT_PORT: {
 		*off += sizeof(struct rte_vxlan_hdr);
 		hdr_lens->tunnel_len = sizeof(struct rte_vxlan_hdr);
-		hdr_lens->inner_l2_len = RTE_ETHER_VXLAN_HLEN;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = RTE_VXLAN_GPE_TYPE_ETH; /* just for eth header parse. */
 		return RTE_PTYPE_TUNNEL_VXLAN;
 	}
@@ -210,7 +210,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 			return 0;
 		*off += sizeof(struct rte_vxlan_gpe_hdr);
 		hdr_lens->tunnel_len = sizeof(struct rte_vxlan_gpe_hdr);
-		hdr_lens->inner_l2_len = RTE_ETHER_VXLAN_GPE_HLEN;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = vgh->proto;
 
 		return RTE_PTYPE_TUNNEL_VXLAN_GPE;
@@ -244,7 +244,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 			*proto = 0;
 		}
 		*off += gtp_len;
-		hdr_lens->inner_l2_len = gtp_len + sizeof(struct rte_udp_hdr);
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		hdr_lens->tunnel_len = gtp_len;
 		if (port_no == RTE_GTPC_UDP_PORT)
 			return RTE_PTYPE_TUNNEL_GTPC;
@@ -262,7 +262,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
 		geneve_len = sizeof(*gnh) + gnh->opt_len * 4;
 		*off += geneve_len;
 		hdr_lens->tunnel_len = geneve_len;
-		hdr_lens->inner_l2_len = sizeof(struct rte_udp_hdr) + geneve_len;
+		hdr_lens->inner_l2_len = sizeof(struct rte_ether_hdr);
 		*proto = gnh->proto;
 		if (gnh->proto == 0)
 			*proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
-- 
2.47.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-29  5:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-28 12:30 [PATCH] net/rte_net: fix inner L2 length for tunneled Ethernet packets Khadem Ullah
  -- strict thread matches above, loose matches on Subject: below --
2025-07-28 13:12 Khadem Ullah
2025-07-28 13:28 ` Ivan Malov
2025-07-29  5:06   ` Khadem Ullah
2025-07-28 12:21 Khadem Ullah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).