net/i40e: issue with ADD VLAN from Guest
diff mbox series

Message ID
State Rejected
Delegated to: Qi Zhang
Headers show
  • net/i40e: issue with ADD VLAN from Guest
Related show


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

Commit Message

Dey, Souvik April 14, 2020, 11:06 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 check the state of the
DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and disable the vlan strip
after sending add_vlan if app configured the VLAN_STRIP as disabled.

Signed-off-by: Souvik Dey <>
 drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 244397e..d9c30be 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1044,6 +1044,7 @@  i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct virtchnl_vlan_filter_list *vlan_list;
+	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
 	int err;
@@ -1060,8 +1061,21 @@  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 disable it if app confifured
+	 * it that way.
+	 */
+	if (!(dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)) {
+		err = i40evf_disable_vlan_strip(dev);
+		if (err)
+			PMD_DRV_LOG(ERR, "fail to execute command disable_vlan_strip "
+				"as a part of OP_ADD_VLAN");
+	}
 	return err;