Skip to contentSkip to conversation

app/testpmd: fix tx vlan and qinq insert enable

PATCH Superseded Nithin Kumar Dabilpuram 5 participants 19 messages Feb 19, 2019 – Apr 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix tx vlan and qinq insert enable

Tx VLAN & QinQ insert enable need not depend on Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD. Also enable DEV_TX_OFFLOAD_VLAN_INSERT for tx_qinq_set() as it takes both vlan id's.

---
 app/test-pmd/config.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
app/test-pmd/config.c +2 -13
index b9e5dd9..0243f07 100644
@@ -2955,7 +2955,6 @@ vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
 void
 tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
 		printf("Error: vlan insert is not supported by port %d\n",
@@ -2983,7 +2977,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 void
 tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -2993,11 +2986,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	if (vlan_id_is_invalid(vlan_id_outer))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (!(vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)) {
-		printf("Error, as QinQ hasn't been enabled.\n");
-		return;
-	}
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
 		printf("Error: qinq insert not supported by port %d\n",
@@ -3006,7 +2994,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT;
+	ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT |
+						    DEV_TX_OFFLOAD_QINQ_INSERT);
 	ports[port_id].tx_vlan_id = vlan_id;
 	ports[port_id].tx_vlan_id_outer = vlan_id_outer;
 }
Signature · 1 line
2.8.4
#1 lore raw
Quoted 2 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

+1

Quoted 3 lines

Also enable
DEV_TX_OFFLOAD_VLAN_INSERT for tx_qinq_set() as it takes both vlan id's.

+1

Technically two different but related fix, should it be two separate patches, what do you think?

Quoted 19 lines
---
 app/test-pmd/config.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
app/test-pmd/config.c +0 -1
index b9e5dd9..0243f07 100644
@@ -2955,7 +2955,6 @@ vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
 void
 tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 8 lines
app/test-pmd/config.c +0 -5
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

Here I think intention is if QINQ is enabled 'tx_vlan_id' & 'tx_vlan_id_outer' should be set by tx_qinq_set() not 'tx_vlan_set', and check is for that.

What do you think keeping same logic?
But of course check should be if 'ports[port_id].dev_conf.txmode.offloads' has 'DEV_TX_OFFLOAD_QINQ_INSERT' instead of above check.

Quoted 34 lines
app/test-pmd/config.c +2 -7
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
 		printf("Error: vlan insert is not supported by port %d\n",
@@ -2983,7 +2977,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 void
 tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -2993,11 +2986,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	if (vlan_id_is_invalid(vlan_id_outer))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (!(vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)) {
-		printf("Error, as QinQ hasn't been enabled.\n");
-		return;
-	}
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
 		printf("Error: qinq insert not supported by port %d\n",
@@ -3006,7 +2994,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT;
+	ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT |
+						    DEV_TX_OFFLOAD_QINQ_INSERT);
 	ports[port_id].tx_vlan_id = vlan_id;
 	ports[port_id].tx_vlan_id_outer = vlan_id_outer;
 }
#2 lore raw

PATCH v2 1/2 app/testpmd: fix tx vlan and qinq dependency

In reply to Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx VLAN")

---
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 12 ------------
 1 file changed, 12 deletions(-)
app/test-pmd/config.c +0 -12
index b9e5dd9..f800503 100644
@@ -2955,7 +2955,6 @@ vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
 void
 tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
 		printf("Error: vlan insert is not supported by port %d\n",
@@ -2983,7 +2977,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 void
 tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -2993,11 +2986,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	if (vlan_id_is_invalid(vlan_id_outer))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (!(vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)) {
-		printf("Error, as QinQ hasn't been enabled.\n");
-		return;
-	}
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
 		printf("Error: qinq insert not supported by port %d\n",
Signature · 1 line
2.8.4
#3 lore raw

PATCH v2 2/2 app/testpmd: fix tx qinq insert enable

Enable DEV_TX_OFFLOAD_VLAN_INSERT also along with DEV_TX_OFFLOAD_VLAN_QINQ in tx_qinq_set() as it takes both vlan id's as arguments.

Fixes 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")

---
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-pmd/config.c +2 -1
index f800503..0243f07 100644
@@ -2994,7 +2994,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT;
+	ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT |
+						    DEV_TX_OFFLOAD_QINQ_INSERT);
 	ports[port_id].tx_vlan_id = vlan_id;
 	ports[port_id].tx_vlan_id_outer = vlan_id_outer;
 }
