[PATCH dpdk v4] net: fix VLAN packet type
Kevin Traynor
ktraynor at redhat.com
Fri Apr 24 18:18:46 CEST 2026
On 4/23/26 12:24 PM, Robin Jarry wrote:
> Since commit 1f250674085a ("net: fix packet type for stacked VLAN"),
> rte_net_get_ptype() uses |= to set the L2 ptype inside the VLAN
> parsing loop. Since pkt_type is already initialized with
> RTE_PTYPE_L2_ETHER (0x1), or-ing it with RTE_PTYPE_L2_ETHER_VLAN
> (0x6) results in RTE_PTYPE_L2_ETHER_QINQ (0x7). This causes single
> VLAN frames to be misidentified as QinQ.
>
> This was detected while testing DPDK 25.11.1 in grout. The net/tap
> driver calls rte_net_get_ptype() in tap_verify_csum() to determine the
> L2 header length. With the wrong ptype, l2_len is set to 22 (ether
> + QinQ = 14 + 8) instead of 18 (ether + VLAN = 14 + 4), shifting the IP
> header pointer by 4 bytes. The checksum is then computed on garbage
> data, causing valid packets to be dropped.
>
> Set pkt_type to RTE_PTYPE_L2_ETHER_VLAN or RTE_PTYPE_L2_ETHER_QINQ only
> for the first level of "VLAN" tag seen. This avoids the bitwise-or
> conflict between the L2 ptype constants entirely.
>
> Add a new net_ptype_autotest unit test that verifies the ptype and
> header lengths (l2_len, l3_len, l4_len) returned by rte_net_get_ptype()
> for plain Ethernet, single VLAN, stacked VLAN (two 802.1Q tags), and
> QinQ (802.1ad + 802.1Q) frames, with both IPv4/IPv6 and UDP/TCP
> combinations.
>
> Fixes: 1f250674085a ("net: fix packet type for stacked VLAN")
> Cc: stable at dpdk.org
>
> Signed-off-by: Robin Jarry <rjarry at redhat.com>
> ---
>
Thanks Robin, LGTM.
Acked-by: Kevin Traynor <ktraynor at redhat.com>
More information about the stable
mailing list