Skip to content

Commit 190cd8a

Browse files
IronShenkuba-moo
authored andcommitted
net: hns3: refine the process when PF set VF VLAN
Currently, when PF set VF VLAN, it sends notify mailbox to VF if VF alive. VF stop its traffic, and send request mailbox to PF, then PF updates VF VLAN. It's a bit complex. If VF is killed before sending request, PF will not set VF VLAN without any log. This patch refines the process, PF can set VF VLAN direclty, and then notify the VF. If VF is resetting at that time, the notify may be dropped, so VF should query it after reset finished. Fixes: 92f11ea ("net: hns3: fix set port based VLAN issue for VF") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1932a62 commit 190cd8a

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8993,11 +8993,16 @@ static int hclge_set_vf_mac(struct hnae3_handle *handle, int vf,
89938993

89948994
ether_addr_copy(vport->vf_info.mac, mac_addr);
89958995

8996+
/* there is a timewindow for PF to know VF unalive, it may
8997+
* cause send mailbox fail, but it doesn't matter, VF will
8998+
* query it when reinit.
8999+
*/
89969000
if (test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) {
89979001
dev_info(&hdev->pdev->dev,
89989002
"MAC of VF %d has been set to %s, and it will be reinitialized!\n",
89999003
vf, format_mac_addr);
9000-
return hclge_inform_reset_assert_to_vf(vport);
9004+
(void)hclge_inform_reset_assert_to_vf(vport);
9005+
return 0;
90019006
}
90029007

90039008
dev_info(&hdev->pdev->dev, "MAC of VF %d has been set to %s\n",
@@ -10250,14 +10255,17 @@ static int hclge_set_vf_vlan_filter(struct hnae3_handle *handle, int vfid,
1025010255
return ret;
1025110256
}
1025210257

10253-
/* for DEVICE_VERSION_V3, vf doesn't need to know about the port based
10258+
/* there is a timewindow for PF to know VF unalive, it may
10259+
* cause send mailbox fail, but it doesn't matter, VF will
10260+
* query it when reinit.
10261+
* for DEVICE_VERSION_V3, vf doesn't need to know about the port based
1025410262
* VLAN state.
1025510263
*/
1025610264
if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V3 &&
1025710265
test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state))
10258-
hclge_push_vf_port_base_vlan_info(&hdev->vport[0],
10259-
vport->vport_id, state,
10260-
&vlan_info);
10266+
(void)hclge_push_vf_port_base_vlan_info(&hdev->vport[0],
10267+
vport->vport_id,
10268+
state, &vlan_info);
1026110269

1026210270
return 0;
1026310271
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,6 +2862,11 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev)
28622862
return ret;
28632863
}
28642864

2865+
/* get current port based vlan state from PF */
2866+
ret = hclgevf_get_port_base_vlan_filter_state(hdev);
2867+
if (ret)
2868+
return ret;
2869+
28652870
set_bit(HCLGEVF_STATE_PROMISC_CHANGED, &hdev->state);
28662871

28672872
hclgevf_init_rxd_adv_layout(hdev);

0 commit comments

Comments
 (0)