Signature · 1 line
2.8.4
Acked-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] app/testpmd: fix tx qinq insert enable

Hi Nithin

<snip>

Quoted 2 lines

Subject: [PATCH v2 2/2] app/testpmd: fix tx qinq insert enable

./dpdk/devtools/check-git-log.sh -1
Wrong headline lowercase:
app/testpmd: fix tx qinq insert enable

The commit line does not seem correct as it is actually fixing the tx_qinq_set() function.

Otherwise

Quoted 34 lines

Enable DEV_TX_OFFLOAD_VLAN_INSERT also along with DEV_TX_OFFLOAD_VLAN_QINQ in tx_qinq_set() as it takes both vlan id's as arguments.

Fixes 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")

---
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-pmd/config.c index renamed from app/test-pmd/config.c +0 -0

f800503..0243f07 100644

app/test-pmd/config.c +1 -1
@@ -2994,7 +2994,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id,
 uint16_t vlan_id_outer)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].dev_conf.txmode.offloads |=
 DEV_TX_OFFLOAD_QINQ_INSERT;
+	ports[port_id].dev_conf.txmode.offloads |=

(DEV_TX_OFFLOAD_VLAN_INSERT |
+
DEV_TX_OFFLOAD_QINQ_INSERT);

app/test-pmd/config.c +0 -1
 	ports[port_id].tx_vlan_id = vlan_id;
 	ports[port_id].tx_vlan_id_outer = vlan_id_outer;  }
--

2.8.4

#5 lore raw

