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

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

Checks

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

Commit Message

Dey, Souvik Dec. 12, 2020, 1:05 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>
---
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 | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Comments

Guo, Jia Dec. 15, 2020, 2:24 a.m. UTC | #1
From: Souvik Dey <sodey@rbbn.com>
Sent: Saturday, December 12, 2020 9:05 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 v2] 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>>
---
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 | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036..d3dbcb5 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1078,8 +1078,19 @@ 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 "
+ "as a part of OP_ADD_VLAN");

What I mean is that “PMD_DRV_LOG(ERR, "fail to set vlan strip");” is enough, since it will make the driver log to be
more simple. And also avoid a quoted string split across lines which let the second line could not hit your expectation.
Other look good, if no other comment, please add my ACK in your next version, thanks.

return err;
}
--
2.9.3.windows.1
  
Dey, Souvik Dec. 15, 2020, 1:16 p.m. UTC | #2
Hi Guo,

Ok sure will remove the extra log and submit the version 3. I have not received any other comments , so will also add your ACK in the next version then.

--
Regards,
Souvik

From: Guo, Jia <jia.guo@intel.com>
Sent: Monday, December 14, 2020 9:24 PM
To: Dey, Souvik <sodey@rbbn.com>; Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: dev@dpdk.org
Subject: RE: [PATCH v2] net/i40e: issue with ADD VLAN from Guest
  
Dey, Souvik Dec. 15, 2020, 1:30 p.m. UTC | #3
Hi Guo,
Raised the v3 of the patch , but was not sure how to put the ACK. If you don’t mind can you please ACK the same. Thanks.
https://patchwork.dpdk.org/patch/85210/

--
Regards,
Souvik

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

Hi Guo,

Ok sure will remove the extra log and submit the version 3. I have not received any other comments , so will also add your ACK in the next version then.

--
Regards,
Souvik

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

Patch

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036..d3dbcb5 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1078,8 +1078,19 @@  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 "
+			"as a part of OP_ADD_VLAN");
 
 	return err;
 }