netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: Inherit dev addr from master
@ 2019-02-22 12:56 Vinod Koul
  2019-02-22 14:30 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2019-02-22 12:56 UTC (permalink / raw)
  To: David S. Miller
  Cc: linux-arm-msm, Bjorn Andersson, Xiaofei Shen, Andrew Lunn,
	Vivien Didelot, Florian Fainelli, Niklas Cassel, netdev,
	Vinod Koul

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-27  4:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22 12:56 [PATCH] net: dsa: Inherit dev addr from master Vinod Koul
2019-02-22 14:30 ` Andrew Lunn
2019-02-25 13:13   ` xiaofeis
2019-02-25 13:21     ` Andrew Lunn
2019-03-27  4:09       ` xiaofeis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).