Re: [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

In reply to Nithin Kumar Dabilpuram
Quoted 7 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx VLAN")

<...>

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 9 lines
app/test-pmd/config.c +0 -5
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

It looks like you didn't take account comment on this in previous version, can you please check it?

#6 lore raw

Re: [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

Hi Nithin

Quoted 26 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, March 21, 2019 5:11 PM
To: Nithin Kumar Dabilpuram <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

Quoted 8 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx

VLAN")
Cc: [email protected]

<...>

Quoted 4 lines
app/test-pmd/config.c +0 -0
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
Quoted 8 lines

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 5 lines
app/test-pmd/config.c +0 -5
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

It looks like you didn't take account comment on this in previous version, can you please check it?

./dpdk/devtools/check-git-log.sh -1
Wrong headline lowercase:
app/testpmd: fix tx vlan and qinq dependency

otherwise

#7 lore raw

Re: [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

Hi Nithin,

<snip>

Quoted 32 lines
Quoted 23 lines

To: Nithin Kumar Dabilpuram <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

Quoted 8 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx

VLAN")
Cc: [email protected]

<...>

Quoted 4 lines
app/test-pmd/config.c +0 -0
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
Quoted 8 lines

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 5 lines
app/test-pmd/config.c +0 -5
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

It looks like you didn't take account comment on this in previous version, can you please check it?

Quoted 6 lines

./dpdk/devtools/check-git-log.sh -1
Wrong headline lowercase:
app/testpmd: fix tx vlan and qinq dependency

otherwise

Please drop my ack until the comment on the v1 patch is addressed.

#8 lore raw

Re: [EXT] Re: [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

In reply to Ferruh Yigit

Hi Ferruh Yigit,

Sorry, missed to see your inline comment about the check in v1.

Quoted 13 lines

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 9 lines

@@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)

app/test-pmd/config.c +0 -5
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

Here I think intention is if QINQ is enabled 'tx_vlan_id' & 'tx_vlan_id_outer' should be set by tx_qinq_set() not 'tx_vlan_set', and check is for that.

Quoted 2 lines

What do you think keeping same logic?
But of course check should be if 'ports[port_id].dev_conf.txmode.offloads' has 'DEV_TX_OFFLOAD_QINQ_INSERT' instead of above check.

Since tx_vlan_set() and tx_qinq_set() are they themselves are resetting/setting those flags in 'ports[port_id].dev_conf.txmode.offloads', do you think having such a check before clearing and setting flags be consistent ?
Current behavior is to override last setting with new setting. All the settings could be completely disabled by cmdline "tx vlan reset"

--
Thanks
Nithin

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 21, 2019 10:41 PM
To: Nithin Kumar Dabilpuram <[email protected]>; Wenzhuo Lu <[email protected]>; Jingjing Wu <[email protected]>; Bernard Iremonger <[email protected]>
Cc: [email protected]; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

External Email

----------------------------------------------------------------------

Quoted 8 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx

VLAN")
Cc: [email protected]

<...>

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 9 lines
app/test-pmd/config.c +0 -5
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

It looks like you didn't take account comment on this in previous version, can you please check it?

#9 lore raw

Re: [EXT] Re: [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

Quoted 17 lines · Nithin Kumar Dabilpuram

Hi Ferruh Yigit,

Sorry, missed to see your inline comment about the check in v1.

Quoted 12 lines

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 9 lines

@@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)

app/test-pmd/config.c +0 -5
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

Here I think intention is if QINQ is enabled 'tx_vlan_id' & 'tx_vlan_id_outer' should be set by tx_qinq_set() not 'tx_vlan_set', and check is for that.

Quoted 6 lines
Quoted 2 lines

What do you think keeping same logic?
But of course check should be if 'ports[port_id].dev_conf.txmode.offloads' has 'DEV_TX_OFFLOAD_QINQ_INSERT' instead of above check.

Since tx_vlan_set() and tx_qinq_set() are they themselves are resetting/setting those flags in 'ports[port_id].dev_conf.txmode.offloads', do you think having such a check before clearing and setting flags be consistent ?
Current behavior is to override last setting with new setting. All the settings could be completely disabled by cmdline "tx vlan reset"

When QINQ offload is enabled:
'vlan_id' & 'vlan_id_outer' should be set together via 'tx_qinq_set()' This is "tx_vlan set <port_id> <vlan_id> <outer_vlan_id>" command

When VLAN offload is enabled:
'vlan_id' should be set via 'tx_vlan_set()' This is "tx_vlan set <port_id> <vlan_id>" command

basically, the check above is to prevent to setting only 'vlan_id' once both "<vlan_id> <outer_vlan_id>" set.

I don't know the main reason of the intention of current implementation, I assume it is to help user to prevent make mistake.

This patch is to prevent 'ETH_VLAN_EXTEND_OFFLOAD' dependency, I believe it makes sense.

But my concern this patch is also changing above intention silently, and if we should keep the intention?

If you think that QINQ protection is also should removed, that is OK, only please make it separate patch with describing the impact.

Thanks,
ferruh

Quoted 41 lines

--
Thanks
Nithin

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 21, 2019 10:41 PM
To: Nithin Kumar Dabilpuram <[email protected]>; Wenzhuo Lu <[email protected]>; Jingjing Wu <[email protected]>; Bernard Iremonger <[email protected]>
Cc: [email protected]; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

External Email

----------------------------------------------------------------------

Quoted 8 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx

VLAN")
Cc: [email protected]

<...>

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 9 lines
app/test-pmd/config.c +0 -5
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

It looks like you didn't take account comment on this in previous version, can you please check it?

#10 lore raw

Re: [EXT] Re: [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

Hi,

Quoted 57 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, April 2, 2019 3:10 AM
To: Nithin Kumar Dabilpuram <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

Quoted 19 lines · Nithin Kumar Dabilpuram

Hi Ferruh Yigit,

Sorry, missed to see your inline comment about the check in v1.

Quoted 15 lines

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 9 lines

@@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)

app/test-pmd/config.c +0 -5
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

Here I think intention is if QINQ is enabled 'tx_vlan_id' & 'tx_vlan_id_outer' should be set by tx_qinq_set() not 'tx_vlan_set', and check is for that.

What do you think keeping same logic?
But of course check should be if 'ports[port_id].dev_conf.txmode.offloads'

has 'DEV_TX_OFFLOAD_QINQ_INSERT' instead of above check.

Quoted 2 lines

Since tx_vlan_set() and tx_qinq_set() are they themselves are

resetting/setting those flags in 'ports[port_id].dev_conf.txmode.offloads',

Quoted 1 line

do you think having such a check before clearing and setting flags be

consistent ?

Quoted 1 line

Current behavior is to override last setting with new setting. All the settings

could be completely disabled by cmdline "tx vlan reset"

When QINQ offload is enabled:
'vlan_id' & 'vlan_id_outer' should be set together via 'tx_qinq_set()' This is "tx_vlan set <port_id> <vlan_id> <outer_vlan_id>" command

When VLAN offload is enabled:
'vlan_id' should be set via 'tx_vlan_set()' This is "tx_vlan set <port_id> <vlan_id>" command

basically, the check above is to prevent to setting only 'vlan_id' once both "<vlan_id> <outer_vlan_id>" set.

I don't know the main reason of the intention of current implementation, I assume it is to help user to prevent make mistake.

This patch is to prevent 'ETH_VLAN_EXTEND_OFFLOAD' dependency, I believe it
makes sense.

Quoted 8 lines

But my concern this patch is also changing above intention silently, and if we should keep the intention?

If you think that QINQ protection is also should removed, that is OK, only please make it separate patch with describing the impact.

Thanks,
Ferruh

Yes, it makes sense to remove the 'ETH_VLAN_EXTEND_OFFLOAD' dependency for VLAN/QINQ insertion. It's the 92ebda07ee58 ("app/testpmd: add qinq stripping and insertion") that introduced this logic, 6a34f91690d0 ("app/testpmd: fix error message when setting Tx VLAN") fixed the port id check issue.

I think the original intention is to avoid mixing up VLAN insertion and QINQ insertion, since both are changing the vlan_id. If user set QINQ first and then changes to just VLAN insertion, but he/she gets no warning about QINQ config still exists. From this point of view, VLAN insertion and QINQ insertion should be mutual exclusive.

And like Ferruh said, this check should be like: if (ports[port_id].dev_conf.txmode.offloads & DEV_TX_OFFLOAD_QINQ_INSERT)

Thanks,
Xiao

Quoted 46 lines
Quoted 8 lines

--
Thanks
Nithin

Quoted 4 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 21, 2019 10:41 PM
To: Nithin Kumar Dabilpuram <[email protected]>; Wenzhuo Lu

<[email protected]>; Jingjing Wu <[email protected]>; Bernard Iremonger <[email protected]>

Quoted 2 lines

Cc: [email protected]; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and

qinq dependency

Quoted 20 lines

External Email

----------------------------------------------------------------------

Quoted 8 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx

VLAN")
Cc: [email protected]

<...>

Quoted 4 lines
app/test-pmd/config.c +0 -0
@@ -2963,11 +2962,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
Quoted 7 lines

app/test-pmd/config.c tx_vlan_set(portid_t port_id, uint16_t vlan_id) · line 2970

Quoted 5 lines
app/test-pmd/config.c +0 -5
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
-		printf("Error, as QinQ has been enabled.\n");
-		return;
-	}

It looks like you didn't take account comment on this in previous version, can

you please check it?

Quoted 1 line
#11 lore raw

PATCH v3 1/2 app/testpmd: fix Tx VLAN and QinQ dependency

In reply to Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD. For Tx VLAN insert enable, error check is now to see if QinQ was enabled but only single VLAN id is set.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx VLAN")

---
v3:
* Add back error check in tx_vlan_set() to check if QinQ is already enabled. Also fix headline.
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
app/test-pmd/config.c +2 -9
index cadcb51..010e26d 100644
@@ -2962,7 +2962,6 @@ vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
 void
 tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -2970,8 +2969,8 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
+	if (ports[port_id].dev_conf.txmode.offloads &
+	    DEV_TX_OFFLOAD_QINQ_INSERT) {
 		printf("Error, as QinQ has been enabled.\n");
 		return;
 	}
@@ -2990,7 +2989,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 void
 tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -3000,11 +2998,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	if (vlan_id_is_invalid(vlan_id_outer))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (!(vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)) {
-		printf("Error, as QinQ hasn't been enabled.\n");
-		return;
-	}
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
 		printf("Error: qinq insert not supported by port %d\n",
Signature · 1 line
2.8.4
#12 lore raw

PATCH v3 2/2 app/testpmd: fix Tx QinQ set

Enable DEV_TX_OFFLOAD_VLAN_INSERT also along with DEV_TX_OFFLOAD_VLAN_QINQ in tx_qinq_set() as it takes both vlan id's as arguments.

Fixes 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")

---

v3:
* Rename headline
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-pmd/config.c +2 -1
index 010e26d..f9cb129 100644
@@ -3006,7 +3006,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT;
+	ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT |
+						    DEV_TX_OFFLOAD_QINQ_INSERT);
 	ports[port_id].tx_vlan_id = vlan_id;
 	ports[port_id].tx_vlan_id_outer = vlan_id_outer;
 }
Signature · 1 line
2.8.4
Acked-by Bernard Iremonger Reviewed-by on v3 1/2
#13 lore raw

Re: [dpdk-dev] [PATCH v3 1/2] app/testpmd: fix Tx VLAN and QinQ dependency

In reply to Nithin Kumar Dabilpuram
Quoted 9 lines · Nithin Kumar Dabilpuram

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD. For Tx VLAN insert enable, error check is now to see if QinQ was enabled but only single VLAN id is set.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx VLAN")

for series carried from prev version:

for series,

Series applied to dpdk-next-net/master, thanks.

#14 lore raw

PATCH v4 1/2 app/testpmd: fix Tx VLAN and QinQ dependency

In reply to Nithin Kumar Dabilpuram

From: Nithin Dabilpuram <[email protected]>

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD. For Tx VLAN insert enable, error check is now to see if QinQ was enabled but only single VLAN id is set.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx VLAN")

---
v4:
* Resend v3 from different mailserver to avoid CRLF
v3:
* Add back error check in tx_vlan_set() to check if QinQ is already enabled. Also fix headline.
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
app/test-pmd/config.c +2 -9
index cadcb51..010e26d 100644
@@ -2962,7 +2962,6 @@ vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
 void
 tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -2970,8 +2969,8 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	if (vlan_id_is_invalid(vlan_id))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) {
+	if (ports[port_id].dev_conf.txmode.offloads &
+	    DEV_TX_OFFLOAD_QINQ_INSERT) {
 		printf("Error, as QinQ has been enabled.\n");
 		return;
 	}
@@ -2990,7 +2989,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 void
 tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 {
-	int vlan_offload;
 	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -3000,11 +2998,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	if (vlan_id_is_invalid(vlan_id_outer))
 		return;
 
-	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
-	if (!(vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)) {
-		printf("Error, as QinQ hasn't been enabled.\n");
-		return;
-	}
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
 		printf("Error: qinq insert not supported by port %d\n",
Signature · 1 line
2.8.4
#15 lore raw

PATCH v4 2/2 app/testpmd: fix Tx QinQ set

From: Nithin Dabilpuram <[email protected]>

Enable DEV_TX_OFFLOAD_VLAN_INSERT also along with DEV_TX_OFFLOAD_VLAN_QINQ in tx_qinq_set() as it takes both vlan id's as arguments.

Fixes 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")

---
v4:
* Resend v3 from different mailserver to avoid CRLF
v3:
* Rename headline
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-pmd/config.c +2 -1
index 010e26d..f9cb129 100644
@@ -3006,7 +3006,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT;
+	ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT |
+						    DEV_TX_OFFLOAD_QINQ_INSERT);
 	ports[port_id].tx_vlan_id = vlan_id;
 	ports[port_id].tx_vlan_id_outer = vlan_id_outer;
 }
Signature · 1 line
2.8.4
#16 lore raw

Re: [dpdk-dev] [PATCH v4 1/2] app/testpmd: fix Tx VLAN and QinQ dependency

In reply to Nithin Dabilpuram
Quoted 12 lines · Nithin Dabilpuram

From: Nithin Dabilpuram <[email protected]>

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD. For Tx VLAN insert enable, error check is now to see if QinQ was enabled but only single VLAN id is set.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx VLAN")
Quoted 10 lines

---
v4:
* Resend v3 from different mailserver to avoid CRLF
v3:
* Add back error check in tx_vlan_set() to check if QinQ is already enabled. Also fix headline.
v2:
* Split change into two seperate patches as suggested.

Hi Nithin,

I just merged the v3 and about to send the mail :)

