[PATCH dpdk v5 0/5] Fix and improve VLAN/MPLS parsing in rte_net_get_ptype
Robin Jarry
rjarry at redhat.com
Mon May 18 15:27:14 CEST 2026
Revert commit 1f250674085a ("net: fix packet type for stacked VLAN")
which introduced a regression causing single VLAN frames to be
misidentified as QinQ due to incorrect use of |= on the ptype.
Replace the separate VLAN and QinQ code paths with a single loop
that handles arbitrarily stacked VLAN tags. Fix the MPLS path to
use the bottom of stack bit instead of a hardcoded label limit,
and parse the L3 protocol of the MPLS payload by inspecting the
first nibble.
Add unit tests for rte_net_get_ptype covering Ethernet, VLAN, QinQ,
MPLS, IPv4/IPv6, and truncated packet scenarios.
v5:
* Split the series in multiple patches.
* Revert the commit that introduced the bug.
* Add support for stacked VLAN/QINQ as suggested by David.
* Fix MPLS bottom of stack detection. Try to guess MPLS payload.
* Add more test cases.
v4:
* changed the approach again. Only set VLAN or QINQ ptype for the first
encountered vlan/qinq ether type.
* unit tests not changed
v3:
* changed the approach: initialize pkt_type=0 and only set it to
RTE_PTYPE_L2_ETHER if neither of VLAN nor QINQ matched.
* extended the unit tests to check for header lengths and added ipv6 / tcp
cases.
v2: added new ptype tests
v3:
* changed the approach: initialize pkt_type=0 and only set it to
RTE_PTYPE_L2_ETHER if neither of VLAN nor QINQ matched.
* extended the unit tests to check for header lengths and added ipv6 / tcp
cases.
v2: added new ptype tests
Robin Jarry (5):
Revert "net: fix packet type for stacked VLAN"
net: support multiple stacked VLAN tags
net: add unit tests for rte_net_get_ptype
net: parse L3 protocol after MPLS labels
net: add truncated packet tests for rte_net_get_ptype
app/test/meson.build | 1 +
app/test/test_net_ptype.c | 326 ++++++++++++++++++++++++++++++++++++++
lib/net/rte_net.c | 72 +++++----
3 files changed, 369 insertions(+), 30 deletions(-)
create mode 100644 app/test/test_net_ptype.c
--
2.54.0
More information about the dev
mailing list