Skip to content

Commit ef2383d

Browse files
IronShenkuba-moo
authored andcommitted
net: hns3: store rx VLAN tag offload state for VF
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: b2641e2 ("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>
1 parent c60e787 commit ef2383d

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,9 +1292,8 @@ static void hclgevf_sync_vlan_filter(struct hclgevf_dev *hdev)
12921292
rtnl_unlock();
12931293
}
12941294

1295-
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
1295+
static int hclgevf_en_hw_strip_rxvtag_cmd(struct hclgevf_dev *hdev, bool enable)
12961296
{
1297-
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
12981297
struct hclge_vf_to_pf_msg send_msg;
12991298

13001299
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
@@ -1303,6 +1302,19 @@ static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
13031302
return hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
13041303
}
13051304

1305+
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
1306+
{
1307+
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
1308+
int ret;
1309+
1310+
ret = hclgevf_en_hw_strip_rxvtag_cmd(hdev, enable);
1311+
if (ret)
1312+
return ret;
1313+
1314+
hdev->rxvtag_strip_en = enable;
1315+
return 0;
1316+
}
1317+
13061318
static int hclgevf_reset_tqp(struct hnae3_handle *handle)
13071319
{
13081320
#define HCLGEVF_RESET_ALL_QUEUE_DONE 1U
@@ -2204,12 +2216,13 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
22042216
tc_valid, tc_size);
22052217
}
22062218

2207-
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
2219+
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev,
2220+
bool rxvtag_strip_en)
22082221
{
22092222
struct hnae3_handle *nic = &hdev->nic;
22102223
int ret;
22112224

2212-
ret = hclgevf_en_hw_strip_rxvtag(nic, true);
2225+
ret = hclgevf_en_hw_strip_rxvtag(nic, rxvtag_strip_en);
22132226
if (ret) {
22142227
dev_err(&hdev->pdev->dev,
22152228
"failed to enable rx vlan offload, ret = %d\n", ret);
@@ -2879,7 +2892,7 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev)
28792892
if (ret)
28802893
return ret;
28812894

2882-
ret = hclgevf_init_vlan_config(hdev);
2895+
ret = hclgevf_init_vlan_config(hdev, hdev->rxvtag_strip_en);
28832896
if (ret) {
28842897
dev_err(&hdev->pdev->dev,
28852898
"failed(%d) to initialize VLAN config\n", ret);
@@ -2994,7 +3007,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
29943007
goto err_config;
29953008
}
29963009

2997-
ret = hclgevf_init_vlan_config(hdev);
3010+
ret = hclgevf_init_vlan_config(hdev, true);
29983011
if (ret) {
29993012
dev_err(&hdev->pdev->dev,
30003013
"failed(%d) to initialize VLAN config\n", ret);

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ struct hclgevf_dev {
253253
int *vector_irq;
254254

255255
bool gro_en;
256+
bool rxvtag_strip_en;
256257

257258
unsigned long vlan_del_fail_bmap[BITS_TO_LONGS(VLAN_N_VID)];
258259

0 commit comments

Comments
 (0)