net/i40e: fix VLAN offload setting issue
authorBeilei Xing <beilei.xing@intel.com>
Fri, 8 Dec 2017 07:40:33 +0000 (15:40 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
When using kernel PF + DPDK VF, if setting VLAN strip on
or off in VF side after setting PVID for VF with ethtool in
PF side, it will cause VF Tx error. The root cause is that
Rx VLAN offload is not permitted after setting PVID for VF
in kernel PF side.
This patch fixes the issue by check VLAN offload capability
when setting VLAN offload.

Fixes: 5f0b95d59a98 ("net/i40e: support VLAN stripping for VF")
Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
drivers/net/i40e/i40e_ethdev_vf.c

index b96d77a..96370db 100644 (file)
@@ -1556,13 +1556,19 @@ static int
 i40evf_init_vlan(struct rte_eth_dev *dev)
 {
        /* Apply vlan offload setting */
-       return i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
+       i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
+
+       return 0;
 }
 
 static int
 i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 {
        struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+       struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+       if (!(vf->vf_res->vf_offload_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
+               return -ENOTSUP;
 
        /* Vlan stripping setting */
        if (mask & ETH_VLAN_STRIP_MASK) {