Skip to contentSkip to conversation

mbuf: fix to update documentation of QinQ stripped bit interpretation

PATCH In review Somnath Kotur 7 participants 14 messages Jan 6, 2020 – Oct 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbuf: fix to update documentation of QinQ stripped bit interpretation

Certain hardware may be able to strip and/or save only the outermost VLAN instead of both the VLANs in the mbuf in a QinQ scenario. To handle such cases, we could re-interpret setting of just PKT_RX_QINQ_STRIPPED to indicate that only the outermost VLAN has been stripped and saved in mbuf->vlan_tci_outer.
Only When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 VLANs have been stripped by the hardware and their TCI are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

---
 lib/librte_mbuf/rte_mbuf_core.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +11 -4
index 9a8557d..db1070b 100644
@@ -124,12 +124,19 @@
 #define PKT_RX_FDIR_FLX      (1ULL << 14)
 
 /**
- * The 2 vlans have been stripped by the hardware and their tci are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * The outer vlan has been stripped by the hardware and their tci are
+ * saved in mbuf->vlan_tci_outer (outer).
  * This can only happen if vlan stripping is enabled in the RX
  * configuration of the PMD.
- * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
- * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
+ * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |  PKT_RX_QINQ)
+ * must also be set.
+ * When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
+ * have been stripped by the hardware and their tci are saved in
+ * mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * This can only happen if vlan stripping is enabled in the RX configuration
+ * of the PMD.
+ * When PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set,
+ * (PKT_RX_VLAN | PKT_RX_QINQ) must also be set.
  */
 #define PKT_RX_QINQ_STRIPPED (1ULL << 15)
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 44 lines · Somnath Kotur

Certain hardware may be able to strip and/or save only the outermost VLAN instead of both the VLANs in the mbuf in a QinQ scenario. To handle such cases, we could re-interpret setting of just PKT_RX_QINQ_STRIPPED to indicate that only the outermost VLAN has been stripped and saved in mbuf->vlan_tci_outer.
Only When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 VLANs have been stripped by the hardware and their TCI are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

---
 lib/librte_mbuf/rte_mbuf_core.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +11 -5
index 9a8557d..db1070b 100644
@@ -124,12 +124,19 @@
 #define PKT_RX_FDIR_FLX      (1ULL << 14)
 
 /**
- * The 2 vlans have been stripped by the hardware and their tci are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * The outer vlan has been stripped by the hardware and their tci are
+ * saved in mbuf->vlan_tci_outer (outer).
  * This can only happen if vlan stripping is enabled in the RX
  * configuration of the PMD.
- * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
- * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
+ * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |  PKT_RX_QINQ)
+ * must also be set.
+ * When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
+ * have been stripped by the hardware and their tci are saved in
+ * mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * This can only happen if vlan stripping is enabled in the RX configuration
+ * of the PMD.
+ * When PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set,
+ * (PKT_RX_VLAN | PKT_RX_QINQ) must also be set.
  */
 #define PKT_RX_QINQ_STRIPPED (1ULL << 15)
 
--
Quoted 1 line

1.8.3.1

Seeing as its been a month since it was submitted and no comments on it yet , are we ok to go ahead and merge this in please?

Thanks
Som

#2 lore raw
In reply to Somnath Kotur

Hi Somnath,

Sorry for the delay, please find some comments below.

I suggest the following title instead:

mbuf: extend meaning of QinQ stripped bit

Quoted 5 lines · Somnath Kotur

Certain hardware may be able to strip and/or save only the outermost VLAN instead of both the VLANs in the mbuf in a QinQ scenario. To handle such cases, we could re-interpret setting of just PKT_RX_QINQ_STRIPPED to indicate that only the outermost VLAN has been stripped and saved in mbuf->vlan_tci_outer.

To be sure we're on the same page: we are talking about case 7 of this

So, even if the inner vlan_tci is not stripped from packet data, it has to be saved in m->vlan_tci, because it is implied by PKT_RX_VLAN.

