DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] mbuf: clarify QINQ flag usage
  2018-10-02 10:17 [dpdk-dev] [PATCH] mbuf: clarify QINQ flag usage Ferruh Yigit
@ 2018-10-02  9:44 ` Andrew Rybchenko
  2018-10-02 10:08   ` Ferruh Yigit
  2018-10-02 11:36 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Rybchenko @ 2018-10-02  9:44 UTC (permalink / raw)
  To: Ferruh Yigit, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Beilei Xing, Qi Zhang,
	Olivier Matz
  Cc: dev, Hyong Youb Kim, John Daley

On 10/2/18 1:17 PM, Ferruh Yigit wrote:
> Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
> set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
> should be also set.
>
> Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
> should be set.
>
> So that appllication can rely on PKT_RX_QINQ flag to access both
> mbuf.vlan_tci & mbuf.vlan_tci_outer
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Hyong Youb Kim <hyonkim@cisco.com>
> Cc: John Daley <johndale@cisco.com>
> ---
>   app/test-pmd/rxonly.c        | 2 +-
>   doc/guides/nics/features.rst | 7 ++++---
>   drivers/net/i40e/i40e_rxtx.c | 3 ++-
>   lib/librte_mbuf/rte_mbuf.c   | 1 +
>   lib/librte_mbuf/rte_mbuf.h   | 5 +++--
>   5 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
> index a93d80612..08a5fc2cf 100644
> --- a/app/test-pmd/rxonly.c
> +++ b/app/test-pmd/rxonly.c
> @@ -132,7 +132,7 @@ pkt_burst_receive(struct fwd_stream *fs)
>   			printf(" - timestamp %"PRIu64" ", mb->timestamp);
>   		if (ol_flags & PKT_RX_VLAN_STRIPPED)

It looks like it should be PKT_RX_VLAN above.

>   			printf(" - VLAN tci=0x%x", mb->vlan_tci);
> -		if (ol_flags & PKT_RX_QINQ_STRIPPED)
> +		if (ol_flags & PKT_RX_QINQ)
>   			printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
>   					mb->vlan_tci, mb->vlan_tci_outer);

The first one duplicates above printout, so it should be either put before
PKT_RX_VLAN check and do PKT_RX_VLAN in else branch, or simply removed
from here.

<...>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] mbuf: clarify QINQ flag usage
  2018-10-02  9:44 ` Andrew Rybchenko
@ 2018-10-02 10:08   ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2018-10-02 10:08 UTC (permalink / raw)
  To: Andrew Rybchenko, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Beilei Xing, Qi Zhang,
	Olivier Matz
  Cc: dev, Hyong Youb Kim, John Daley

On 10/2/2018 10:44 AM, Andrew Rybchenko wrote:
> On 10/2/18 1:17 PM, Ferruh Yigit wrote:
>> Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
>> set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
>> should be also set.
>>
>> Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
>> should be set.
>>
>> So that appllication can rely on PKT_RX_QINQ flag to access both
>> mbuf.vlan_tci & mbuf.vlan_tci_outer
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> Cc: Hyong Youb Kim <hyonkim@cisco.com>
>> Cc: John Daley <johndale@cisco.com>
>> ---
>>   app/test-pmd/rxonly.c        | 2 +-
>>   doc/guides/nics/features.rst | 7 ++++---
>>   drivers/net/i40e/i40e_rxtx.c | 3 ++-
>>   lib/librte_mbuf/rte_mbuf.c   | 1 +
>>   lib/librte_mbuf/rte_mbuf.h   | 5 +++--
>>   5 files changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
>> index a93d80612..08a5fc2cf 100644
>> --- a/app/test-pmd/rxonly.c
>> +++ b/app/test-pmd/rxonly.c
>> @@ -132,7 +132,7 @@ pkt_burst_receive(struct fwd_stream *fs)
>>   			printf(" - timestamp %"PRIu64" ", mb->timestamp);
>>   		if (ol_flags & PKT_RX_VLAN_STRIPPED)
> 
> It looks like it should be PKT_RX_VLAN above.

There is already a patch from Hyong for it which triggered this patch:
https://patches.dpdk.org/patch/45350/


> 
>>   			printf(" - VLAN tci=0x%x", mb->vlan_tci);
>> -		if (ol_flags & PKT_RX_QINQ_STRIPPED)
>> +		if (ol_flags & PKT_RX_QINQ)
>>   			printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
>>   					mb->vlan_tci, mb->vlan_tci_outer);
> 
> The first one duplicates above printout, so it should be either put before
> PKT_RX_VLAN check and do PKT_RX_VLAN in else branch, or simply removed
> from here.

Right, let me check it.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH] mbuf: clarify QINQ flag usage
@ 2018-10-02 10:17 Ferruh Yigit
  2018-10-02  9:44 ` Andrew Rybchenko
  2018-10-02 11:36 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  0 siblings, 2 replies; 8+ messages in thread
