DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 1/1] net: fix inner L2 length for GRE and NVGRE
@ 2025-10-29 13:05 Rakesh Kudurumalla
  2025-12-18  9:09 ` [PATCH v2 " Rakesh Kudurumalla
  0 siblings, 1 reply; 2+ messages in thread
From: Rakesh Kudurumalla @ 2025-10-29 13:05 UTC (permalink / raw)
  To: Jie Hai; +Cc: dev, jerinj, ndabilpuram, Rakesh Kudurumalla

Inner l2 length needs to be updated to include GRE and NVGRE
headers. Not updating this would cause failures for applications
which would be expecting l2_len field to be valid for
inner checksum offload cases.

Fixes: 76730c7b9b5a ("app/testpmd: use packet type parsing API")

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
 lib/net/rte_net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 44fb6c0f51..5476d2a573 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -480,6 +480,9 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 			return pkt_type;
 
 		pkt_type |= ptype_tunnel_without_udp(&proto, m, &off);
+		if ((pkt_type & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_GRE ||
+		    (pkt_type & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_NVGRE)
+			hdr_lens->inner_l2_len += sizeof(struct rte_gre_hdr);
 		hdr_lens->tunnel_len = off - prev_off;
 	}
 
-- 
2.25.1


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

* [PATCH v2 1/1] net: fix inner L2 length for GRE and NVGRE
  2025-10-29 13:05 [PATCH v1 1/1] net: fix inner L2 length for GRE and NVGRE Rakesh Kudurumalla
@ 2025-12-18  9:09 ` Rakesh Kudurumalla
  0 siblings, 0 replies; 2+ messages in thread
From: Rakesh Kudurumalla @ 2025-12-18  9:09 UTC (permalink / raw)
  To: Jie Hai; +Cc: dev, jerinj, ndabilpuram, Rakesh Kudurumalla

Inner l2 length needs to be updated to include GRE and NVGRE
headers. Not updating this would cause failures for applications
which would be expecting l2_len field to be valid for
inner checksum offload cases.

Fixes: 76730c7b9b5a ("app/testpmd: use packet type parsing API")

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---

V2: update innner l2 length based of GRE header flags
for key, sequence and checksum

 lib/net/rte_net.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index c70b57fdc0..a24a0db526 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -480,6 +480,19 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 			return pkt_type;
 
 		pkt_type |= ptype_tunnel_without_udp(&proto, m, &off);
+		if ((pkt_type & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_GRE ||
+		    (pkt_type & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_NVGRE) {
+			const struct rte_gre_hdr *gh;
+
+			gh = rte_pktmbuf_read(m, prev_off, sizeof(*gh), NULL);
+			if (gh->k)
+				hdr_lens->inner_l2_len += 4;
+			if (gh->s)
+				hdr_lens->inner_l2_len += 4;
+			if (gh->c)
+				hdr_lens->inner_l2_len += 4;
+			hdr_lens->inner_l2_len += sizeof(struct rte_gre_hdr);
+		}
 		hdr_lens->tunnel_len = off - prev_off;
 		hdr_lens->inner_l2_len = off - prev_off;
 	}
-- 
2.25.1


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

end of thread, other threads:[~2025-12-18  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-29 13:05 [PATCH v1 1/1] net: fix inner L2 length for GRE and NVGRE Rakesh Kudurumalla
2025-12-18  9:09 ` [PATCH v2 " Rakesh Kudurumalla

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).