From the same link, the case where the driver only strips+saves the outer vlan without saving or stripping the inner one is case 3.

Quoted 14 lines

Only When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 VLANs have been stripped by the hardware and their TCI are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

---
 lib/librte_mbuf/rte_mbuf_core.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +0 -0
index 9a8557d..db1070b 100644

lib/librte_mbuf/rte_mbuf_core.h line 128

Quoted 7 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -2
@@ -124,12 +124,19 @@
 #define PKT_RX_FDIR_FLX      (1ULL << 14)
 
 /**
- * The 2 vlans have been stripped by the hardware and their tci are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * The outer vlan has been stripped by the hardware and their tci are
+ * saved in mbuf->vlan_tci_outer (outer).

their tci are -> its tci is

lib/librte_mbuf/rte_mbuf_core.h line 132

Quoted 6 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -2
  * This can only happen if vlan stripping is enabled in the RX
  * configuration of the PMD.
- * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
- * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
+ * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |  PKT_RX_QINQ)
+ * must also be set.

ok

lib/librte_mbuf/rte_mbuf_core.h line 135

Quoted 3 lines
lib/librte_mbuf/rte_mbuf_core.h +3 -0
+ * When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
+ * have been stripped by the hardware and their tci are saved in
+ * mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

This is correct, but I'd use a bullet list to add another sentence:

* - If both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
* have been stripped by the hardware and their tci are saved in
* mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
* - If PKT_RX_QINQ_STRIPPED is set and PKT_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).

lib/librte_mbuf/rte_mbuf_core.h line 137

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -0
+ * This can only happen if vlan stripping is enabled in the RX configuration
+ * of the PMD.

The same exact sentence is above, this one can be removed.

lib/librte_mbuf/rte_mbuf_core.h line 139

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -0
+ * When PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set,
+ * (PKT_RX_VLAN | PKT_RX_QINQ) must also be set.

This can be removed too as it is redundant with above sentence:

* When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN | PKT_RX_QINQ)
* must also be set.

Thanks,
Olivier

#3 lore raw

Olivier,

Quoted 10 lines · Olivier Matz

Hi Somnath,

Sorry for the delay, please find some comments below.

I suggest the following title instead:

mbuf: extend meaning of QinQ stripped bit

On Mon, Jan 06, 2020 at 02:04:23PM +0530, Somnath Kotur wrote:

Quoted 8 lines
Quoted 5 lines

Certain hardware may be able to strip and/or save only the outermost VLAN instead of both the VLANs in the mbuf in a QinQ scenario. To handle such cases, we could re-interpret setting of just PKT_RX_QINQ_STRIPPED to indicate that only the outermost VLAN has been stripped and saved in mbuf->vlan_tci_outer.

To be sure we're on the same page: we are talking about case 7 of this

I'm not sure we are on the same page then, please see my response inline below

Quoted 7 lines

So, even if the inner vlan_tci is not stripped from packet data, it has to be saved in m->vlan_tci, because it is implied by PKT_RX_VLAN.

From the same link, the case where the driver only strips+saves the outer vlan without saving or stripping the inner one is case 3.

While this is how it works currently, I'm wondering how will the application know if this was
a double VLAN pkt, correct?
Also when i look at options 5 and 7 I don't really see the difference in semantics between them ?
Both seem to store the outer-vlan and inner-vlan in m->vlan_tci_outer and m->vlan_tci_inner respectively

7/ PKT_RX_VLAN | PKT_RX_QINQ | PKT_RX_QINQ_STRIPPED
outer-vlan is removed from packet data m->vlan_tci_outer=outer-vlan m->vlan_tci=inner-vlan

I was hoping that with the new interpretation of PKT_RX_QINQ_STRIPPED, it only meant that outer-vlan is removed from packet data and m->vlan_tci_outer = outer_vlan, while PKT_RX_QINQ implies it is a double-vlan pkt and PKT_RX_VLAN implies that pkt has VLAN
associated with it? Not m->vlan_tci = inner-vlan

Thanks
Som

Quoted 62 lines
Quoted 14 lines

Only When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 VLANs have been stripped by the hardware and their TCI are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

---
 lib/librte_mbuf/rte_mbuf_core.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +0 -0
index 9a8557d..db1070b 100644

lib/librte_mbuf/rte_mbuf_core.h line 128

Quoted 7 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -2
@@ -124,12 +124,19 @@
 #define PKT_RX_FDIR_FLX      (1ULL << 14)
 
 /**
- * The 2 vlans have been stripped by the hardware and their tci are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * The outer vlan has been stripped by the hardware and their tci are
+ * saved in mbuf->vlan_tci_outer (outer).

their tci are -> its tci is

lib/librte_mbuf/rte_mbuf_core.h line 132

Quoted 6 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -2
  * This can only happen if vlan stripping is enabled in the RX
  * configuration of the PMD.
- * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
- * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
+ * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |  PKT_RX_QINQ)
+ * must also be set.

ok

lib/librte_mbuf/rte_mbuf_core.h line 135

Quoted 3 lines
lib/librte_mbuf/rte_mbuf_core.h +3 -0
+ * When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
+ * have been stripped by the hardware and their tci are saved in
+ * mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

This is correct, but I'd use a bullet list to add another sentence:

* - If both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
* have been stripped by the hardware and their tci are saved in
* mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
* - If PKT_RX_QINQ_STRIPPED is set and PKT_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).

lib/librte_mbuf/rte_mbuf_core.h line 137

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -0
+ * This can only happen if vlan stripping is enabled in the RX configuration
+ * of the PMD.

The same exact sentence is above, this one can be removed.

lib/librte_mbuf/rte_mbuf_core.h line 139

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -0
+ * When PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set,
+ * (PKT_RX_VLAN | PKT_RX_QINQ) must also be set.

This can be removed too as it is redundant with above sentence:

* When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN | PKT_RX_QINQ)
* must also be set.

Thanks,
Olivier

#4 lore raw

Hi Somnath,

Quoted 27 lines · Somnath Kotur

Olivier,

Quoted 10 lines · Olivier Matz

Hi Somnath,

Sorry for the delay, please find some comments below.

I suggest the following title instead:

mbuf: extend meaning of QinQ stripped bit

On Mon, Jan 06, 2020 at 02:04:23PM +0530, Somnath Kotur wrote:

Quoted 8 lines
Quoted 5 lines

Certain hardware may be able to strip and/or save only the outermost VLAN instead of both the VLANs in the mbuf in a QinQ scenario. To handle such cases, we could re-interpret setting of just PKT_RX_QINQ_STRIPPED to indicate that only the outermost VLAN has been stripped and saved in mbuf->vlan_tci_outer.

To be sure we're on the same page: we are talking about case 7 of this

I'm not sure we are on the same page then, please see my response inline below

Quoted 4 lines

So, even if the inner vlan_tci is not stripped from packet data, it has to be saved in m->vlan_tci, because it is implied by PKT_RX_VLAN.

Quoted 6 lines
Quoted 3 lines

From the same link, the case where the driver only strips+saves the outer vlan without saving or stripping the inner one is case 3.

While this is how it works currently, I'm wondering how will the application know if this was
a double VLAN pkt, correct?

If the hardware supports it and configured for it, the flag PKT_RX_QINQ is set when there are 2 vlans.

FYI, the m->packet_type field can also be useful. It describes what is really present in the packet data, as described in rte_mbuf_core.h:

/*
* The packet type, which is the combination of outer/inner L2, L3, L4
* and tunnel types. The packet_type is about data really present in the
* mbuf. Example: if vlan stripping is enabled, a received vlan packet
* would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
* vlan is stripped from the data.
*/

