* [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour
@ 2025-07-14 13:30 Bruce Richardson
2025-07-14 15:06 ` Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Bruce Richardson @ 2025-07-14 13:30 UTC (permalink / raw)
To: dev; +Cc: techboard, Bruce Richardson
The behaviour of VLAN tag stripping Rx offloads is unclear in DPDK, and
not very well documented. Even the documentation that does exist appears
contradictory.
For example, the doxygen docs for the mbuf flag
RTE_MBUF_F_RX_QINQ_STRIPPED says:
"If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
is unset, only the outer VLAN is removed from packet data,..."
but the docs for RTE_MBUF_F_RX_QINQ says:
"If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs
headers have been stripped from mbuf data, ..."
Without a good definition of what the correct behaviour is, it's not
possible to assess and ensure conformance across drivers. Update the
documentation for NIC features, ethdev and mbuf library to all report
the same information: that VLAN strip feature is stripping one flag, and
QinQ strip feature is removing two.
Summary of VLAN and QinQ stripping behaviour as reported in docs after
this patch:
+-------------------+----------------------+----------------------------+
| Input Traffic | VLAN-strip on | QinQ strip on |
+===================+======================+============================+
| Single VLAN pkts | Tag in vlan_tci | Tag in vlan_tci |
+-------------------+----------------------+----------------------------+
| Double VLAN pkts | Outer tag in vlan_tci| Outer tag in vlan_tci_outer|
| | | Inner tag in vlan_tci |
+-------------------+----------------------+----------------------------+
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
doc/guides/nics/features.rst | 21 +++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++
lib/mbuf/rte_mbuf_core.h | 36 ++++++++++++++++++++----------------
3 files changed, 61 insertions(+), 16 deletions(-)
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index a075c057ec..c57ea8e08f 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -483,6 +483,11 @@ VLAN offload
------------
Supports VLAN offload to hardware.
+This includes both VLAN stripping on Rx and VLAN insertion on Tx.
+
+On Rx VLAN strip always strips one VLAN tag if available.
+If multiple VLAN tags are present, it strips the outer tag.
+The stripped VLAN TCI is saved in mbuf->vlan_tci.
* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_VLAN_STRIP,RTE_ETH_RX_OFFLOAD_VLAN_FILTER,RTE_ETH_RX_OFFLOAD_VLAN_EXTEND``.
* **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:RTE_ETH_TX_OFFLOAD_VLAN_INSERT``.
@@ -501,6 +506,22 @@ QinQ offload
------------
Supports QinQ (queue in queue) offload.
+This includes both QinQ stripping on Rx and QinQ insertion on Tx.
+
+On Rx, 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 equivalent to QinQ strip alone.
+
+Summary of VLAN and QinQ stripping behavior:
+
++----------------------+----------------------+------------------------------+
+| Input Traffic | VLAN-strip on | QinQ strip on |
++======================+======================+==============================+
+| Single VLAN packets | Tag in vlan_tci | Tag in vlan_tci |
++----------------------+----------------------+------------------------------+
+| Double VLAN packets | Outer tag in vlan_tci| Outer tag in vlan_tci_outer |
+| | | Inner tag in vlan_tci |
++----------------------+----------------------+------------------------------+
* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_QINQ_STRIP``.
* **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:RTE_ETH_TX_OFFLOAD_QINQ_INSERT``.
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index f9fb6ae549..ccf0cf5e30 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -1552,11 +1552,31 @@ struct rte_eth_conf {
/**
* Rx offload capabilities of a device.
*/
+/**
+ * VLAN strip offload.
+ *
+ * When enabled, strips one VLAN tag if available.
+ * If multiple VLAN tags are present, it strips the outer tag.
+ * The stripped VLAN TCI is saved in mbuf->vlan_tci and RTE_MBUF_F_RX_VLAN_STRIPPED flag is set.
+ */
#define RTE_ETH_RX_OFFLOAD_VLAN_STRIP RTE_BIT64(0)
#define RTE_ETH_RX_OFFLOAD_IPV4_CKSUM RTE_BIT64(1)
#define RTE_ETH_RX_OFFLOAD_UDP_CKSUM RTE_BIT64(2)
#define RTE_ETH_RX_OFFLOAD_TCP_CKSUM RTE_BIT64(3)
#define RTE_ETH_RX_OFFLOAD_TCP_LRO RTE_BIT64(4)
+/**
+ * QinQ strip offload.
+ *
+ * When enabled, strips two VLAN tags if present.
+ * If only one tag is present, it behaves as VLAN strip.
+ * The stripped VLAN TCIs are saved in mbuf fields and appropriate RTE_MBUF_F_RX_* flags are set.
+ *
+ * For single VLAN packets: Tag is saved in mbuf->vlan_tci (same as VLAN strip)
+ * For double VLAN packets: Outer tag is saved in mbuf->vlan_tci_outer,
+ * Inner tag is saved in mbuf->vlan_tci
+ *
+ * Note: Specifying both VLAN strip and QinQ strip is equivalent to QinQ strip alone.
+ */
#define RTE_ETH_RX_OFFLOAD_QINQ_STRIP RTE_BIT64(5)
#define RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM RTE_BIT64(6)
#define RTE_ETH_RX_OFFLOAD_MACSEC_STRIP RTE_BIT64(7)
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index a0df265b5d..23aed8ec69 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -63,10 +63,17 @@ extern "C" {
#define RTE_MBUF_F_RX_OUTER_IP_CKSUM_BAD (1ULL << 5)
/**
- * A vlan has been stripped by the hardware and its tci is saved in
- * mbuf->vlan_tci. This can only happen if vlan stripping is enabled
- * in the RX configuration of the PMD.
- * When RTE_MBUF_F_RX_VLAN_STRIPPED is set, RTE_MBUF_F_RX_VLAN must also be set.
+ * A vlan has been stripped by the hardware and its tci is saved in mbuf->vlan_tci.
+ * This can only happen if vlan or QinQ stripping is enabled in the RX configuration of the PMD.
+ *
+ * NOTE:
+ * - If VLAN stripping is enabled, but not QinQ, the tag stripped will be the outer
+ * VLAN tag of a QinQ packet.
+ * - If QinQ stripping is enabled, then the outer VLAN tag is stripped and saved in
+ * mbuf->vlan_tci_outer (indicated by the presence of flag @ref RTE_MBUF_F_RX_QINQ_STRIPPED),
+ * while the inner VLAN tag is stripped and saved in mbuf->vlan_tci.
+ *
+ * When @ref RTE_MBUF_F_RX_VLAN_STRIPPED is set, @ref RTE_MBUF_F_RX_VLAN must also be set.
*/
#define RTE_MBUF_F_RX_VLAN_STRIPPED (1ULL << 6)
@@ -113,19 +120,16 @@ extern "C" {
#define RTE_MBUF_F_RX_FDIR_FLX (1ULL << 14)
/**
- * The outer VLAN has been stripped by the hardware and its TCI is
- * saved in mbuf->vlan_tci_outer.
- * This can only happen if VLAN stripping is enabled in the Rx
- * configuration of the PMD.
- * When RTE_MBUF_F_RX_QINQ_STRIPPED is set, the flags RTE_MBUF_F_RX_VLAN
- * and RTE_MBUF_F_RX_QINQ must also be set.
+ * Two VLANs have been stripped from the packet by hardware and are
+ * reported in the vlan_tci and vlan_tci_outer fields.
+ *
+ * When this flag is set:
+ * - The outer VLAN has been stripped by the hardware and it is saved in mbuf->vlan_tci_outer.
+ * - The inner VLAN has also been stripped by the hardware and it is saved in mbuf->vlan_tci.
*
- * - If both RTE_MBUF_F_RX_QINQ_STRIPPED and RTE_MBUF_F_RX_VLAN_STRIPPED are
- * set, the 2 VLANs have been stripped by the hardware and their TCIs are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
- * - If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
- * is unset, only the outer VLAN is removed from packet data, but both tci
- * are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * When @ref RTE_MBUF_F_RX_QINQ_STRIPPED is set, the flags @ref RTE_MBUF_F_RX_VLAN,
+ * @ref RTE_MBUF_F_RX_VLAN_STRIPPED,
+ * and @ref RTE_MBUF_F_RX_QINQ must also be set.
*/
#define RTE_MBUF_F_RX_QINQ_STRIPPED (1ULL << 15)
--
2.48.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour
2025-07-14 13:30 [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour Bruce Richardson
@ 2025-07-14 15:06 ` Stephen Hemminger
2025-07-14 15:11 ` Bruce Richardson
2025-07-14 16:33 ` Morten Brørup
2025-07-14 20:09 ` Dean Marx
2 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2025-07-14 15:06 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, techboard
On Mon, 14 Jul 2025 14:30:14 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> The behaviour of VLAN tag stripping Rx offloads is unclear in DPDK, and
> not very well documented. Even the documentation that does exist appears
> contradictory.
>
> For example, the doxygen docs for the mbuf flag
> RTE_MBUF_F_RX_QINQ_STRIPPED says:
>
> "If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> is unset, only the outer VLAN is removed from packet data,..."
>
> but the docs for RTE_MBUF_F_RX_QINQ says:
>
> "If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs
> headers have been stripped from mbuf data, ..."
>
> Without a good definition of what the correct behaviour is, it's not
> possible to assess and ensure conformance across drivers. Update the
> documentation for NIC features, ethdev and mbuf library to all report
> the same information: that VLAN strip feature is stripping one flag, and
> QinQ strip feature is removing two.
>
> Summary of VLAN and QinQ stripping behaviour as reported in docs after
> this patch:
>
> +-------------------+----------------------+----------------------------+
> | Input Traffic | VLAN-strip on | QinQ strip on |
> +===================+======================+============================+
> | Single VLAN pkts | Tag in vlan_tci | Tag in vlan_tci |
> +-------------------+----------------------+----------------------------+
> | Double VLAN pkts | Outer tag in vlan_tci| Outer tag in vlan_tci_outer|
> | | | Inner tag in vlan_tci |
> +-------------------+----------------------+----------------------------+
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> doc/guides/nics/features.rst | 21 +++++++++++++++++++++
> lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++
> lib/mbuf/rte_mbuf_core.h | 36 ++++++++++++++++++++----------------
> 3 files changed, 61 insertions(+), 16 deletions(-)
>
> diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> index a075c057ec..c57ea8e08f 100644
> --- a/doc/guides/nics/features.rst
> +++ b/doc/guides/nics/features.rst
> @@ -483,6 +483,11 @@ VLAN offload
> ------------
>
> Supports VLAN offload to hardware.
> +This includes both VLAN stripping on Rx and VLAN insertion on Tx.
> +
> +On Rx VLAN strip always strips one VLAN tag if available.
> +If multiple VLAN tags are present, it strips the outer tag.
> +The stripped VLAN TCI is saved in mbuf->vlan_tci.
>
> * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_VLAN_STRIP,RTE_ETH_RX_OFFLOAD_VLAN_FILTER,RTE_ETH_RX_OFFLOAD_VLAN_EXTEND``.
> * **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:RTE_ETH_TX_OFFLOAD_VLAN_INSERT``.
> @@ -501,6 +506,22 @@ QinQ offload
> ------------
>
> Supports QinQ (queue in queue) offload.
> +This includes both QinQ stripping on Rx and QinQ insertion on Tx.
> +
> +On Rx, 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 equivalent to QinQ strip alone.
> +
> +Summary of VLAN and QinQ stripping behavior:
> +
> ++----------------------+----------------------+------------------------------+
> +| Input Traffic | VLAN-strip on | QinQ strip on |
> ++======================+======================+==============================+
> +| Single VLAN packets | Tag in vlan_tci | Tag in vlan_tci |
> ++----------------------+----------------------+------------------------------+
> +| Double VLAN packets | Outer tag in vlan_tci| Outer tag in vlan_tci_outer |
> +| | | Inner tag in vlan_tci |
> ++----------------------+----------------------+------------------------------+
>
> * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_QINQ_STRIP``.
> * **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:RTE_ETH_TX_OFFLOAD_QINQ_INSERT``.
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index f9fb6ae549..ccf0cf5e30 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -1552,11 +1552,31 @@ struct rte_eth_conf {
> /**
> * Rx offload capabilities of a device.
> */
> +/**
> + * VLAN strip offload.
> + *
> + * When enabled, strips one VLAN tag if available.
> + * If multiple VLAN tags are present, it strips the outer tag.
> + * The stripped VLAN TCI is saved in mbuf->vlan_tci and RTE_MBUF_F_RX_VLAN_STRIPPED flag is set.
> + */
> #define RTE_ETH_RX_OFFLOAD_VLAN_STRIP RTE_BIT64(0)
> #define RTE_ETH_RX_OFFLOAD_IPV4_CKSUM RTE_BIT64(1)
> #define RTE_ETH_RX_OFFLOAD_UDP_CKSUM RTE_BIT64(2)
> #define RTE_ETH_RX_OFFLOAD_TCP_CKSUM RTE_BIT64(3)
> #define RTE_ETH_RX_OFFLOAD_TCP_LRO RTE_BIT64(4)
> +/**
> + * QinQ strip offload.
> + *
> + * When enabled, strips two VLAN tags if present.
> + * If only one tag is present, it behaves as VLAN strip.
> + * The stripped VLAN TCIs are saved in mbuf fields and appropriate RTE_MBUF_F_RX_* flags are set.
> + *
> + * For single VLAN packets: Tag is saved in mbuf->vlan_tci (same as VLAN strip)
> + * For double VLAN packets: Outer tag is saved in mbuf->vlan_tci_outer,
> + * Inner tag is saved in mbuf->vlan_tci
> + *
> + * Note: Specifying both VLAN strip and QinQ strip is equivalent to QinQ strip alone.
> + */
> #define RTE_ETH_RX_OFFLOAD_QINQ_STRIP RTE_BIT64(5)
> #define RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM RTE_BIT64(6)
> #define RTE_ETH_RX_OFFLOAD_MACSEC_STRIP RTE_BIT64(7)
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index a0df265b5d..23aed8ec69 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -63,10 +63,17 @@ extern "C" {
> #define RTE_MBUF_F_RX_OUTER_IP_CKSUM_BAD (1ULL << 5)
>
> /**
> - * A vlan has been stripped by the hardware and its tci is saved in
> - * mbuf->vlan_tci. This can only happen if vlan stripping is enabled
> - * in the RX configuration of the PMD.
> - * When RTE_MBUF_F_RX_VLAN_STRIPPED is set, RTE_MBUF_F_RX_VLAN must also be set.
> + * A vlan has been stripped by the hardware and its tci is saved in mbuf->vlan_tci.
> + * This can only happen if vlan or QinQ stripping is enabled in the RX configuration of the PMD.
> + *
> + * NOTE:
> + * - If VLAN stripping is enabled, but not QinQ, the tag stripped will be the outer
> + * VLAN tag of a QinQ packet.
> + * - If QinQ stripping is enabled, then the outer VLAN tag is stripped and saved in
> + * mbuf->vlan_tci_outer (indicated by the presence of flag @ref RTE_MBUF_F_RX_QINQ_STRIPPED),
> + * while the inner VLAN tag is stripped and saved in mbuf->vlan_tci.
> + *
> + * When @ref RTE_MBUF_F_RX_VLAN_STRIPPED is set, @ref RTE_MBUF_F_RX_VLAN must also be set.
> */
> #define RTE_MBUF_F_RX_VLAN_STRIPPED (1ULL << 6)
>
> @@ -113,19 +120,16 @@ extern "C" {
> #define RTE_MBUF_F_RX_FDIR_FLX (1ULL << 14)
>
> /**
> - * The outer VLAN has been stripped by the hardware and its TCI is
> - * saved in mbuf->vlan_tci_outer.
> - * This can only happen if VLAN stripping is enabled in the Rx
> - * configuration of the PMD.
> - * When RTE_MBUF_F_RX_QINQ_STRIPPED is set, the flags RTE_MBUF_F_RX_VLAN
> - * and RTE_MBUF_F_RX_QINQ must also be set.
> + * Two VLANs have been stripped from the packet by hardware and are
> + * reported in the vlan_tci and vlan_tci_outer fields.
> + *
> + * When this flag is set:
> + * - The outer VLAN has been stripped by the hardware and it is saved in mbuf->vlan_tci_outer.
> + * - The inner VLAN has also been stripped by the hardware and it is saved in mbuf->vlan_tci.
> *
> - * - If both RTE_MBUF_F_RX_QINQ_STRIPPED and RTE_MBUF_F_RX_VLAN_STRIPPED are
> - * set, the 2 VLANs have been stripped by the hardware and their TCIs are
> - * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
> - * - If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> - * is unset, only the outer VLAN is removed from packet data, but both tci
> - * are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
> + * When @ref RTE_MBUF_F_RX_QINQ_STRIPPED is set, the flags @ref RTE_MBUF_F_RX_VLAN,
> + * @ref RTE_MBUF_F_RX_VLAN_STRIPPED,
> + * and @ref RTE_MBUF_F_RX_QINQ must also be set.
> */
> #define RTE_MBUF_F_RX_QINQ_STRIPPED (1ULL << 15)
>
Since QINQ strip without VLAN strip would be undefined, it should be blocked
at ethdev layer. Something like:
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index dd7c00bc94..0d51c7cf82 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -4542,6 +4542,18 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
if (mask == 0)
return ret;
+ /*
+ * QinQ offloading dtoes no make sense without also stripping
+ * outer tag.
+ */
+ if ((dev_offloads & RTE_ETH_QINQ_STRIP_OFFLOAD) &&
+ !(dev_offloads & RTE_ETH_VLAN_STRIP_OFFLOAD)) {
+ RTE_ETHDEV_LOG_LINE(ERR,
+ "Ethdev port_id=%u requested QinQ strip without VLAN strip",
+ port_id);
+ return -EINVAL;
+ }
+
ret = rte_eth_dev_info_get(port_id, &dev_info);
if (ret != 0)
return ret;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour
2025-07-14 15:06 ` Stephen Hemminger
@ 2025-07-14 15:11 ` Bruce Richardson
0 siblings, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2025-07-14 15:11 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, techboard
On Mon, Jul 14, 2025 at 08:06:54AM -0700, Stephen Hemminger wrote:
> On Mon, 14 Jul 2025 14:30:14 +0100
> Bruce Richardson <bruce.richardson@intel.com> wrote:
>
> > The behaviour of VLAN tag stripping Rx offloads is unclear in DPDK, and
> > not very well documented. Even the documentation that does exist appears
> > contradictory.
> >
> > For example, the doxygen docs for the mbuf flag
> > RTE_MBUF_F_RX_QINQ_STRIPPED says:
> >
> > "If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> > is unset, only the outer VLAN is removed from packet data,..."
> >
> > but the docs for RTE_MBUF_F_RX_QINQ says:
> >
> > "If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs
> > headers have been stripped from mbuf data, ..."
> >
> > Without a good definition of what the correct behaviour is, it's not
> > possible to assess and ensure conformance across drivers. Update the
> > documentation for NIC features, ethdev and mbuf library to all report
> > the same information: that VLAN strip feature is stripping one flag, and
> > QinQ strip feature is removing two.
> >
> > Summary of VLAN and QinQ stripping behaviour as reported in docs after
> > this patch:
> >
> > +-------------------+----------------------+----------------------------+
> > | Input Traffic | VLAN-strip on | QinQ strip on |
> > +===================+======================+============================+
> > | Single VLAN pkts | Tag in vlan_tci | Tag in vlan_tci |
> > +-------------------+----------------------+----------------------------+
> > | Double VLAN pkts | Outer tag in vlan_tci| Outer tag in vlan_tci_outer|
> > | | | Inner tag in vlan_tci |
> > +-------------------+----------------------+----------------------------+
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> > doc/guides/nics/features.rst | 21 +++++++++++++++++++++
> > lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++
> > lib/mbuf/rte_mbuf_core.h | 36 ++++++++++++++++++++----------------
> > 3 files changed, 61 insertions(+), 16 deletions(-)
> >
> > diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> > index a075c057ec..c57ea8e08f 100644
> > --- a/doc/guides/nics/features.rst
> > +++ b/doc/guides/nics/features.rst
> > @@ -483,6 +483,11 @@ VLAN offload
> > ------------
> >
> > Supports VLAN offload to hardware.
> > +This includes both VLAN stripping on Rx and VLAN insertion on Tx.
> > +
> > +On Rx VLAN strip always strips one VLAN tag if available.
> > +If multiple VLAN tags are present, it strips the outer tag.
> > +The stripped VLAN TCI is saved in mbuf->vlan_tci.
> >
> > * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_VLAN_STRIP,RTE_ETH_RX_OFFLOAD_VLAN_FILTER,RTE_ETH_RX_OFFLOAD_VLAN_EXTEND``.
> > * **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:RTE_ETH_TX_OFFLOAD_VLAN_INSERT``.
> > @@ -501,6 +506,22 @@ QinQ offload
> > ------------
> >
> > Supports QinQ (queue in queue) offload.
> > +This includes both QinQ stripping on Rx and QinQ insertion on Tx.
> > +
> > +On Rx, 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 equivalent to QinQ strip alone.
> > +
> > +Summary of VLAN and QinQ stripping behavior:
> > +
> > ++----------------------+----------------------+------------------------------+
> > +| Input Traffic | VLAN-strip on | QinQ strip on |
> > ++======================+======================+==============================+
> > +| Single VLAN packets | Tag in vlan_tci | Tag in vlan_tci |
> > ++----------------------+----------------------+------------------------------+
> > +| Double VLAN packets | Outer tag in vlan_tci| Outer tag in vlan_tci_outer |
> > +| | | Inner tag in vlan_tci |
> > ++----------------------+----------------------+------------------------------+
> >
> > * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_QINQ_STRIP``.
> > * **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:RTE_ETH_TX_OFFLOAD_QINQ_INSERT``.
> > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> > index f9fb6ae549..ccf0cf5e30 100644
> > --- a/lib/ethdev/rte_ethdev.h
> > +++ b/lib/ethdev/rte_ethdev.h
> > @@ -1552,11 +1552,31 @@ struct rte_eth_conf {
> > /**
> > * Rx offload capabilities of a device.
> > */
> > +/**
> > + * VLAN strip offload.
> > + *
> > + * When enabled, strips one VLAN tag if available.
> > + * If multiple VLAN tags are present, it strips the outer tag.
> > + * The stripped VLAN TCI is saved in mbuf->vlan_tci and RTE_MBUF_F_RX_VLAN_STRIPPED flag is set.
> > + */
> > #define RTE_ETH_RX_OFFLOAD_VLAN_STRIP RTE_BIT64(0)
> > #define RTE_ETH_RX_OFFLOAD_IPV4_CKSUM RTE_BIT64(1)
> > #define RTE_ETH_RX_OFFLOAD_UDP_CKSUM RTE_BIT64(2)
> > #define RTE_ETH_RX_OFFLOAD_TCP_CKSUM RTE_BIT64(3)
> > #define RTE_ETH_RX_OFFLOAD_TCP_LRO RTE_BIT64(4)
> > +/**
> > + * QinQ strip offload.
> > + *
> > + * When enabled, strips two VLAN tags if present.
> > + * If only one tag is present, it behaves as VLAN strip.
> > + * The stripped VLAN TCIs are saved in mbuf fields and appropriate RTE_MBUF_F_RX_* flags are set.
> > + *
> > + * For single VLAN packets: Tag is saved in mbuf->vlan_tci (same as VLAN strip)
> > + * For double VLAN packets: Outer tag is saved in mbuf->vlan_tci_outer,
> > + * Inner tag is saved in mbuf->vlan_tci
> > + *
> > + * Note: Specifying both VLAN strip and QinQ strip is equivalent to QinQ strip alone.
> > + */
> > #define RTE_ETH_RX_OFFLOAD_QINQ_STRIP RTE_BIT64(5)
> > #define RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM RTE_BIT64(6)
> > #define RTE_ETH_RX_OFFLOAD_MACSEC_STRIP RTE_BIT64(7)
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index a0df265b5d..23aed8ec69 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -63,10 +63,17 @@ extern "C" {
> > #define RTE_MBUF_F_RX_OUTER_IP_CKSUM_BAD (1ULL << 5)
> >
> > /**
> > - * A vlan has been stripped by the hardware and its tci is saved in
> > - * mbuf->vlan_tci. This can only happen if vlan stripping is enabled
> > - * in the RX configuration of the PMD.
> > - * When RTE_MBUF_F_RX_VLAN_STRIPPED is set, RTE_MBUF_F_RX_VLAN must also be set.
> > + * A vlan has been stripped by the hardware and its tci is saved in mbuf->vlan_tci.
> > + * This can only happen if vlan or QinQ stripping is enabled in the RX configuration of the PMD.
> > + *
> > + * NOTE:
> > + * - If VLAN stripping is enabled, but not QinQ, the tag stripped will be the outer
> > + * VLAN tag of a QinQ packet.
> > + * - If QinQ stripping is enabled, then the outer VLAN tag is stripped and saved in
> > + * mbuf->vlan_tci_outer (indicated by the presence of flag @ref RTE_MBUF_F_RX_QINQ_STRIPPED),
> > + * while the inner VLAN tag is stripped and saved in mbuf->vlan_tci.
> > + *
> > + * When @ref RTE_MBUF_F_RX_VLAN_STRIPPED is set, @ref RTE_MBUF_F_RX_VLAN must also be set.
> > */
> > #define RTE_MBUF_F_RX_VLAN_STRIPPED (1ULL << 6)
> >
> > @@ -113,19 +120,16 @@ extern "C" {
> > #define RTE_MBUF_F_RX_FDIR_FLX (1ULL << 14)
> >
> > /**
> > - * The outer VLAN has been stripped by the hardware and its TCI is
> > - * saved in mbuf->vlan_tci_outer.
> > - * This can only happen if VLAN stripping is enabled in the Rx
> > - * configuration of the PMD.
> > - * When RTE_MBUF_F_RX_QINQ_STRIPPED is set, the flags RTE_MBUF_F_RX_VLAN
> > - * and RTE_MBUF_F_RX_QINQ must also be set.
> > + * Two VLANs have been stripped from the packet by hardware and are
> > + * reported in the vlan_tci and vlan_tci_outer fields.
> > + *
> > + * When this flag is set:
> > + * - The outer VLAN has been stripped by the hardware and it is saved in mbuf->vlan_tci_outer.
> > + * - The inner VLAN has also been stripped by the hardware and it is saved in mbuf->vlan_tci.
> > *
> > - * - If both RTE_MBUF_F_RX_QINQ_STRIPPED and RTE_MBUF_F_RX_VLAN_STRIPPED are
> > - * set, the 2 VLANs have been stripped by the hardware and their TCIs are
> > - * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
> > - * - If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> > - * is unset, only the outer VLAN is removed from packet data, but both tci
> > - * are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
> > + * When @ref RTE_MBUF_F_RX_QINQ_STRIPPED is set, the flags @ref RTE_MBUF_F_RX_VLAN,
> > + * @ref RTE_MBUF_F_RX_VLAN_STRIPPED,
> > + * and @ref RTE_MBUF_F_RX_QINQ must also be set.
> > */
> > #define RTE_MBUF_F_RX_QINQ_STRIPPED (1ULL << 15)
> >
>
> Since QINQ strip without VLAN strip would be undefined, it should be blocked
> at ethdev layer. Something like:
>
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index dd7c00bc94..0d51c7cf82 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -4542,6 +4542,18 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
> if (mask == 0)
> return ret;
>
> + /*
> + * QinQ offloading dtoes no make sense without also stripping
> + * outer tag.
> + */
> + if ((dev_offloads & RTE_ETH_QINQ_STRIP_OFFLOAD) &&
> + !(dev_offloads & RTE_ETH_VLAN_STRIP_OFFLOAD)) {
> + RTE_ETHDEV_LOG_LINE(ERR,
> + "Ethdev port_id=%u requested QinQ strip without VLAN strip",
> + port_id);
> + return -EINVAL;
> + }
> +
> ret = rte_eth_dev_info_get(port_id, &dev_info);
> if (ret != 0)
> return ret;
Ok, that seems reasonable enough to enforce.
/Bruce
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour
2025-07-14 13:30 [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour Bruce Richardson
2025-07-14 15:06 ` Stephen Hemminger
@ 2025-07-14 16:33 ` Morten Brørup
2025-07-14 16:49 ` Bruce Richardson
2025-07-14 20:09 ` Dean Marx
2 siblings, 1 reply; 7+ messages in thread
From: Morten Brørup @ 2025-07-14 16:33 UTC (permalink / raw)
To: Bruce Richardson, dev, Dengdui Huang, Vladimir Medvedkin; +Cc: techboard
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Monday, 14 July 2025 15.30
>
> The behaviour of VLAN tag stripping Rx offloads is unclear in DPDK, and
> not very well documented. Even the documentation that does exist appears
> contradictory.
>
> For example, the doxygen docs for the mbuf flag
> RTE_MBUF_F_RX_QINQ_STRIPPED says:
>
> "If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> is unset, only the outer VLAN is removed from packet data,..."
>
> but the docs for RTE_MBUF_F_RX_QINQ says:
>
> "If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs
> headers have been stripped from mbuf data, ..."
>
> Without a good definition of what the correct behaviour is, it's not
> possible to assess and ensure conformance across drivers. Update the
> documentation for NIC features, ethdev and mbuf library to all report
> the same information: that VLAN strip feature is stripping one flag, and
> QinQ strip feature is removing two.
>
> Summary of VLAN and QinQ stripping behaviour as reported in docs after
> this patch:
>
> +-------------------+----------------------+----------------------------
> +
> | Input Traffic | VLAN-strip on | QinQ strip on
> |
> +===================+======================+============================
> +
> | Single VLAN pkts | Tag in vlan_tci | Tag in vlan_tci
> |
> +-------------------+----------------------+----------------------------
> +
> | Double VLAN pkts | Outer tag in vlan_tci| Outer tag in
> vlan_tci_outer|
> | | | Inner tag in vlan_tci
> |
> +-------------------+----------------------+----------------------------
> +
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
I think your RFC is not a description of originally intended behavior.
However, I think your last thought in the previous discussion, speculating about the original intention, was correct:
The QINQ flag and the VLAN flag are completely independent.
The QINQ flag refers to EtherType 0x88a8 (QinQ) tags, and vlan_tci_outer holds the ID of such a tag.
It can be the outer tag of a double-tagged packet (i.e. the S-TAG of a packet with a C-TAG (C-TAG = Customer's VLAN tag)), or
the only tag of a single EtherType 0x88a8 tagged packet (i.e. the S-TAG of a customer packet with no VLAN tag).
The VLAN flag refers to EtherType 0x8100 (VLAN) tags, and vlan_tci holds the ID of such a tag.
It can be the only tag of a single EtherType 0x8100 tagged packet (i.e. a normal VLAN tag), or
the inner tag (i.e. the C-TAG) of a double-tagged packet with an outer EtherType 0x88a8 tag (the S-TAG).
On RX, RTE_MBUF_F_RX_QINQ (and vlan_tci_outer) should be set if the packet has an EtherType 0x88a8 tag (as the only tag, or as the outer tag).
If it was stripped, RTE_MBUF_F_RX_QINQ_STRIPPED should also be set.
Similarly on RX, RTE_MBUF_F_RX_VLAN (and vlan_tci) should be set if the packet has an EtherType 0x8100 tag (as the only tag, or after the QinQ tag).
If it was stripped, RTE_MBUF_F_RX_VLAN_STRIPPED should also be set.
Same goes for TX: If RTE_MBUF_F_TX_VLAN_INSERT is set, an EtherType 0x8100 tag should be inserted with the ID coming from vlan_tci.
Similarly for TX, if RTE_MBUF_F_TX_QINQ_INSERT is set, an EtherType 0x88a8 tag should be inserted with the ID coming from vlan_tci_outer.
Any HW inserted tags are inserted as the outermost tag, i.e. after the MAC addresses in the Ethernet header.
And the VLAN tag insertion (if any) happens before the QinQ tag insertion (if any).
Note:
With this behavior, VLAN Stacking (i.e. double-tagged packets using EtherType 0x8100 for both inner and outer tag) can only be partially hardware offloaded.
On RX, HW VLAN stripping will strip the outer VLAN tag to vlan_tci, and the application must move vlan_tci to vlan_tci_outer and manually strip the inner VLAN tag to vlan_tci.
On TX, the application must manually insert the inner tag from vlan_tci, and move vlan_tci_outer to vlan_tci, and HW VLAN insertion will insert the outer VLAN tag from vlan_tci.
Support for VLAN Stacking would be nice, but it should be added as a new feature, not through a doc update.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour
2025-07-14 16:33 ` Morten Brørup
@ 2025-07-14 16:49 ` Bruce Richardson
0 siblings, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2025-07-14 16:49 UTC (permalink / raw)
To: Morten Brørup; +Cc: dev, Dengdui Huang, Vladimir Medvedkin, techboard
On Mon, Jul 14, 2025 at 06:33:43PM +0200, Morten Brørup wrote:
> > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > Sent: Monday, 14 July 2025 15.30
> >
> > The behaviour of VLAN tag stripping Rx offloads is unclear in DPDK, and
> > not very well documented. Even the documentation that does exist appears
> > contradictory.
> >
> > For example, the doxygen docs for the mbuf flag
> > RTE_MBUF_F_RX_QINQ_STRIPPED says:
> >
> > "If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> > is unset, only the outer VLAN is removed from packet data,..."
> >
> > but the docs for RTE_MBUF_F_RX_QINQ says:
> >
> > "If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs
> > headers have been stripped from mbuf data, ..."
> >
> > Without a good definition of what the correct behaviour is, it's not
> > possible to assess and ensure conformance across drivers. Update the
> > documentation for NIC features, ethdev and mbuf library to all report
> > the same information: that VLAN strip feature is stripping one flag, and
> > QinQ strip feature is removing two.
> >
> > Summary of VLAN and QinQ stripping behaviour as reported in docs after
> > this patch:
> >
> > +-------------------+----------------------+----------------------------
> > +
> > | Input Traffic | VLAN-strip on | QinQ strip on
> > |
> > +===================+======================+============================
> > +
> > | Single VLAN pkts | Tag in vlan_tci | Tag in vlan_tci
> > |
> > +-------------------+----------------------+----------------------------
> > +
> > | Double VLAN pkts | Outer tag in vlan_tci| Outer tag in
> > vlan_tci_outer|
> > | | | Inner tag in vlan_tci
> > |
> > +-------------------+----------------------+----------------------------
> > +
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
>
> I think your RFC is not a description of originally intended behavior.
> However, I think your last thought in the previous discussion, speculating about the original intention, was correct:
>
> The QINQ flag and the VLAN flag are completely independent.
>
> The QINQ flag refers to EtherType 0x88a8 (QinQ) tags, and vlan_tci_outer holds the ID of such a tag.
> It can be the outer tag of a double-tagged packet (i.e. the S-TAG of a packet with a C-TAG (C-TAG = Customer's VLAN tag)), or
> the only tag of a single EtherType 0x88a8 tagged packet (i.e. the S-TAG of a customer packet with no VLAN tag).
>
> The VLAN flag refers to EtherType 0x8100 (VLAN) tags, and vlan_tci holds the ID of such a tag.
> It can be the only tag of a single EtherType 0x8100 tagged packet (i.e. a normal VLAN tag), or
> the inner tag (i.e. the C-TAG) of a double-tagged packet with an outer EtherType 0x88a8 tag (the S-TAG).
>
> On RX, RTE_MBUF_F_RX_QINQ (and vlan_tci_outer) should be set if the packet has an EtherType 0x88a8 tag (as the only tag, or as the outer tag).
> If it was stripped, RTE_MBUF_F_RX_QINQ_STRIPPED should also be set.
> Similarly on RX, RTE_MBUF_F_RX_VLAN (and vlan_tci) should be set if the packet has an EtherType 0x8100 tag (as the only tag, or after the QinQ tag).
> If it was stripped, RTE_MBUF_F_RX_VLAN_STRIPPED should also be set.
>
> Same goes for TX: If RTE_MBUF_F_TX_VLAN_INSERT is set, an EtherType 0x8100 tag should be inserted with the ID coming from vlan_tci.
> Similarly for TX, if RTE_MBUF_F_TX_QINQ_INSERT is set, an EtherType 0x88a8 tag should be inserted with the ID coming from vlan_tci_outer.
> Any HW inserted tags are inserted as the outermost tag, i.e. after the MAC addresses in the Ethernet header.
> And the VLAN tag insertion (if any) happens before the QinQ tag insertion (if any).
>
> Note:
> With this behavior, VLAN Stacking (i.e. double-tagged packets using EtherType 0x8100 for both inner and outer tag) can only be partially hardware offloaded.
> On RX, HW VLAN stripping will strip the outer VLAN tag to vlan_tci, and the application must move vlan_tci to vlan_tci_outer and manually strip the inner VLAN tag to vlan_tci.
> On TX, the application must manually insert the inner tag from vlan_tci, and move vlan_tci_outer to vlan_tci, and HW VLAN insertion will insert the outer VLAN tag from vlan_tci.
>
>
> Support for VLAN Stacking would be nice, but it should be added as a new feature, not through a doc update.
>
Yes, I suspect that some of that was the original intention, but I also
suspect it may not have been tied to tag ids. The documentation I
quoted earlier on the QinQ (non-strip) mbuf flag suggests the alternate
way of working as described above - which further confuses things.
However, the main concern for me now is what way to current drivers
actually implement this.
From chatting to Patrick on slack, it looks like the IOL is currently
working on testing the VLAN and QinQ features, so hopefully we will have
some idea shortly. To avoid major breakage, I would rather standardize on
what we currently have implemented, rather than shooting for an
"original idea" or a "best case" implementation.
/Bruce
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour
2025-07-14 13:30 [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour Bruce Richardson
2025-07-14 15:06 ` Stephen Hemminger
2025-07-14 16:33 ` Morten Brørup
@ 2025-07-14 20:09 ` Dean Marx
2025-07-14 21:41 ` Patrick Robb
2 siblings, 1 reply; 7+ messages in thread
From: Dean Marx @ 2025-07-14 20:09 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, techboard
On Mon, Jul 14, 2025 at 9:30 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> The behaviour of VLAN tag stripping Rx offloads is unclear in DPDK, and
> not very well documented. Even the documentation that does exist appears
> contradictory.
>
> For example, the doxygen docs for the mbuf flag
> RTE_MBUF_F_RX_QINQ_STRIPPED says:
>
> "If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> is unset, only the outer VLAN is removed from packet data,..."
>
> but the docs for RTE_MBUF_F_RX_QINQ says:
>
> "If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs
> headers have been stripped from mbuf data, ..."
>
> Without a good definition of what the correct behaviour is, it's not
> possible to assess and ensure conformance across drivers. Update the
> documentation for NIC features, ethdev and mbuf library to all report
> the same information: that VLAN strip feature is stripping one flag, and
> QinQ strip feature is removing two.
I'm working on testing QinQ/VLAN stripping features across PMDs, and
so far I've found that our Intel devices are capable of QinQ
stripping, while our Mellanox/Broadcom devices are not. When QinQ
stripping is enabled on an Intel PMD, the test packet is received with
its outer VLAN layer stripped, but the inner VLAN layer remains
intact. Thus, the doxygen example is more accurate for what is
currently supported. I'm also running some tests on VLAN stripping
behavior, I'll update this thread with the results once these are
finished.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour
2025-07-14 20:09 ` Dean Marx
@ 2025-07-14 21:41 ` Patrick Robb
0 siblings, 0 replies; 7+ messages in thread
From: Patrick Robb @ 2025-07-14 21:41 UTC (permalink / raw)
To: Dean Marx; +Cc: Bruce Richardson, dev, techboard
[-- Attachment #1: Type: text/plain, Size: 3047 bytes --]
On Mon, Jul 14, 2025 at 4:09 PM Dean Marx <dmarx@iol.unh.edu> wrote:
> On Mon, Jul 14, 2025 at 9:30 AM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > The behaviour of VLAN tag stripping Rx offloads is unclear in DPDK, and
> > not very well documented. Even the documentation that does exist appears
> > contradictory.
> >
> > For example, the doxygen docs for the mbuf flag
> > RTE_MBUF_F_RX_QINQ_STRIPPED says:
> >
> > "If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED
> > is unset, only the outer VLAN is removed from packet data,..."
> >
> > but the docs for RTE_MBUF_F_RX_QINQ says:
> >
> > "If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs
> > headers have been stripped from mbuf data, ..."
> >
> > Without a good definition of what the correct behaviour is, it's not
> > possible to assess and ensure conformance across drivers. Update the
> > documentation for NIC features, ethdev and mbuf library to all report
> > the same information: that VLAN strip feature is stripping one flag, and
> > QinQ strip feature is removing two.
>
> I'm working on testing QinQ/VLAN stripping features across PMDs, and
> so far I've found that our Intel devices are capable of QinQ
> stripping, while our Mellanox/Broadcom devices are not. When QinQ
> stripping is enabled on an Intel PMD, the test packet is received with
> its outer VLAN layer stripped, but the inner VLAN layer remains
> intact. Thus, the doxygen example is more accurate for what is
> currently supported. I'm also running some tests on VLAN stripping
> behavior, I'll update this thread with the results once these are
> finished.
>
Thanks for checking the test results on the Intel NICs. That's interesting
that the behavior (only outer tag stripped) differs from the description in
the patch. But, I guess this question will become irrelevant if QinQ strip
without VLAN strip will become disallowed at the ethdev layer. So problem
solved there I guess!
Otherwise, it sounds like there are basically 3 valid "strip" configs a
port can be set to.
1. No strip
2. VLAN Strip
3. VLAN Strip + QinQ strip
And then, as Morten points out, there are various packet profiles which we
can send through these 3 configurations for your testcases.
Single VLAN: Ether() / Dot1Q(vlan=100, type=0x8100) / IP(dst="1.2.3.4") /
UDP(dport=1234, sport=4321)
Double VLAN: Ether() / Dot1Q(vlan=100, type=0x8100) / Dot1Q(vlan=200,
type=0x8100) / IP(dst="1.2.3.4") / UDP(dport=1234, sport=4321)
Single 0x88a8 tag only: Ether() / Dot1Q(vlan=100,
type=0x88a8 / IP(dst="1.2.3.4") / UDP(dport=1234, sport=4321)
Single VLAN + 1 0x88a8 tag: Ether() / Dot1Q(vlan=100, type=0x88a8)
/ Dot1Q(vlan=100, type=0x8100) / IP(dst="1.2.3.4") / UDP(dport=1234,
sport=4321)
Dean I gotta run for now but tomorrow let's see if we can define the
expected behavior for the intersection of these various stripping option
and packet profiles and pseudo code out some testcases based on that.
[-- Attachment #2: Type: text/html, Size: 3880 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-14 21:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-14 13:30 [RFC PATCH] doc: clarify VLAN and QinQ stripping behaviour Bruce Richardson
2025-07-14 15:06 ` Stephen Hemminger
2025-07-14 15:11 ` Bruce Richardson
2025-07-14 16:33 ` Morten Brørup
2025-07-14 16:49 ` Bruce Richardson
2025-07-14 20:09 ` Dean Marx
2025-07-14 21:41 ` Patrick Robb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).