From: Vinod Koul <vkoul@kernel•org>
To: "David S. Miller" <davem@davemloft•net>
Cc: linux-arm-msm@vger•kernel.org,
Bjorn Andersson <bjorn.andersson@linaro•org>,
Xiaofei Shen <xiaofeis@codeaurora•org>,
Andrew Lunn <andrew@lunn•ch>,
Vivien Didelot <vivien.didelot@gmail•com>,
Florian Fainelli <f.fainelli@gmail•com>,
Niklas Cassel <niklas.cassel@linaro•org>,
netdev@vger•kernel.org, Vinod Koul <vkoul@kernel•org>
Subject: [PATCH] net: dsa: Inherit dev addr from master
Date: Fri, 22 Feb 2019 18:26:54 +0530 [thread overview]
Message-ID: <20190222125654.12478-1-vkoul@kernel.org> (raw)
From: Xiaofei Shen <xiaofeis@codeaurora•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@codeaurora•org>
Signed-off-by: Vinod Koul <vkoul@kernel•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
next reply other threads:[~2019-02-22 12:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-22 12:56 Vinod Koul [this message]
2019-02-22 14:30 ` [PATCH] net: dsa: Inherit dev addr from master Andrew Lunn
2019-02-25 13:13 ` xiaofeis
2019-02-25 13:21 ` Andrew Lunn
2019-03-27 4:09 ` xiaofeis
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=20190222125654.12478-1-vkoul@kernel.org \
--to=vkoul@kernel$(echo .)org \
--cc=andrew@lunn$(echo .)ch \
--cc=bjorn.andersson@linaro$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=f.fainelli@gmail$(echo .)com \
--cc=linux-arm-msm@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=niklas.cassel@linaro$(echo .)org \
--cc=vivien.didelot@gmail$(echo .)com \
--cc=xiaofeis@codeaurora$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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