Quoted 9 lines

Also when i look at options 5 and 7 I don't really see the difference in semantics between them ?
Both seem to store the outer-vlan and inner-vlan in m->vlan_tci_outer and m->vlan_tci_inner respectively

7/ PKT_RX_VLAN | PKT_RX_QINQ | PKT_RX_QINQ_STRIPPED
outer-vlan is removed from packet data m->vlan_tci_outer=outer-vlan m->vlan_tci=inner-vlan

The difference is about what was stripped or not from mbuf data.

Quoted 5 lines

I was hoping that with the new interpretation of PKT_RX_QINQ_STRIPPED, it only meant that outer-vlan is removed from packet data and m->vlan_tci_outer = outer_vlan, while PKT_RX_QINQ implies it is a double-vlan pkt and PKT_RX_VLAN implies that pkt has VLAN
associated with it? Not m->vlan_tci = inner-vlan

The meaning of each flag should be as simple as possible, I think we can summarize them like this:

- PKT_RX_VLAN: the vlan is saved in vlan tci.
- PKT_RX_VLAN_STRIPPED: the vlan hdr is removed from packet data.
- PKT_RX_QINQ: the outer vlan is saved in vlan tci.
- PKT_RX_QINQ_STRIPPED: the inner vlan is stripped from packet data.
- When PKT_RX_QINQ is set, PKT_RX_VLAN* refer to the inner vlan of initial packet, else it refers to the first vlan of the packet.

