]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: hns3: store rx VLAN tag offload state for VF
authorJian Shen <shenjian15@huawei.com>
Wed, 30 Apr 2025 09:30:49 +0000 (17:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 May 2025 07:39:40 +0000 (09:39 +0200)
[ Upstream commit ef2383d078edcbe3055032436b16cdf206f26de2 ]

The VF driver missed to store the rx VLAN tag strip state when
user change the rx VLAN tag offload state. And it will default
to enable the rx vlan tag strip when re-init VF device after
reset. So if user disable rx VLAN tag offload, and trig reset,
then the HW will still strip the VLAN tag from packet nad fill
into RX BD, but the VF driver will ignore it for rx VLAN tag
offload disabled. It may cause the rx VLAN tag dropped.

Fixes: b2641e2ad456 ("net: hns3: Add support of hardware rx-vlan-offload to HNS3 VF driver")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250430093052.2400464-2-shaojijie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h

index 7bb01eafba74594acceab659a29309ef26c120bf..628d5c5ad75def43059d72fda98976f9d4bf9f7a 100644 (file)
@@ -1761,9 +1761,8 @@ static void hclgevf_sync_vlan_filter(struct hclgevf_dev *hdev)
        rtnl_unlock();
 }
 
-static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
+static int hclgevf_en_hw_strip_rxvtag_cmd(struct hclgevf_dev *hdev, bool enable)
 {
-       struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
        struct hclge_vf_to_pf_msg send_msg;
 
        hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
@@ -1772,6 +1771,19 @@ static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
        return hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
 }
 
+static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
+{
+       struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
+       int ret;
+
+       ret = hclgevf_en_hw_strip_rxvtag_cmd(hdev, enable);
+       if (ret)
+               return ret;
+
+       hdev->rxvtag_strip_en = enable;
+       return 0;
+}
+
 static int hclgevf_reset_tqp(struct hnae3_handle *handle)
 {
 #define HCLGEVF_RESET_ALL_QUEUE_DONE   1U
@@ -2684,12 +2696,13 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
        return hclgevf_set_rss_tc_mode(hdev, rss_cfg->rss_size);
 }
 
-static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
+static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev,
+                                   bool rxvtag_strip_en)
 {
        struct hnae3_handle *nic = &hdev->nic;
        int ret;
 
-       ret = hclgevf_en_hw_strip_rxvtag(nic, true);
+       ret = hclgevf_en_hw_strip_rxvtag(nic, rxvtag_strip_en);
        if (ret) {
                dev_err(&hdev->pdev->dev,
                        "failed to enable rx vlan offload, ret = %d\n", ret);
@@ -3359,7 +3372,7 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev)
        if (ret)
                return ret;
 
-       ret = hclgevf_init_vlan_config(hdev);
+       ret = hclgevf_init_vlan_config(hdev, hdev->rxvtag_strip_en);
        if (ret) {
                dev_err(&hdev->pdev->dev,
                        "failed(%d) to initialize VLAN config\n", ret);
@@ -3472,7 +3485,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
                goto err_config;
        }
 
-       ret = hclgevf_init_vlan_config(hdev);
+       ret = hclgevf_init_vlan_config(hdev, true);
        if (ret) {
                dev_err(&hdev->pdev->dev,
                        "failed(%d) to initialize VLAN config\n", ret);
index 2b216ac96914c913375a113ebd30aed47c543d83..a6468fe2ec326207dd7613e397266111359b1dba 100644 (file)
@@ -315,6 +315,7 @@ struct hclgevf_dev {
        int *vector_irq;
 
        bool gro_en;
+       bool rxvtag_strip_en;
 
        unsigned long vlan_del_fail_bmap[BITS_TO_LONGS(VLAN_N_VID)];