Skip to content

Commit 91fcc79

Browse files
Guangbin Huangdavem330
authored andcommitted
net: hns3: remove check VF uc mac exist when set by PF
If users set unicast mac address for VFs by PF, they need to guarantee all VFs' address is different. This patch removes the check mac address exist of VFs, for usrs can refresh mac addresses of all VFs directly without need to modify the exist mac address to other value firstly. Fixes: 8e6de44 ("net: hns3: add support for configuring VF MAC from the host") Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1122eac commit 91fcc79

1 file changed

Lines changed: 0 additions & 36 deletions

File tree

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9418,36 +9418,6 @@ static int hclge_get_mac_ethertype_cmd_status(struct hclge_dev *hdev,
94189418
return return_status;
94199419
}
94209420

9421-
static bool hclge_check_vf_mac_exist(struct hclge_vport *vport, int vf_idx,
9422-
u8 *mac_addr)
9423-
{
9424-
struct hclge_mac_vlan_tbl_entry_cmd req;
9425-
struct hclge_dev *hdev = vport->back;
9426-
struct hclge_desc desc;
9427-
u16 egress_port = 0;
9428-
int i;
9429-
9430-
if (is_zero_ether_addr(mac_addr))
9431-
return false;
9432-
9433-
memset(&req, 0, sizeof(req));
9434-
hnae3_set_field(egress_port, HCLGE_MAC_EPORT_VFID_M,
9435-
HCLGE_MAC_EPORT_VFID_S, vport->vport_id);
9436-
req.egress_port = cpu_to_le16(egress_port);
9437-
hclge_prepare_mac_addr(&req, mac_addr, false);
9438-
9439-
if (hclge_lookup_mac_vlan_tbl(vport, &req, &desc, false) != -ENOENT)
9440-
return true;
9441-
9442-
vf_idx += HCLGE_VF_VPORT_START_NUM;
9443-
for (i = HCLGE_VF_VPORT_START_NUM; i < hdev->num_alloc_vport; i++)
9444-
if (i != vf_idx &&
9445-
ether_addr_equal(mac_addr, hdev->vport[i].vf_info.mac))
9446-
return true;
9447-
9448-
return false;
9449-
}
9450-
94519421
static int hclge_set_vf_mac(struct hnae3_handle *handle, int vf,
94529422
u8 *mac_addr)
94539423
{
@@ -9465,12 +9435,6 @@ static int hclge_set_vf_mac(struct hnae3_handle *handle, int vf,
94659435
return 0;
94669436
}
94679437

9468-
if (hclge_check_vf_mac_exist(vport, vf, mac_addr)) {
9469-
dev_err(&hdev->pdev->dev, "Specified MAC(=%pM) exists!\n",
9470-
mac_addr);
9471-
return -EEXIST;
9472-
}
9473-
94749438
ether_addr_copy(vport->vf_info.mac, mac_addr);
94759439

94769440
if (test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) {

0 commit comments

Comments
 (0)