mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Salil Mehta <salil.mehta@huawei.com>
To: <davem@davemloft.net>
Cc: <salil.mehta@huawei.com>, <yisen.zhuang@huawei.com>,
	<lipeng321@huawei.com>, <mehta.salil.lnk@gmail.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH net 4/7] net: hns3: fix a bug of set mac address
Date: Tue, 19 Sep 2017 02:06:25 +0100	[thread overview]
Message-ID: <20170919010628.175732-5-salil.mehta@huawei.com> (raw)
In-Reply-To: <20170919010628.175732-1-salil.mehta@huawei.com>

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

  parent reply	other threads:[~2017-09-19  1:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19  1:06 [PATCH net 0/7] Bug fixes for the HNS3 Ethernet Driver for Hip08 SoC Salil Mehta
2017-09-19  1:06 ` [PATCH net 1/7] net: hns3: get phy addr from NCL_config Salil Mehta
2017-09-19  1:06 ` [PATCH net 2/7] net: hns3: fix the command used to unmap ring from vector Salil Mehta
2017-09-19  1:06 ` [PATCH net 3/7] net: hns3: Fix ring and vector map command Salil Mehta
2017-09-19  1:06 ` Salil Mehta [this message]
2017-09-19  1:06 ` [PATCH net 5/7] net: hns3: fixes the ether address copy with more appropriate API Salil Mehta
2017-09-19  1:06 ` [PATCH net 6/7] net: hns3: set default vlan id to PF Salil Mehta
2017-09-19  1:06 ` [PATCH net 7/7] net: hns3: Fixes the premature exit of loop when matching clients Salil Mehta
2017-09-19  3:59 ` [PATCH net 0/7] Bug fixes for the HNS3 Ethernet Driver for Hip08 SoC Leon Romanovsky
2017-09-19 14:12   ` Salil Mehta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170919010628.175732-5-salil.mehta@huawei.com \
    --to=salil.mehta@huawei.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=mehta.salil.lnk@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®