Path: csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod From: Salil Mehta Newsgroups: linux.kernel Subject: [PATCH net 4/7] net: hns3: fix a bug of set mac address Date: Tue, 19 Sep 2017 03:10:02 +0200 Message-ID: References: X-Original-To: X-Mailer: git-send-email 2.8.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.47.92.71] X-Cfilter-Loop: Reflected X-Mirapoint-Virus-Rapid-Raw: score=unknown(0), refid=str=0001.0A020201.59C06DD3.0133,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-ID: a2efa8880ab61e8574fc0bdad7b666d8 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 36 Organization: linux.* mail to news gateway X-Original-Cc: , , , , , , , X-Original-Date: Tue, 19 Sep 2017 02:06:25 +0100 X-Original-Message-ID: <20170919010628.175732-5-salil.mehta@huawei.com> X-Original-References: <20170919010628.175732-1-salil.mehta@huawei.com> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1734580 From: Lipeng HNS3 driver get mac address from NCL_config file and set the mac address to HW. If the mac address in NCL_config is invalid, driver will set a random mac address, and use this address. The current code will set random mac address to HW, but will not set the valid mac address from NCL_config file to HW. This patch fix the bug. Signed-off-by: Lipeng Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c index 1c3e29447891..4d68d6ea5143 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c @@ -2705,10 +2705,11 @@ static void 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); - /* Also copy this new MAC address into hdev */ - if (h->ae_algo->ops->set_mac_addr) - h->ae_algo->ops->set_mac_addr(h, netdev->dev_addr); } + + if (h->ae_algo->ops->set_mac_addr) + h->ae_algo->ops->set_mac_addr(h, netdev->dev_addr); + } static void hns3_nic_set_priv_ops(struct net_device *netdev) -- 2.11.0