]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: hns3: fix rx VLAN offload state inconsistent issue
authorJian Shen <shenjian15@huawei.com>
Mon, 19 Jul 2021 09:13:08 +0000 (17:13 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 20 Jul 2021 11:12:50 +0000 (13:12 +0200)
Currently, VF doesn't enable rx VLAN offload when initializating,
and PF does it for VFs. If user disable the rx VLAN offload for
VF with ethtool -K, and reload the VF driver, it may cause the
rx VLAN offload state being inconsistent between hardware and
software.

Fixes it by enabling rx VLAN offload when VF initializing.

Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index 52eaf82b7cd71d91d1b28f20f58d81d71dc0f280..8784d61e833f15a98777a13a49f308a8169f24e0 100644 (file)
@@ -2641,6 +2641,16 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
 
 static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
 {
+       struct hnae3_handle *nic = &hdev->nic;
+       int ret;
+
+       ret = hclgevf_en_hw_strip_rxvtag(nic, true);
+       if (ret) {
+               dev_err(&hdev->pdev->dev,
+                       "failed to enable rx vlan offload, ret = %d\n", ret);
+               return ret;
+       }
+
        return hclgevf_set_vlan_filter(&hdev->nic, htons(ETH_P_8021Q), 0,
                                       false);
 }