[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190222125654.12478-1-vkoul@kernel.org>
Date: Fri, 22 Feb 2019 18:26:54 +0530
From: Vinod Koul <vkoul@...nel.org>
To: "David S. Miller" <davem@...emloft.net>
Cc: linux-arm-msm@...r.kernel.org,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Xiaofei Shen <xiaofeis@...eaurora.org>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Niklas Cassel <niklas.cassel@...aro.org>,
netdev@...r.kernel.org, Vinod Koul <vkoul@...nel.org>
Subject: [PATCH] net: dsa: Inherit dev addr from master
From: Xiaofei Shen <xiaofeis@...eaurora.org>
When we create slave netdevice, the dev addr is inherited from master
but the master dev addr maybe NULL at that time, so inherit it again
while opening the slave.
Signed-off-by: Xiaofei Shen <xiaofeis@...eaurora.org>
Signed-off-by: Vinod Koul <vkoul@...nel.org>
---
net/dsa/slave.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 8e64c4e947c6..5f95c538b58c 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -77,7 +77,9 @@ static int dsa_slave_open(struct net_device *dev)
if (!(master->flags & IFF_UP))
return -ENETDOWN;
- if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
+ if (!is_valid_ether_addr(dev->dev_addr)) {
+ eth_hw_addr_inherit(dev, master);
+ } else if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
err = dev_uc_add(master, dev->dev_addr);
if (err < 0)
goto out;
--
2.20.1
Powered by blists - more mailing lists