Skip to content

Commit 3f28cc2

Browse files
IronShenjfvogel
authored andcommitted
net: hns3: store rx VLAN tag offload state for VF
[ 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: b2641e2 ("net: hns3: Add support of hardware rx-vlan-offload to HNS3 VF driver") Signed-off-by: Jian Shen <[email protected]> Signed-off-by: Jijie Shao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit d4cd7667311bd94bdc35736311f4f205ff94276d) Signed-off-by: Jack Vogel <[email protected]>
1 parent 37e2d7c commit 3f28cc2

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
@@ -1294,9 +1294,8 @@ static void hclgevf_sync_vlan_filter(struct hclgevf_dev *hdev)
12941294
rtnl_unlock();
12951295
}
12961296

1297-
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
1297+
static int hclgevf_en_hw_strip_rxvtag_cmd(struct hclgevf_dev *hdev, bool enable)
12981298
{
1299-
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
13001299
struct hclge_vf_to_pf_msg send_msg;
13011300

13021301
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
@@ -1305,6 +1304,19 @@ static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
13051304
return hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
13061305
}
13071306

1307+
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
1308+
{
1309+
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
1310+
int ret;
1311+
1312+
ret = hclgevf_en_hw_strip_rxvtag_cmd(hdev, enable);
1313+
if (ret)
1314+
return ret;
1315+
1316+
hdev->rxvtag_strip_en = enable;
1317+
return 0;
1318+
}
1319+
13081320
static int hclgevf_reset_tqp(struct hnae3_handle *handle)
13091321
{
13101322
#define HCLGEVF_RESET_ALL_QUEUE_DONE 1U
@@ -2206,12 +2218,13 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
22062218
tc_valid, tc_size);
22072219
}
22082220

2209-
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
2221+
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev,
2222+
bool rxvtag_strip_en)
22102223
{
22112224
struct hnae3_handle *nic = &hdev->nic;
22122225
int ret;
22132226

2214-
ret = hclgevf_en_hw_strip_rxvtag(nic, true);
2227+
ret = hclgevf_en_hw_strip_rxvtag(nic, rxvtag_strip_en);
22152228
if (ret) {
22162229
dev_err(&hdev->pdev->dev,
22172230
"failed to enable rx vlan offload, ret = %d\n", ret);
@@ -2881,7 +2894,7 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev)
28812894
if (ret)
28822895
return ret;
28832896

2884-
ret = hclgevf_init_vlan_config(hdev);
2897+
ret = hclgevf_init_vlan_config(hdev, hdev->rxvtag_strip_en);
28852898
if (ret) {
28862899
dev_err(&hdev->pdev->dev,
28872900
"failed(%d) to initialize VLAN config\n", ret);
@@ -2996,7 +3009,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
29963009
goto err_config;
29973010
}
29983011

2999-
ret = hclgevf_init_vlan_config(hdev);
3012+
ret = hclgevf_init_vlan_config(hdev, true);
30003013
if (ret) {
30013014
dev_err(&hdev->pdev->dev,
30023015
"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)