From: Ferruh Yigit @ 2018-10-02 10:17 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic, Beilei Xing, Qi Zhang, Olivier Matz
  Cc: dev, Ferruh Yigit, Hyong Youb Kim, John Daley

Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
should be also set.

Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
should be set.

So that appllication can rely on PKT_RX_QINQ flag to access both
mbuf.vlan_tci & mbuf.vlan_tci_outer

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Hyong Youb Kim <hyonkim@cisco.com>
Cc: John Daley <johndale@cisco.com>
---
 app/test-pmd/rxonly.c        | 2 +-
 doc/guides/nics/features.rst | 7 ++++---
 drivers/net/i40e/i40e_rxtx.c | 3 ++-
 lib/librte_mbuf/rte_mbuf.c   | 1 +
 lib/librte_mbuf/rte_mbuf.h   | 5 +++--
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index a93d80612..08a5fc2cf 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -132,7 +132,7 @@ pkt_burst_receive(struct fwd_stream *fs)
 			printf(" - timestamp %"PRIu64" ", mb->timestamp);
 		if (ol_flags & PKT_RX_VLAN_STRIPPED)
 			printf(" - VLAN tci=0x%x", mb->vlan_tci);
-		if (ol_flags & PKT_RX_QINQ_STRIPPED)
+		if (ol_flags & PKT_RX_QINQ)
 			printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
 					mb->vlan_tci, mb->vlan_tci_outer);
 		if (mb->packet_type) {
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index b085bda86..c0cbe3784 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -528,7 +528,7 @@ Supports VLAN offload to hardware.
 * **[uses]       rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_VLAN_STRIP,DEV_RX_OFFLOAD_VLAN_FILTER,DEV_RX_OFFLOAD_VLAN_EXTEND``.
 * **[uses]       rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_VLAN_INSERT``.
 * **[implements] eth_dev_ops**: ``vlan_offload_set``.
-* **[provides]   mbuf**: ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.vlan_tci``.
+* **[provides]   mbuf**: ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.ol_flags:PKT_RX_VLAN`` ``mbuf.vlan_tci``.
 * **[provides]   rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_VLAN_STRIP``,
   ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_VLAN_INSERT``.
 * **[related]    API**: ``rte_eth_dev_set_vlan_offload()``,
@@ -545,8 +545,9 @@ Supports QinQ (queue in queue) offload.
 * **[uses]     rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_QINQ_STRIP``.
 * **[uses]     rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_QINQ_INSERT``.
 * **[uses]     mbuf**: ``mbuf.ol_flags:PKT_TX_QINQ_PKT``.
-* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_QINQ_STRIPPED``, ``mbuf.vlan_tci``,
-   ``mbuf.vlan_tci_outer``.
+* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_QINQ_STRIPPED``, ``mbuf.ol_flags:PKT_RX_QINQ``,
+  ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.ol_flags:PKT_RX_VLAN``
+  ``mbuf.vlan_tci``, ``mbuf.vlan_tci_outer``.
 * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_QINQ_STRIP``,
   ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_QINQ_INSERT``.
 
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 7c986d535..b2819f757 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -83,7 +83,8 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union i40e_rx_desc *rxdp)
 #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.qword2.ext_status) &
 		(1 << I40E_RX_DESC_EXT_STATUS_L2TAG2P_SHIFT)) {
-		mb->ol_flags |= PKT_RX_QINQ_STRIPPED;
+		mb->ol_flags |= PKT_RX_QINQ_STRIPPED | PKT_RX_QINQ |
+			PKT_RX_VLAN_STRIPPED | PKT_RX_VLAN;
 		mb->vlan_tci_outer = mb->vlan_tci;
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.qword2.l2tag2_2);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2: %u",
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index e714c5a59..05a5a17fe 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -297,6 +297,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask)
 	case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP";
 	case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST";
 	case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED";
