diff mbox series

[v3] net/i40e: issue with ADD VLAN from Guest

Message ID 20201215132815.15200-1-sodey@rbbn.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers show
Series [v3] net/i40e: issue with ADD VLAN from Guest | expand

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Dey, Souvik Dec. 15, 2020, 1:28 p.m. UTC
Reset the configuration of vlan strip that would be change
by the pf kernel driver when adding vlan from vf.
Application cannot use rte_eth_dev_set_vlan_offload() to set
the VLAN_STRIP, as this will only work for the first time when
original and current config mismatch, but for all subsequent call
it will be ignored.

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
v3:
* Changed the error log in case vlan strip command fails
as per the latest comment.
---
v2:
* Simplied the commit log.
* goto err; is not required as it has only one more return path
and there is no cleanup required apart from just return err.
* Updated the comment start from /* -> /**
* Changed the error log in case vlan strip command fails.
---

 drivers/net/i40e/i40e_ethdev_vf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Guo, Jia Dec. 16, 2020, 2:09 a.m. UTC | #1
Acked-by: Jeff Guo <jia.guo@intel.com<mailto:jia.guo@intel.com>>

From: Souvik Dey <sodey@rbbn.com>
Sent: Tuesday, December 15, 2020 9:28 PM
To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org; Souvik Dey <sodey@rbbn.com>
Subject: [PATCH v3] net/i40e: issue with ADD VLAN from Guest

Reset the configuration of vlan strip that would be change
by the pf kernel driver when adding vlan from vf.
Application cannot use rte_eth_dev_set_vlan_offload() to set
the VLAN_STRIP, as this will only work for the first time when
original and current config mismatch, but for all subsequent call
it will be ignored.

Signed-off-by: Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>
---
v3:
* Changed the error log in case vlan strip command fails
as per the latest comment.
---
v2:
* Simplied the commit log.
* goto err; is not required as it has only one more return path
and there is no cleanup required apart from just return err.
* Updated the comment start from /* -> /**
* Changed the error log in case vlan strip command fails.
---

drivers/net/i40e/i40e_ethdev_vf.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036..2faee1d 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1078,8 +1078,18 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
args.out_buffer = vf->aq_resp;
args.out_size = I40E_AQ_BUF_SZ;
err = i40evf_execute_vf_cmd(dev, &args);
- if (err)
+ if (err) {
PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+ return err;
+ }
+ /**
+ * In linux kernel driver on receiving ADD_VLAN it enables
+ * VLAN_STRIP by default. So reconfigure the vlan_offload
+ * as it was done by the app earlier.
+ */
+ err = i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
+ if (err)
+ PMD_DRV_LOG(ERR, "fail to set vlan_strip");

return err;
}
--
2.9.3.windows.1
Zhang, Qi Z Dec. 23, 2020, 10:51 a.m. UTC | #2
From: Guo, Jia <jia.guo@intel.com>
Sent: Wednesday, December 16, 2020 10:10 AM
To: Souvik Dey <sodey@rbbn.com>; Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org
Subject: RE: [PATCH v3] net/i40e: issue with ADD VLAN from Guest


Acked-by: Jeff Guo <jia.guo@intel.com<mailto:jia.guo@intel.com>>

From: Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>
Sent: Tuesday, December 15, 2020 9:28 PM
To: Xing, Beilei <beilei.xing@intel.com<mailto:beilei.xing@intel.com>>; Guo, Jia <jia.guo@intel.com<mailto:jia.guo@intel.com>>; Zhang, Qi Z <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com>>
Cc: dev@dpdk.org<mailto:dev@dpdk.org>; Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>
Subject: [PATCH v3] net/i40e: issue with ADD VLAN from Guest

Reset the configuration of vlan strip that would be change
by the pf kernel driver when adding vlan from vf.
Application cannot use rte_eth_dev_set_vlan_offload() to set
the VLAN_STRIP, as this will only work for the first time when
original and current config mismatch, but for all subsequent call
it will be ignored.

Signed-off-by: Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>
Applied to dpdk-next-net-intel

Thanks
Qi
Ferruh Yigit Jan. 4, 2021, 4:42 p.m. UTC | #3
On 12/16/2020 2:09 AM, Guo, Jia wrote:
> Acked-by: Jeff Guo <jia.guo@intel.com<mailto:jia.guo@intel.com>>
> 
> From: Souvik Dey <sodey@rbbn.com>
> Sent: Tuesday, December 15, 2020 9:28 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Souvik Dey <sodey@rbbn.com>
> Subject: [PATCH v3] net/i40e: issue with ADD VLAN from Guest
> 
> Reset the configuration of vlan strip that would be change
> by the pf kernel driver when adding vlan from vf.
> Application cannot use rte_eth_dev_set_vlan_offload() to set
> the VLAN_STRIP, as this will only work for the first time when
> original and current config mismatch, but for all subsequent call
> it will be ignored.
> 
> Signed-off-by: Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>

I suggest title: "net/i40e: fix VLAN stripping in VF"
Will update the title and some wording in the commit log while merging.

And I assume this should be backported, so will add stable@dpdk.org tag,
but can you please confirm the Linux PF behavior was always same?

