Skip to content

Commit ccb18f0

Browse files
IronShenkuba-moo
authored andcommitted
net: hns3: fix bug when PF set the duplicate MAC address for VFs
If the MAC address A is configured to vport A and then vport B. The MAC address of vport A in the hardware becomes invalid. If the address of vport A is changed to MAC address B, the driver needs to delete the MAC address A of vport A. Due to the MAC address A of vport A has become invalid in the hardware entry, so "-ENOENT" is returned. In this case, the "used_umv_size" value recorded in driver is not updated. As a result, the MAC entry status of the software is inconsistent with that of the hardware. Therefore, the driver updates the umv size even if the MAC entry cannot be found. Ensure that the software and hardware status is consistent. Fixes: ee4bcd3 ("net: hns3: refactor the MAC address configure") 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 afec498 commit ccb18f0

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8438,12 +8438,11 @@ int hclge_rm_uc_addr_common(struct hclge_vport *vport,
84388438
hnae3_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT0_EN_B, 0);
84398439
hclge_prepare_mac_addr(&req, addr, false);
84408440
ret = hclge_remove_mac_vlan_tbl(vport, &req);
8441-
if (!ret) {
8441+
if (!ret || ret == -ENOENT) {
84428442
mutex_lock(&hdev->vport_lock);
84438443
hclge_update_umv_space(vport, true);
84448444
mutex_unlock(&hdev->vport_lock);
8445-
} else if (ret == -ENOENT) {
8446-
ret = 0;
8445+
return 0;
84478446
}
84488447

84498448
return ret;

0 commit comments

Comments
 (0)