[PATCH] net/rte_net: fix inner L2 length for tunneled Ethernet packets
Andrew Rybchenko
andrew.rybchenko at oktetlabs.ru
Thu Jul 31 12:26:51 CEST 2025
On 7/29/25 08:06, Khadem Ullah wrote:
> Hi Ivan,
>
> No, it does not breaking testpmd or any other applications.
> Yes, the structure is correct in rte_net.h and comment as well.
>
> You can run testpmd in rxonly mode and set verbose to 3, send the following packet from remote and you will observe the output as given below:
>
> pkt=Ether(src="04:3f:72:f3:7a:43",dst="C8:0A:A9:04:49:1A")/IP(src="19.168.1.1",dst="19.168.1.1")/UDP(dport=4789)/VXLAN(vni=4094)/Ether(dst="22:11:11:11:11:10")/IP(dst="19.168.1.1")/UDP()
>
>
> port 0/queue 0: received 1 packets
> src=04:3F:72:F3:7A:43 - dst=C8:0A:A9:04:49:1A - pool=mb_pool_0 - type=0x0800 - length=92 - nb_segs=1 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP - sw ptype: L2_ETHER L3_IPV4 L4_UDP TUNNEL_VXLAN INNER_L2_ETHER INNER_L3_IPV4 INNER_L4_UDP - l2_len=14 - l3_len=20 - l4_len=8 - tunnel_len=8 - inner_l2_len=30 - inner_l3_len=20 - inner_l4_len=8 - Destination UDP port=4789 - Receive queue=0x0
> ol_flags: RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN
>
> The length is 92 bytes which is correct but inner_l2_len=30 which is incorrect. According to standard, the following calculation is true of VXLAN header (50 bytes) and VXLAN packet size(92 bytes).
>
> 50-byte VXLAN header =(14-byte outer ethernet header + 20-byte outer IP header + 8-byte outer UDP header + 8-byte VXLAN header )
>
> 92-bytes VXLAN packet size= (14-byte outer Ethernet header + 20-byte outer IP header + 8-byte outer UDP header + 8-byte VXLAN header )+ (14-byte inner Ethernet header + 20-byte inner IP header + 8-byte inner UDP)
>
> This patch correct the inner_l2_len which is 14 bytes.
No, you're incorrectly assume that sum of all *_len fields should give
you a length of all packet headers. It is wrong assumption in accordance
with the definition of inner_l2_len which includes outer-l4-len (UDP),
tunnel header (VXLAN) and inner Ethernet header for the packet.
More information about the stable
mailing list