net/i40e: issue with ADD VLAN from Guest

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

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
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. 9, 2020, 5:55 p.m. UTC
  In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to reconfigure the vlan_offload, which
checks for DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and enables or
disables the vlan strip in the PF.
Also rte_eth_dev_set_vlan_offload() to disable VLAN_STRIP cannot be used
from the application, as this will only work for the first time when
original and current confi mismatch, but for all subsequent call it will
ignore it.

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Comments

Guo, Jia Dec. 11, 2020, 3:07 a.m. UTC | #1
hi, souvik

From: Souvik Dey <sodey@rbbn.com>
Sent: Thursday, December 10, 2020 1:55 AM
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] net/i40e: issue with ADD VLAN from Guest

In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to reconfigure the vlan_offload, which
checks for DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and enables or
disables the vlan strip in the PF.
Also rte_eth_dev_set_vlan_offload() to disable VLAN_STRIP cannot be used
from the application, as this will only work for the first time when
original and current confi mismatch, but for all subsequent call it will
ignore it.

Thanks for your patch and the clear detail interpret, what you said is reset the configuration about vlan strip that
would be change by the pf driver when adding vlan from vf, so I think concentrate<http://www.baidu.com/link?url=FKtXEQdgI9iuD4HN0uZIpf5hHCbYVGlPJx-jzQ-bGjXQiZutjIi6XT6rPlEoGfM13HvgvT9Gt88OAPmEKXNitp-rKK4k50M6di1HF4bDMxa&wd=&eqid=e7f451dc0001a611000000045fd2e0e1> the commit log to be more simple
in your way would be enough.

Signed-off-by: Souvik Dey <sodey@rbbn.com<mailto:sodey@rbbn.com>>
---
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..2ecf74b 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;

Would it be more code clean to use “goto err;”?

+ }
+ /*

/* -> /**, that would what I suggest.

+ * 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 execute command disable_vlan_strip "
+ "as a part of OP_ADD_VLAN");

If it is not coming as a command, please refine this log, such as “fail to set vlan strip.”


return err;
}
--
2.9.3.windows.1
  
Dey, Souvik Dec. 12, 2020, 12:26 p.m. UTC | #2
Hi Guo,
              Thanks for the comments. I will upload a v2 of the patch.

--
Regards,
Souvik

From: Guo, Jia <jia.guo@intel.com>
Sent: Thursday, December 10, 2020 10:08 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] 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..2ecf74b 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 execute command disable_vlan_strip "
+			"as a part of OP_ADD_VLAN");
 
 	return err;
 }