+	case PKT_RX_QINQ: return "PKT_RX_QINQ";
 	case PKT_RX_LRO: return "PKT_RX_LRO";
 	case PKT_RX_TIMESTAMP: return "PKT_RX_TIMESTAMP";
 	case PKT_RX_SEC_OFFLOAD: return "PKT_RX_SEC_OFFLOAD";
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a50b05c64..d018f19bd 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -140,7 +140,7 @@ extern "C" {
  * 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. If this flag is set,
+ * 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.
  */
@@ -170,7 +170,8 @@ extern "C" {
 
 /**
  * The RX packet is a double VLAN, and the outer tci has been
- * saved in in mbuf->vlan_tci_outer.
+ * 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.
  * If the flag PKT_RX_QINQ_STRIPPED is also present, both VLANs
  * headers have been stripped from mbuf data, else they are still
  * present.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] mbuf: clarify QINQ flag usage
  2018-10-02 11:36 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
@ 2018-10-02 10:40   ` Andrew Rybchenko
  2018-10-03 15:19   ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Rybchenko @ 2018-10-02 10:40 UTC (permalink / raw)
  To: Ferruh Yigit, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Beilei Xing, Qi Zhang,
	Olivier Matz
  Cc: dev, Hyong Youb Kim, John Daley

On 10/2/18 2:36 PM, Ferruh Yigit wrote:
> Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
> set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
> should be also set.
>
> Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
> should be set.
>
> So that appllication can rely on PKT_RX_QINQ flag to access both
> mbuf.vlan_tci & mbuf.vlan_tci_outer
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2] mbuf: clarify QINQ flag usage
  2018-10-02 10:17 [dpdk-dev] [PATCH] mbuf: clarify QINQ flag usage Ferruh Yigit
  2018-10-02  9:44 ` Andrew Rybchenko
@ 2018-10-02 11:36 ` Ferruh Yigit
  2018-10-02 10:40   ` Andrew Rybchenko
  2018-10-03 15:19   ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
  1 sibling, 2 replies; 8+ messages in thread
From: Ferruh Yigit @ 2018-10-02 11:36 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic, Beilei Xing, Qi Zhang, Olivier Matz
  Cc: dev, Ferruh Yigit, Andrew Rybchenko, Hyong Youb Kim, John Daley

Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
should be also set.

Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
should be set.

So that appllication can rely on PKT_RX_QINQ flag to access both
mbuf.vlan_tci & mbuf.vlan_tci_outer

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Hyong Youb Kim <hyonkim@cisco.com>
Cc: John Daley <johndale@cisco.com>
---
 app/test-pmd/rxonly.c        | 6 +++---
 doc/guides/nics/features.rst | 7 ++++---
 drivers/net/i40e/i40e_rxtx.c | 3 ++-
 lib/librte_mbuf/rte_mbuf.c   | 1 +
 lib/librte_mbuf/rte_mbuf.h   | 5 +++--
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index a93d80612..21b60062f 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -130,11 +130,11 @@ pkt_burst_receive(struct fwd_stream *fs)
 		}
 		if (ol_flags & PKT_RX_TIMESTAMP)
 			printf(" - timestamp %"PRIu64" ", mb->timestamp);
-		if (ol_flags & PKT_RX_VLAN_STRIPPED)
-			printf(" - VLAN tci=0x%x", mb->vlan_tci);
-		if (ol_flags & PKT_RX_QINQ_STRIPPED)
+		if (ol_flags & PKT_RX_QINQ)
 			printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
 					mb->vlan_tci, mb->vlan_tci_outer);
+		else if (ol_flags & PKT_RX_VLAN_STRIPPED)
+			printf(" - VLAN tci=0x%x", mb->vlan_tci);
 		if (mb->packet_type) {
 			rte_get_ptype_name(mb->packet_type, buf, sizeof(buf));
 			printf(" - hw ptype: %s", buf);
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index b085bda86..c0cbe3784 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -528,7 +528,7 @@ Supports VLAN offload to hardware.
 * **[uses]       rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_VLAN_STRIP,DEV_RX_OFFLOAD_VLAN_FILTER,DEV_RX_OFFLOAD_VLAN_EXTEND``.
 * **[uses]       rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_VLAN_INSERT``.
 * **[implements] eth_dev_ops**: ``vlan_offload_set``.
-* **[provides]   mbuf**: ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.vlan_tci``.
+* **[provides]   mbuf**: ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.ol_flags:PKT_RX_VLAN`` ``mbuf.vlan_tci``.
 * **[provides]   rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_VLAN_STRIP``,
   ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_VLAN_INSERT``.
 * **[related]    API**: ``rte_eth_dev_set_vlan_offload()``,
@@ -545,8 +545,9 @@ Supports QinQ (queue in queue) offload.
 * **[uses]     rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_QINQ_STRIP``.
 * **[uses]     rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_QINQ_INSERT``.
 * **[uses]     mbuf**: ``mbuf.ol_flags:PKT_TX_QINQ_PKT``.
-* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_QINQ_STRIPPED``, ``mbuf.vlan_tci``,
-   ``mbuf.vlan_tci_outer``.
+* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_QINQ_STRIPPED``, ``mbuf.ol_flags:PKT_RX_QINQ``,
+  ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.ol_flags:PKT_RX_VLAN``
+  ``mbuf.vlan_tci``, ``mbuf.vlan_tci_outer``.
 * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_QINQ_STRIP``,
   ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_QINQ_INSERT``.
 
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 7c986d535..b2819f757 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -83,7 +83,8 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union i40e_rx_desc *rxdp)
 #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.qword2.ext_status) &
 		(1 << I40E_RX_DESC_EXT_STATUS_L2TAG2P_SHIFT)) {
-		mb->ol_flags |= PKT_RX_QINQ_STRIPPED;
+		mb->ol_flags |= PKT_RX_QINQ_STRIPPED | PKT_RX_QINQ |
+			PKT_RX_VLAN_STRIPPED | PKT_RX_VLAN;
 		mb->vlan_tci_outer = mb->vlan_tci;
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.qword2.l2tag2_2);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2: %u",
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index e714c5a59..05a5a17fe 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -297,6 +297,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask)
 	case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP";
 	case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST";
 	case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED";
+	case PKT_RX_QINQ: return "PKT_RX_QINQ";
 	case PKT_RX_LRO: return "PKT_RX_LRO";
 	case PKT_RX_TIMESTAMP: return "PKT_RX_TIMESTAMP";
 	case PKT_RX_SEC_OFFLOAD: return "PKT_RX_SEC_OFFLOAD";
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a50b05c64..d018f19bd 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -140,7 +140,7 @@ extern "C" {
  * 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. If this flag is set,
+ * 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.
  */
@@ -170,7 +170,8 @@ extern "C" {
 
 /**
  * The RX packet is a double VLAN, and the outer tci has been
- * saved in in mbuf->vlan_tci_outer.
+ * 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.
  * If the flag PKT_RX_QINQ_STRIPPED is also present, both VLANs
  * headers have been stripped from mbuf data, else they are still
  * present.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v3] mbuf: clarify QINQ flag usage
  2018-10-02 11:36 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  2018-10-02 10:40   ` Andrew Rybchenko
@ 2018-10-03 15:19   ` Ferruh Yigit
  2018-10-09  8:59     ` Olivier Matz
  1 sibling, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2018-10-03 15:19 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic, Beilei Xing, Qi Zhang, Olivier Matz
  Cc: dev, Ferruh Yigit, Hyong Youb Kim, John Daley

Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
should be also set.

Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
should be set.

So that appllication can rely on PKT_RX_QINQ flag to access both
mbuf.vlan_tci & mbuf.vlan_tci_outer

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
Cc: Hyong Youb Kim <hyonkim@cisco.com>
Cc: John Daley <johndale@cisco.com>

v3:
* rebased
---
 app/test-pmd/rxonly.c        | 6 +++---
 doc/guides/nics/features.rst | 7 ++++---
 drivers/net/i40e/i40e_rxtx.c | 3 ++-
 lib/librte_mbuf/rte_mbuf.c   | 1 +
 lib/librte_mbuf/rte_mbuf.h   | 5 +++--
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index e8d226624..41db0ffb4 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -130,11 +130,11 @@ pkt_burst_receive(struct fwd_stream *fs)
 		}
 		if (ol_flags & PKT_RX_TIMESTAMP)
 			printf(" - timestamp %"PRIu64" ", mb->timestamp);
-		if (ol_flags & PKT_RX_VLAN)
-			printf(" - VLAN tci=0x%x", mb->vlan_tci);
-		if (ol_flags & PKT_RX_QINQ_STRIPPED)
+		if (ol_flags & PKT_RX_QINQ)
 			printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
 					mb->vlan_tci, mb->vlan_tci_outer);
+		else if (ol_flags & PKT_RX_VLAN)
+			printf(" - VLAN tci=0x%x", mb->vlan_tci);
 		if (mb->packet_type) {
 			rte_get_ptype_name(mb->packet_type, buf, sizeof(buf));
 			printf(" - hw ptype: %s", buf);
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index b085bda86..c0cbe3784 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -528,7 +528,7 @@ Supports VLAN offload to hardware.
 * **[uses]       rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_VLAN_STRIP,DEV_RX_OFFLOAD_VLAN_FILTER,DEV_RX_OFFLOAD_VLAN_EXTEND``.
 * **[uses]       rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_VLAN_INSERT``.
 * **[implements] eth_dev_ops**: ``vlan_offload_set``.
-* **[provides]   mbuf**: ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.vlan_tci``.
+* **[provides]   mbuf**: ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.ol_flags:PKT_RX_VLAN`` ``mbuf.vlan_tci``.
 * **[provides]   rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_VLAN_STRIP``,
   ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_VLAN_INSERT``.
 * **[related]    API**: ``rte_eth_dev_set_vlan_offload()``,
@@ -545,8 +545,9 @@ Supports QinQ (queue in queue) offload.
 * **[uses]     rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_QINQ_STRIP``.
 * **[uses]     rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_QINQ_INSERT``.
 * **[uses]     mbuf**: ``mbuf.ol_flags:PKT_TX_QINQ_PKT``.
-* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_QINQ_STRIPPED``, ``mbuf.vlan_tci``,
-   ``mbuf.vlan_tci_outer``.
+* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_QINQ_STRIPPED``, ``mbuf.ol_flags:PKT_RX_QINQ``,
+  ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.ol_flags:PKT_RX_VLAN``
+  ``mbuf.vlan_tci``, ``mbuf.vlan_tci_outer``.
 * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_QINQ_STRIP``,
   ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_QINQ_INSERT``.
 
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 7c986d535..b2819f757 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -83,7 +83,8 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union i40e_rx_desc *rxdp)
 #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.qword2.ext_status) &
 		(1 << I40E_RX_DESC_EXT_STATUS_L2TAG2P_SHIFT)) {
-		mb->ol_flags |= PKT_RX_QINQ_STRIPPED;
+		mb->ol_flags |= PKT_RX_QINQ_STRIPPED | PKT_RX_QINQ |
+			PKT_RX_VLAN_STRIPPED | PKT_RX_VLAN;
 		mb->vlan_tci_outer = mb->vlan_tci;
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.qword2.l2tag2_2);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2: %u",
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index e714c5a59..05a5a17fe 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -297,6 +297,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask)
 	case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP";
 	case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST";
 	case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED";
+	case PKT_RX_QINQ: return "PKT_RX_QINQ";
 	case PKT_RX_LRO: return "PKT_RX_LRO";
 	case PKT_RX_TIMESTAMP: return "PKT_RX_TIMESTAMP";
 	case PKT_RX_SEC_OFFLOAD: return "PKT_RX_SEC_OFFLOAD";
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a09377a60..da12b3209 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -140,7 +140,7 @@ extern "C" {
  * 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. If this flag is set,
+ * 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.
  */
@@ -170,7 +170,8 @@ extern "C" {
 
 /**
  * The RX packet is a double VLAN, and the outer tci has been
- * saved in in mbuf->vlan_tci_outer.
+ * 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.
  * If the flag PKT_RX_QINQ_STRIPPED is also present, both VLANs
  * headers have been stripped from mbuf data, else they are still
  * present.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v3] mbuf: clarify QINQ flag usage
  2018-10-03 15:19   ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
@ 2018-10-09  8:59     ` Olivier Matz
  2018-10-09  9:48       ` Ferruh Yigit
  0 siblings, 1 reply; 8+ messages in thread
From: Olivier Matz @ 2018-10-09  8:59 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic, Beilei Xing, Qi Zhang, dev, Hyong Youb Kim,
	John Daley

On Wed, Oct 03, 2018 at 04:19:12PM +0100, Ferruh Yigit wrote:
> Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
> set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
> should be also set.
> 
> Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
> should be set.
> 
> So that appllication can rely on PKT_RX_QINQ flag to access both
> mbuf.vlan_tci & mbuf.vlan_tci_outer
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v3] mbuf: clarify QINQ flag usage
  2018-10-09  8:59     ` Olivier Matz
@ 2018-10-09  9:48       ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2018-10-09  9:48 UTC (permalink / raw)
  To: Olivier Matz
  Cc: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic, Beilei Xing, Qi Zhang, dev, Hyong Youb Kim,
	John Daley

On 10/9/2018 9:59 AM, Olivier Matz wrote:
> On Wed, Oct 03, 2018 at 04:19:12PM +0100, Ferruh Yigit wrote:
>> Update implementation that when PKT_RX_QINQ_STRIPPED mbuf ol_flags
>> set by PMD, PKT_RX_QINQ, PKT_RX_VLAN_STRIPPED & PKT_RX_VLAN
>> should be also set.
>>
>> Clarify mbuf documentations that when PKT_RX_QINQ set PKT_RX_VLAN also
>> should be set.
>>
>> So that appllication can rely on PKT_RX_QINQ flag to access both
>> mbuf.vlan_tci & mbuf.vlan_tci_outer
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-09  9:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 10:17 [dpdk-dev] [PATCH] mbuf: clarify QINQ flag usage Ferruh Yigit
2018-10-02  9:44 ` Andrew Rybchenko
2018-10-02 10:08   ` Ferruh Yigit
2018-10-02 11:36 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2018-10-02 10:40   ` Andrew Rybchenko
2018-10-03 15:19   ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2018-10-09  8:59     ` Olivier Matz
2018-10-09  9:48       ` Ferruh Yigit

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).