[PATCH dpdk v5 0/5] Fix and improve VLAN/MPLS parsing in rte_net_get_ptype
Stephen Hemminger
stephen at networkplumber.org
Tue Jun 2 22:45:16 CEST 2026
On Mon, 18 May 2026 15:27:14 +0200
Robin Jarry <rjarry at redhat.com> wrote:
> 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
>
In addition to the other comments, would like a release note for this.
Warning: rte_net_get_ptype() is a public stable API and this changes its
observable output (MPLS payload now resolves to L3 IPv4/IPv6 and falls
through to l3 instead of returning at the MPLS layer). No release-notes
entry accompanies the series. The VLAN misidentification fix (patch 1)
is a bug fix with Cc: stable, but the MPLS L3-detection change is a
behavior enhancement to an existing API and warrants a note in the
current release notes.
More information about the dev
mailing list