* [PATCH 0/2] fix parse tunnel packet ptyoe
@ 2025-06-16 8:27 Dengdui Huang
2025-06-16 8:27 ` [PATCH 1/2] net: fix parse the tunnel length of tunnel with UDP Dengdui Huang
2025-06-16 8:27 ` [PATCH 2/2] app/testpmd: fix obtain inner info of tunnel packet Dengdui Huang
0 siblings, 2 replies; 3+ messages in thread
From: Dengdui Huang @ 2025-06-16 8:27 UTC (permalink / raw)
To: dev
Cc: thomas, jasvinder.singh, stephen, aman.deep.singh, lihuisong,
fengchengwen, liuyonglong
Dengdui Huang (2):
net: fix parse the tunnel length of tunnel with UDP
app/testpmd: fix obtain inner info of tunnel packet
app/test-pmd/csumonly.c | 6 +++---
lib/net/rte_net.c | 4 ++++
lib/net/rte_net.h | 2 ++
3 files changed, 9 insertions(+), 3 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] net: fix parse the tunnel length of tunnel with UDP
2025-06-16 8:27 [PATCH 0/2] fix parse tunnel packet ptyoe Dengdui Huang
@ 2025-06-16 8:27 ` Dengdui Huang
2025-06-16 8:27 ` [PATCH 2/2] app/testpmd: fix obtain inner info of tunnel packet Dengdui Huang
1 sibling, 0 replies; 3+ messages in thread
From: Dengdui Huang @ 2025-06-16 8:27 UTC (permalink / raw)
To: dev
Cc: thomas, jasvinder.singh, stephen, aman.deep.singh, lihuisong,
fengchengwen, liuyonglong
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.
Additionally, adding comments for the inner_l2_len field
and the tunnel_len field would help in understanding their.
Fixes: 64ed7f854cf4 ("net: add tunnel packet type parsing")
Cc: stable@dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
lib/net/rte_net.c | 4 ++++
lib/net/rte_net.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 098999e71e..44fb6c0f51 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;
hdr_lens->inner_l2_len = sizeof(struct rte_udp_hdr) + geneve_len;
*proto = gnh->proto;
if (gnh->proto == 0)
diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h
index 40ad6a71a1..65d724b84b 100644
--- a/lib/net/rte_net.h
+++ b/lib/net/rte_net.h
@@ -19,9 +19,11 @@ extern "C" {
*/
struct rte_net_hdr_lens {
uint8_t l2_len;
+ /* Outer_L4_len + ... + inner L2_len for tunneling pkt. */
uint8_t inner_l2_len;
uint16_t l3_len;
uint16_t inner_l3_len;
+ /* Protocol header of tunnel packets */
uint16_t tunnel_len;
uint8_t l4_len;
uint8_t inner_l4_len;
--
2.33.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] app/testpmd: fix obtain inner info of tunnel packet
2025-06-16 8:27 [PATCH 0/2] fix parse tunnel packet ptyoe Dengdui Huang
2025-06-16 8:27 ` [PATCH 1/2] net: fix parse the tunnel length of tunnel with UDP Dengdui Huang
@ 2025-06-16 8:27 ` Dengdui Huang
1 sibling, 0 replies; 3+ messages in thread
From: Dengdui Huang @ 2025-06-16 8:27 UTC (permalink / raw)
To: dev
Cc: thomas, jasvinder.singh, stephen, aman.deep.singh, lihuisong,
fengchengwen, liuyonglong
The l2_len field of tunnel packets already includes the tunnel_len field.
Additionally, the current offset used for the internal Ethernet header is
incorrect. This patch fixes these issues.
Fixes: 76730c7b9b5a ("app/testpmd: use packet type parsing API")
Cc: stable@dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
app/test-pmd/csumonly.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 203af35cf0..d355dbd8c0 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -712,11 +712,11 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
if (txp->parse_tunnel && RTE_ETH_IS_TUNNEL_PKT(ptype) != 0) {
info.is_tunnel = 1;
update_tunnel_outer(&info);
- info.l2_len = hdr_lens.inner_l2_len + hdr_lens.tunnel_len;
+ info.l2_len = hdr_lens.inner_l2_len;
info.l3_len = hdr_lens.inner_l3_len;
info.l4_len = hdr_lens.inner_l4_len;
- eth_hdr = (struct rte_ether_hdr *)(char *)l3_hdr +
- info.outer_l3_len + hdr_lens.tunnel_len;
+ eth_hdr = (struct rte_ether_hdr *)((char *)l3_hdr +
+ hdr_lens.l3_len + hdr_lens.l4_len + hdr_lens.tunnel_len);
info.ethertype = get_ethertype_by_ptype(eth_hdr,
ptype & RTE_PTYPE_INNER_L3_MASK);
tx_ol_flags |= get_tunnel_ol_flags_by_ptype(ptype);
--
2.33.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-16 8:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-16 8:27 [PATCH 0/2] fix parse tunnel packet ptyoe Dengdui Huang
2025-06-16 8:27 ` [PATCH 1/2] net: fix parse the tunnel length of tunnel with UDP Dengdui Huang
2025-06-16 8:27 ` [PATCH 2/2] app/testpmd: fix obtain inner info of tunnel packet Dengdui Huang
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).