And if the Linux PF behavior was always same, should we add the DPDK commit as 
fixes commit, @Qi, @Jeff, what do you think?

Other question is, does Linux PF and DPDK PF behave differently on enabling VLAN 
stripping and should it be unified to be consistent?
Guo, Jia Jan. 5, 2021, 3:07 a.m. UTC | #4
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, January 5, 2021 12:43 AM
> To: Guo, Jia <jia.guo@intel.com>; Souvik Dey <sodey@rbbn.com>; Xing,
> Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Kevin Traynor <ktraynor@redhat.com>; Luca Boccassi
> <bluca@debian.org>
> Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: issue with ADD VLAN from
> Guest
> 
> On 12/16/2020 2:09 AM, Guo, Jia wrote:
> > Acked-by: Jeff Guo <jia.guo@intel.com<mailto:jia.guo@intel.com>>
> >
> > From: Souvik Dey <sodey@rbbn.com>
> > Sent: Tuesday, December 15, 2020 9:28 PM
> > To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia
> > <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Souvik Dey <sodey@rbbn.com>
> > Subject: [PATCH v3] net/i40e: issue with ADD VLAN from Guest
> >
> > Reset the configuration of vlan strip that would be change by the pf
> > kernel driver when adding vlan from vf.
> > Application cannot use rte_eth_dev_set_vlan_offload() to set the
> > VLAN_STRIP, as this will only work for the first time when original
> > and current config mismatch, but for all subsequent call it will be
> > ignored.
> >
> > Signed-off-by: Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>
> 
> I suggest title: "net/i40e: fix VLAN stripping in VF"
> Will update the title and some wording in the commit log while merging.
> 
> And I assume this should be backported, so will add stable@dpdk.org tag,
> but can you please confirm the Linux PF behavior was always same?
> 
> And if the Linux PF behavior was always same, should we add the DPDK
> commit as fixes commit, @Qi, @Jeff, what do you think?
> 
> Other question is, does Linux PF and DPDK PF behave differently on enabling
> VLAN stripping and should it be unified to be consistent?

Yes, it does have different behave when enabling VLAN stripping in DPDK PF and Linux PF, and not always the same in linux PFs, but this patch set could be an workaround in DPDK PF for the compatibility.
Ferruh Yigit Jan. 5, 2021, 10:45 a.m. UTC | #5
On 1/5/2021 3:07 AM, Guo, Jia wrote:
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Tuesday, January 5, 2021 12:43 AM
>> To: Guo, Jia <jia.guo@intel.com>; Souvik Dey <sodey@rbbn.com>; Xing,
>> Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
>> Cc: dev@dpdk.org; Kevin Traynor <ktraynor@redhat.com>; Luca Boccassi
>> <bluca@debian.org>
>> Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: issue with ADD VLAN from
>> Guest
>>
>> On 12/16/2020 2:09 AM, Guo, Jia wrote:
>>> Acked-by: Jeff Guo <jia.guo@intel.com<mailto:jia.guo@intel.com>>
>>>
>>> From: Souvik Dey <sodey@rbbn.com>
>>> Sent: Tuesday, December 15, 2020 9:28 PM
>>> To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia
>>> <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
>>> Cc: dev@dpdk.org; Souvik Dey <sodey@rbbn.com>
>>> Subject: [PATCH v3] net/i40e: issue with ADD VLAN from Guest
>>>
>>> Reset the configuration of vlan strip that would be change by the pf
>>> kernel driver when adding vlan from vf.
>>> Application cannot use rte_eth_dev_set_vlan_offload() to set the
>>> VLAN_STRIP, as this will only work for the first time when original
>>> and current config mismatch, but for all subsequent call it will be
>>> ignored.
>>>
>>> Signed-off-by: Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>
>>
>> I suggest title: "net/i40e: fix VLAN stripping in VF"
>> Will update the title and some wording in the commit log while merging.
>>
>> And I assume this should be backported, so will add stable@dpdk.org tag,
>> but can you please confirm the Linux PF behavior was always same?
>>
>> And if the Linux PF behavior was always same, should we add the DPDK
>> commit as fixes commit, @Qi, @Jeff, what do you think?
>>
>> Other question is, does Linux PF and DPDK PF behave differently on enabling
>> VLAN stripping and should it be unified to be consistent?
> 
> Yes, it does have different behave when enabling VLAN stripping in DPDK PF and Linux PF, and not always the same in linux PFs, but this patch set could be an workaround in DPDK PF for the compatibility.
> 

OK, and since the patch is safe from Linux PF point of view, I will add 
following fixline, which is the initial DPDK code that adds VF VLAN add support:

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org

--
Thanks,
ferruh
diff mbox series

Patch

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036..2faee1d 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1078,8 +1078,18 @@  i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 	args.out_buffer = vf->aq_resp;
 	args.out_size = I40E_AQ_BUF_SZ;
 	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+		return err;
+	}
+	/**
+	 * In linux kernel driver on receiving ADD_VLAN it enables
+	 * VLAN_STRIP by default. So reconfigure the vlan_offload
+	 * as it was done by the app earlier.
+	 */
+	err = i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to set vlan_strip");
 
 	return err;
 }