[PATCH] net: support VLAN stacking packet type parsing

Bruce Richardson bruce.richardson at intel.com
Tue Jul 8 12:16:26 CEST 2025


On Tue, Jul 08, 2025 at 12:00:42AM +0200, Morten Brørup wrote:
>    From: Vladimir Medvedkin [mailto:medvedkinv at gmail.com]
>    Sent: Monday, 7 July 2025 22.10
> 
> 
>    Hi Morten, all,
> 
> 
> 
>    пн, 7 июл. 2025 г. в 19:09, Morten Brørup
>    <[1]mb at smartsharesystems.com>:
> 
>      > From: Bruce Richardson [mailto:[2]bruce.richardson at intel.com]
>      > Sent: Friday, 4 July 2025 13.32
>      > Hi all,
>      >
>      > this email discussion comes at a bit of a fortunate time for me,
>      as I'm
>      > currently looking at our vlan tag/qinq stripping behaviour in our
>      Intel
>      > NIC
>      > drivers, and there is some discussion internally as to what our
>      driver
>      > behaviour should be compared to what it has historically been. :-)
>      >
>      > The documentation - both in the NIC guide [1] and the testpmd
>      guide [2]
>      > -
>      > is rather short on detail as to what exactly the behaviour should
>      be
>      > when
>      > vlan strip or qinq strip is implemented. Therefore, I'd hope that
>      those
>      > more familiar with networking than me would be able to help
>      clarify
>      > things
>      > so we can document the correct behaviour precisely - and hopefully
>      test
>      > our
>      > drivers against it in future!
>      >

<snipping full discussion for brevity>

So from the discussion, would the following be a good set of guidelines to
document for correct driver behaviour:

* VLAN-strip always strips one VLAN tag if available. If multiple VLAN tags
  are present, it strips the outer.
* QinQ strip, strips two VLAN tags if present. If only one tag is present it
  behaves as VLAN-strip.
* Specifying both VLAN-strip and QinQ strip is the same as QinQ strip alone (??)

Mbuf reporting behaviour:

Input Traffic		VLAN-strip on		QinQ strip on
--------------		-------------		-------------
Single VLAN pkts	Tag in mbuf->vlan_tci	Tag in mbuf->vlan_tci

Double VLAN pkts	Outer tag in vlan_tci	Outer tag in vlan_tci_outer
						Inner tag in vlan_tci 


Does the above seem reasonable and correct?

My one (minor)concern would be the handling and placement of the single tag
in the QinQ case. Depending on how the hardware treats a single tag in that
mode, the data path may have to pay a penalty if the HW takes a single VLAN
and places it in the "outer" position in the descriptor, since it needs to
go in the "inner" position in the mbuf, necessitating some conditional
logic.  AFAIK (subject to me actually testing for confirmation), this will
be the case for our Intel drivers.

/Bruce


More information about the dev mailing list