summaryrefslogtreecommitdiff
path: root/net/dsa/slave.c
diff options
context:
space:
mode:
authorXiaofei Shen <xiaofeis@codeaurora.org>2019-03-29 11:04:58 +0530
committerDavid S. Miller <davem@davemloft.net>2019-04-01 14:57:32 -0700
commita2c7023f7075ca9b80f944d3f20f60e6574538e2 (patch)
treef233ec3606dfa952650e02d2743fed1fa74f83bd /net/dsa/slave.c
parentf5d547676ca068e10934687f59ac1e798eaae87a (diff)
net: dsa: read mac address from DT for slave device
Before creating a slave netdevice, get the mac address from DTS and apply in case it is valid. Signed-off-by: Xiaofei Shen <xiaofeis@codeaurora.org> Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r--net/dsa/slave.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 80be8e86c82d..f83525909c57 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1393,7 +1393,10 @@ int dsa_slave_create(struct dsa_port *port)
NETIF_F_HW_VLAN_CTAG_FILTER;
slave_dev->hw_features |= NETIF_F_HW_TC;
slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
- eth_hw_addr_inherit(slave_dev, master);
+ if (port->mac && is_valid_ether_addr(port->mac))
+ ether_addr_copy(slave_dev->dev_addr, port->mac);
+ else
+ eth_hw_addr_inherit(slave_dev, master);
slave_dev->priv_flags |= IFF_NO_QUEUE;
slave_dev->netdev_ops = &dsa_slave_netdev_ops;
slave_dev->min_mtu = 0;