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

Message ID 20190318095613.28167-1-ndabilpuram@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2,1/2] app/testpmd: fix tx vlan and qinq dependency |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Nithin Dabilpuram March 18, 2019, 9:56 a.m. UTC
  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: xiao.w.wang@intel.com

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v2:
* Split change into two seperate patches as suggested.

 app/test-pmd/config.c | 12 ------------
 1 file changed, 12 deletions(-)
  

Comments

Ferruh Yigit March 21, 2019, 5:11 p.m. UTC | #1
On 3/18/2019 9:56 AM, Nithin Kumar Dabilpuram wrote:
> 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: xiao.w.wang@intel.com
> 
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>

<...>

> @@ -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?
  
Iremonger, Bernard March 26, 2019, 5:33 p.m. UTC | #2
Hi Nithin

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Thursday, March 21, 2019 5:11 PM
> To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Iremonger,
> Bernard <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq
> dependency
> 
> On 3/18/2019 9:56 AM, Nithin Kumar Dabilpuram wrote:
> > 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: xiao.w.wang@intel.com
> >
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> <...>
> 
> > @@ -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?

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

otherwise 
acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
  
Iremonger, Bernard March 27, 2019, 9:52 a.m. UTC | #3
Hi Nithin,

<snip>

> > To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Lu, Wenzhuo
> > <wenzhuo.lu@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> > Iremonger, Bernard <bernard.iremonger@intel.com>
> > Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and
> > qinq dependency
> >
> > On 3/18/2019 9:56 AM, Nithin Kumar Dabilpuram wrote:
> > > 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: xiao.w.wang@intel.com
> > >
> > > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >
> > <...>
> >
> > > @@ -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?
> 
> ./dpdk/devtools/check-git-log.sh -1
> Wrong headline lowercase:
>         app/testpmd: fix tx vlan and qinq dependency
> 
> otherwise
> acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

Please drop my ack until the comment on the v1 patch is addressed.
  
Nithin Dabilpuram March 31, 2019, 6:58 p.m. UTC | #4
Hi Ferruh Yigit,

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

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

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 <ferruh.yigit@intel.com> 
Sent: Thursday, March 21, 2019 10:41 PM
To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Wenzhuo Lu <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>; Bernard Iremonger <bernard.iremonger@intel.com>
Cc: dev@dpdk.org; xiao.w.wang@intel.com
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency

External Email

----------------------------------------------------------------------
On 3/18/2019 9:56 AM, Nithin Kumar Dabilpuram wrote:
> 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: xiao.w.wang@intel.com
> 
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>

<...>

> @@ -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?
  
Ferruh Yigit April 1, 2019, 7:10 p.m. UTC | #5
On 3/31/2019 7:58 PM, Nithin Kumar Dabilpuram wrote:
> Hi Ferruh Yigit,
> 
> Sorry, missed to see your inline comment about the check in v1.
> 
>>> @@ 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.
> 
> 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

> 
> --
> Thanks
> Nithin
> 
> 
> 
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com> 
> Sent: Thursday, March 21, 2019 10:41 PM
> To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Wenzhuo Lu <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>; Bernard Iremonger <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; xiao.w.wang@intel.com
> Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and qinq dependency
> 
> External Email
> 
> ----------------------------------------------------------------------
> On 3/18/2019 9:56 AM, Nithin Kumar Dabilpuram wrote:
>> 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: xiao.w.wang@intel.com
>>
>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> <...>
> 
>> @@ -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?
>
  
Xiao Wang April 2, 2019, 2:35 a.m. UTC | #6
Hi,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, April 2, 2019 3:10 AM
> To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Iremonger,
> Bernard <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and
> qinq dependency
> 
> On 3/31/2019 7:58 PM, Nithin Kumar Dabilpuram wrote:
> > Hi Ferruh Yigit,
> >
> > Sorry, missed to see your inline comment about the check in v1.
> >
> >>> @@ 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.
> >
> > 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

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

> 
> >
> > --
> > Thanks
> > Nithin
> >
> >
> >
> > -----Original Message-----
> > From: Ferruh Yigit <ferruh.yigit@intel.com>
> > Sent: Thursday, March 21, 2019 10:41 PM
> > To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Wenzhuo Lu
> <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>; Bernard
> Iremonger <bernard.iremonger@intel.com>
> > Cc: dev@dpdk.org; xiao.w.wang@intel.com
> > Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix tx vlan and
> qinq dependency
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> > On 3/18/2019 9:56 AM, Nithin Kumar Dabilpuram wrote:
> >> 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: xiao.w.wang@intel.com
> >>
> >> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >
> > <...>
> >
> >> @@ -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?
> >
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b9e5dd9..f800503 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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",