There is a link between vlan flag and vlan_tci field, and qinq flag and vlan_tci_outer field.

I'm still not sure to understand what you expect. Can you give an example with flags (which are set), and the expected content of m->vlan_tci and m->vlan_tci_outer?

By the way, the case 5/ is not very well described too, maybe we should add something about it.

Thanks,
Olivier

Quoted 67 lines

Thanks
Som

Quoted 62 lines
Quoted 14 lines

Only When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 VLANs have been stripped by the hardware and their TCI are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

---
 lib/librte_mbuf/rte_mbuf_core.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +0 -0
index 9a8557d..db1070b 100644

lib/librte_mbuf/rte_mbuf_core.h line 128

Quoted 7 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -2
@@ -124,12 +124,19 @@
 #define PKT_RX_FDIR_FLX      (1ULL << 14)
 
 /**
- * The 2 vlans have been stripped by the hardware and their tci are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * The outer vlan has been stripped by the hardware and their tci are
+ * saved in mbuf->vlan_tci_outer (outer).

their tci are -> its tci is

lib/librte_mbuf/rte_mbuf_core.h line 132

Quoted 6 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -2
  * This can only happen if vlan stripping is enabled in the RX
  * configuration of the PMD.
- * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
- * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
+ * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |  PKT_RX_QINQ)
+ * must also be set.

ok

lib/librte_mbuf/rte_mbuf_core.h line 135

Quoted 3 lines
lib/librte_mbuf/rte_mbuf_core.h +3 -0
+ * When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
+ * have been stripped by the hardware and their tci are saved in
+ * mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

This is correct, but I'd use a bullet list to add another sentence:

* - If both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans
* have been stripped by the hardware and their tci are saved in
* mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
* - If PKT_RX_QINQ_STRIPPED is set and PKT_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).

lib/librte_mbuf/rte_mbuf_core.h line 137

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -0
+ * This can only happen if vlan stripping is enabled in the RX configuration
+ * of the PMD.

The same exact sentence is above, this one can be removed.

lib/librte_mbuf/rte_mbuf_core.h line 139

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -0
+ * When PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set,
+ * (PKT_RX_VLAN | PKT_RX_QINQ) must also be set.

This can be removed too as it is redundant with above sentence:

* When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN | PKT_RX_QINQ)
* must also be set.

Thanks,
Olivier

#5 lore raw
Quoted 17 lines · On Fri, 7 Feb 2020 15:29:59 +0100 Olivier Matz <[email protected]> wrote:

The meaning of each flag should be as simple as possible, I think we can summarize them like this:

- PKT_RX_VLAN: the vlan is saved in vlan tci.
- PKT_RX_VLAN_STRIPPED: the vlan hdr is removed from packet data.
- PKT_RX_QINQ: the outer vlan is saved in vlan tci.
- PKT_RX_QINQ_STRIPPED: the inner vlan is stripped from packet data.
- When PKT_RX_QINQ is set, PKT_RX_VLAN* refer to the inner vlan of initial packet, else it refers to the first vlan of the packet.

There is a link between vlan flag and vlan_tci field, and qinq flag and vlan_tci_outer field.

I'm still not sure to understand what you expect. Can you give an example with flags (which are set), and the expected content of m->vlan_tci and m->vlan_tci_outer?

Quoted 5 lines

By the way, the case 5/ is not very well described too, maybe we should add something about it.

Thanks,
Olivier

The patch does help clarify the meaning, and Oliver's summary clarifies even more. It might be possible for hardware to offload inner vlan but not outer vlan, though seriously doubt anyone but some conformance test would do that.

#6 lore raw

Please Somnath, it is waiting for a v2.

26/02/2020 01:55, Stephen Hemminger:

Quoted 30 lines
Quoted 17 lines · On Fri, 7 Feb 2020 15:29:59 +0100 Olivier Matz <[email protected]> wrote:

The meaning of each flag should be as simple as possible, I think we can summarize them like this:

- PKT_RX_VLAN: the vlan is saved in vlan tci.
- PKT_RX_VLAN_STRIPPED: the vlan hdr is removed from packet data.
- PKT_RX_QINQ: the outer vlan is saved in vlan tci.
- PKT_RX_QINQ_STRIPPED: the inner vlan is stripped from packet data.
- When PKT_RX_QINQ is set, PKT_RX_VLAN* refer to the inner vlan of initial packet, else it refers to the first vlan of the packet.

There is a link between vlan flag and vlan_tci field, and qinq flag and vlan_tci_outer field.

I'm still not sure to understand what you expect. Can you give an example with flags (which are set), and the expected content of m->vlan_tci and m->vlan_tci_outer?

Quoted 5 lines

By the way, the case 5/ is not very well described too, maybe we should add something about it.

Thanks,
Olivier

The patch does help clarify the meaning, and Oliver's summary clarifies even more. It might be possible for hardware to offload inner vlan but not outer vlan, though seriously doubt anyone but some conformance test would do that.

#7 lore raw

Somnath, why neither update, nor reply to reviews after February 7? It is discouraging for reviewers.

24/04/2020 20:24, Thomas Monjalon:

Quoted 34 lines

Please Somnath, it is waiting for a v2.

26/02/2020 01:55, Stephen Hemminger:

Quoted 30 lines
Quoted 17 lines · On Fri, 7 Feb 2020 15:29:59 +0100 Olivier Matz <[email protected]> wrote:

The meaning of each flag should be as simple as possible, I think we can summarize them like this:

- PKT_RX_VLAN: the vlan is saved in vlan tci.
- PKT_RX_VLAN_STRIPPED: the vlan hdr is removed from packet data.
- PKT_RX_QINQ: the outer vlan is saved in vlan tci.
- PKT_RX_QINQ_STRIPPED: the inner vlan is stripped from packet data.
- When PKT_RX_QINQ is set, PKT_RX_VLAN* refer to the inner vlan of initial packet, else it refers to the first vlan of the packet.

There is a link between vlan flag and vlan_tci field, and qinq flag and vlan_tci_outer field.

I'm still not sure to understand what you expect. Can you give an example with flags (which are set), and the expected content of m->vlan_tci and m->vlan_tci_outer?

Quoted 5 lines

By the way, the case 5/ is not very well described too, maybe we should add something about it.

Thanks,
Olivier

The patch does help clarify the meaning, and Oliver's summary clarifies even more. It might be possible for hardware to offload inner vlan but not outer vlan, though seriously doubt anyone but some conformance test would do that.

#8 lore raw

Ping

Anybody volunteer to make a v2 please?

24/05/2020 17:34, Thomas Monjalon:

Quoted 39 lines

Somnath, why neither update, nor reply to reviews after February 7? It is discouraging for reviewers.

24/04/2020 20:24, Thomas Monjalon:

Quoted 34 lines

Please Somnath, it is waiting for a v2.

26/02/2020 01:55, Stephen Hemminger:

Quoted 30 lines
Quoted 17 lines · On Fri, 7 Feb 2020 15:29:59 +0100 Olivier Matz <[email protected]> wrote:

The meaning of each flag should be as simple as possible, I think we can summarize them like this:

- PKT_RX_VLAN: the vlan is saved in vlan tci.
- PKT_RX_VLAN_STRIPPED: the vlan hdr is removed from packet data.
- PKT_RX_QINQ: the outer vlan is saved in vlan tci.
- PKT_RX_QINQ_STRIPPED: the inner vlan is stripped from packet data.
- When PKT_RX_QINQ is set, PKT_RX_VLAN* refer to the inner vlan of initial packet, else it refers to the first vlan of the packet.

There is a link between vlan flag and vlan_tci field, and qinq flag and vlan_tci_outer field.

I'm still not sure to understand what you expect. Can you give an example with flags (which are set), and the expected content of m->vlan_tci and m->vlan_tci_outer?

Quoted 5 lines

By the way, the case 5/ is not very well described too, maybe we should add something about it.

Thanks,
Olivier

The patch does help clarify the meaning, and Oliver's summary clarifies even more. It might be possible for hardware to offload inner vlan but not outer vlan, though seriously doubt anyone but some conformance test would do that.

#9 lore raw
In reply to Somnath Kotur

I'll review v2 promptly, some minor comments from me below (taking into account that Olivier's review notes are applied).

Quoted 19 lines · Somnath Kotur

Certain hardware may be able to strip and/or save only the outermost VLAN instead of both the VLANs in the mbuf in a QinQ scenario. To handle such cases, we could re-interpret setting of just PKT_RX_QINQ_STRIPPED to indicate that only the outermost VLAN has been stripped and saved in mbuf->vlan_tci_outer.
Only When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 VLANs have been stripped by the hardware and their TCI are saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

---
 lib/librte_mbuf/rte_mbuf_core.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +0 -0
index 9a8557d..db1070b 100644

lib/librte_mbuf/rte_mbuf_core.h line 127

Quoted 6 lines
lib/librte_mbuf/rte_mbuf_core.h +1 -2
@@ -124,12 +124,19 @@
 #define PKT_RX_FDIR_FLX      (1ULL << 14)
 
 /**
- * The 2 vlans have been stripped by the hardware and their tci are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * The outer vlan has been stripped by the hardware and their tci are

vlan -> VLAN, tci -> TCI

lib/librte_mbuf/rte_mbuf_core.h line 129

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +1 -0
+ * saved in mbuf->vlan_tci_outer (outer).
  * This can only happen if vlan stripping is enabled in the RX

vlan -> VLAN, RX -> Rx

lib/librte_mbuf/rte_mbuf_core.h line 133

Quoted 6 lines
lib/librte_mbuf/rte_mbuf_core.h +3 -2
  * configuration of the PMD.
- * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
- * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
+ * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |  PKT_RX_QINQ)
+ * must also be set.
+ * When both PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set, the 2 vlans

vlans -> VLANs

lib/librte_mbuf/rte_mbuf_core.h line 134

Quoted 1 line
lib/librte_mbuf/rte_mbuf_core.h +1 -0
+ * have been stripped by the hardware and their tci are saved in

tci -> TCI

lib/librte_mbuf/rte_mbuf_core.h line 136

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_core.h +2 -0
+ * mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
+ * This can only happen if vlan stripping is enabled in the RX configuration

vlan -> VLAN, RX -> Rx

lib/librte_mbuf/rte_mbuf_core.h line 142

Quoted 7 lines
lib/librte_mbuf/rte_mbuf_core.h +3 -0
+ * of the PMD.
+ * When PKT_RX_QINQ_STRIPPED and PKT_RX_VLAN_STRIPPED are set,
+ * (PKT_RX_VLAN | PKT_RX_QINQ) must also be set.
  */
 #define PKT_RX_QINQ_STRIPPED (1ULL << 15)
 

