[PATCH v4 2/3] net: fix parse the tunnel length of tunnel packet with UDP
Dengdui Huang
huangdengdui at huawei.com
Fri May 23 04:55:56 CEST 2025
Currently, the tunnel length info is not available when
get the tunnel packet type with UDP port. This patch
adds the parsing of the tunnel length info.
Fixes: 64ed7f854cf4 ("net: add tunnel packet type parsing")
Cc: stable at dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
---
lib/net/rte_net.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 1771588a09..67d57d5f04 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -197,6 +197,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
switch (port_no) {
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;
*proto = RTE_VXLAN_GPE_TYPE_ETH; /* just for eth header parse. */
return RTE_PTYPE_TUNNEL_VXLAN;
@@ -208,6 +209,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
if (unlikely(vgh == NULL))
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;
*proto = vgh->proto;
@@ -243,6 +245,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
}
*off += gtp_len;
hdr_lens->inner_l2_len = gtp_len + sizeof(struct rte_udp_hdr);
+ hdr_lens->tunnel_len = gtp_len;
if (port_no == RTE_GTPC_UDP_PORT)
return RTE_PTYPE_TUNNEL_GTPC;
else if (port_no == RTE_GTPU_UDP_PORT)
@@ -258,6 +261,7 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
return 0;
geneve_len = sizeof(*gnh) + gnh->opt_len * 4;
*off = geneve_len;
+ hdr_lens->tunnel_len = geneve_len;
*proto = gnh->proto;
if (gnh->proto == 0)
*proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
--
2.33.0
More information about the dev
mailing list