
From: shenhao <shenhao21@huawei.com> driver inclusion category: feature bugzilla: NA CVE: NA ------------------------------------------ Currently, hns3_init_mac_addr is used to set the device addr to HW, but do not check the addr to be set is same before setting it. If we just triggered a VF reset, or modified the tx queue for VF, driver will get a addr stored at netdev->dev_addr and set it again, which is the same one. It will make a warning print of "mac exist". This patch fixes it. Signed-off-by: Guojia Liao <liaoguojia@huawei.com> Signed-off-by: shenhao <shenhao21@huawei.com> Reviewed-by: Zhong Zhaohui <zhongzhaohui@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 22af17c..1729d1d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3961,9 +3961,11 @@ static int hns3_init_mac_addr(struct net_device *netdev) eth_hw_addr_random(netdev); dev_warn(priv->dev, "using random MAC address %pM\n", netdev->dev_addr); - } else { + } else if (!ether_addr_equal(netdev->dev_addr, mac_addr_temp)) { ether_addr_copy(netdev->dev_addr, mac_addr_temp); ether_addr_copy(netdev->perm_addr, mac_addr_temp); + } else { + return 0; } if (h->ae_algo->ops->set_mac_addr) -- 1.8.3