Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734580 > unrolled thread

[PATCH net 4/7] net: hns3: fix a bug of set mac address

Started bySalil Mehta <salil.mehta@huawei.com>
First post2017-09-19 03:10 +0200
Last post2017-09-19 03:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net 4/7] net: hns3: fix a bug of set mac address Salil Mehta <salil.mehta@huawei.com> - 2017-09-19 03:10 +0200

#1734580 — [PATCH net 4/7] net: hns3: fix a bug of set mac address

FromSalil Mehta <salil.mehta@huawei.com>
Date2017-09-19 03:10 +0200
Subject[PATCH net 4/7] net: hns3: fix a bug of set mac address
Message-ID<urfd0-5PD-13@gated-at.bofh.it>
From: Lipeng <lipeng321@huawei.com>

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 <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web