I realize that some of my comment above touch not modified lines, but ~90% of the description is updated and I see no point to keep remaining 10% untouched.

#10 lore raw

PATCH v2 1/1 mbuf: extend meaning of QinQ stripped bit

In reply to Somnath Kotur

From: Somnath Kotur <[email protected]>

Clarify the documentation of QinQ flags, and extend the meaning of the
flag: if PKT_RX_QINQ_STRIPPED is set and PKT_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).

---

Hi,

Here is an update of this old patch from Somnath.

Olivier

v2:
- better reword PKT_RX_QINQ_STRIPPED documentation
- also update PKT_RX_QINQ documentation

 lib/librte_mbuf/rte_mbuf_core.h | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +14 -7
index 8c2c20644d..8f631b84cf 100644
@@ -126,12 +126,19 @@ extern "C" {
 #define PKT_RX_FDIR_FLX      (1ULL << 14)
 
 /**
- * The 2 vlans have been stripped by the hardware and their tci are
- * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
- * This can only happen if vlan stripping is enabled in the RX
+ * 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 PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
- * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
+ * When PKT_RX_QINQ_STRIPPED is set, the flags PKT_RX_VLAN and PKT_RX_QINQ
+ * must also be set.
+ *
+ * - If both PKT_RX_QINQ_STRIPPED and PKT_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 PKT_RX_QINQ_STRIPPED is set and PKT_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).
  */
 #define PKT_RX_QINQ_STRIPPED (1ULL << 15)
 
@@ -159,8 +166,8 @@ extern "C" {
 
 /**
  * The RX packet is a double VLAN, and the outer tci has been
- * saved in in mbuf->vlan_tci_outer. If PKT_RX_QINQ set, PKT_RX_VLAN
- * also should be set and inner tci should be saved to mbuf->vlan_tci.
+ * saved in mbuf->vlan_tci_outer. If this flag is set, PKT_RX_VLAN
+ * must also be set and the inner tci is saved in mbuf->vlan_tci.
  * If the flag PKT_RX_QINQ_STRIPPED is also present, both VLANs
  * headers have been stripped from mbuf data, else they are still
  * present.
Signature · 1 line
2.25.1
#11 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: extend meaning of QinQ stripped bit

Quoted 10 lines · Olivier Matz

From: Somnath Kotur <[email protected]>

Clarify the documentation of QinQ flags, and extend the meaning of the
flag: if PKT_RX_QINQ_STRIPPED is set and PKT_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).

Is it only a documentation fix and the drivers are already implementing this behavior?
CC driver maintainers for double check.

Thanks.

Signature · 1 line
David Marchand
Acked-by on v2 1/1
#12 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: extend meaning of QinQ stripped bit

In reply to Olivier Matz
Quoted 9 lines · Olivier Matz

From: Somnath Kotur <[email protected]>

Clarify the documentation of QinQ flags, and extend the meaning of the
flag: if PKT_RX_QINQ_STRIPPED is set and PKT_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).

Acked-by Andrew Rybchenko on v2 1/1 Applied
#13 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: extend meaning of QinQ stripped bit

In reply to Olivier Matz
Quoted 10 lines · Olivier Matz

From: Somnath Kotur <[email protected]>

Clarify the documentation of QinQ flags, and extend the meaning of the
flag: if PKT_RX_QINQ_STRIPPED is set and PKT_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).

Applied, thanks Olivier.

Signature · 1 line
David Marchand