What is different in v4? avoid CRLF?

#17 lore raw

Re: [dpdk-dev] [PATCH v4 1/2] app/testpmd: fix Tx VLAN and QinQ dependency

Hi Ferruh,

Yes, our mail server had some issue and was inserting CRLF chars. So I sent the same v3 as v4 from gmail.

Thanks
Nithin

Quoted 32 lines · Ferruh Yigit
Quoted 8 lines · Nithin Dabilpuram

From: Nithin Dabilpuram <[email protected]>

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD. For Tx VLAN insert enable, error check is now to see if QinQ was enabled but only single VLAN id is set.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx

VLAN")

Quoted 4 lines
Quoted 10 lines

---
v4:
* Resend v3 from different mailserver to avoid CRLF
v3:
* Add back error check in tx_vlan_set() to check if QinQ is already enabled. Also fix headline.
v2:
* Split change into two seperate patches as suggested.

Hi Nithin,

I just merged the v3 and about to send the mail :)

What is different in v4? avoid CRLF?

#18 lore raw

Re: [dpdk-dev] [PATCH v4 1/2] app/testpmd: fix Tx VLAN and QinQ dependency

Quoted 4 lines · Nithin Kumar D

Hi Ferruh,

Yes, our mail server had some issue and was inserting CRLF chars. So I sent the same v3 as v4 from gmail.

If the content is same I will continue with v3, thanks.

Quoted 38 lines

Thanks
Nithin

Quoted 32 lines · Ferruh Yigit
Quoted 8 lines · Nithin Dabilpuram

From: Nithin Dabilpuram <[email protected]>

Tx VLAN & QinQ insert enable need not depend on
Rx VLAN offload ETH_VLAN_EXTEND_OFFLOAD. For Tx VLAN insert enable, error check is now to see if QinQ was enabled but only single VLAN id is set.

Fixes 6a34f91690d0 ("app/testpmd: fix error message when setting Tx

VLAN")

Quoted 4 lines
Quoted 10 lines

---
v4:
* Resend v3 from different mailserver to avoid CRLF
v3:
* Add back error check in tx_vlan_set() to check if QinQ is already enabled. Also fix headline.
v2:
* Split change into two seperate patches as suggested.

Hi Nithin,

I just merged the v3 and about to send the mail :)

What is different in v4? avoid CRLF?