summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/marvell/mvpp2.c
diff options
context:
space:
mode:
authorAntoine Tenart2017-09-02 11:06:49 +0200
committerDavid S. Miller2017-09-04 05:16:55 +0200
commit688cbaf202df8b4a69f5ccd39e0027f179852d44 (patch)
tree1ce56c330ce8a96fc55fd4eee29261231e55ca5e /drivers/net/ethernet/marvell/mvpp2.c
parentnet: mvpp2: fix use of the random mac address for PPv2.2 (diff)
downloadkernel-qcow2-linux-688cbaf202df8b4a69f5ccd39e0027f179852d44.tar.gz
kernel-qcow2-linux-688cbaf202df8b4a69f5ccd39e0027f179852d44.tar.xz
kernel-qcow2-linux-688cbaf202df8b4a69f5ccd39e0027f179852d44.zip
net: mvpp2: fallback using h/w and random mac if the dt one isn't valid
When using a mac address described in the device tree, a check is made to see if it is valid. When it's not, no fallback is defined. This patches tries to get the mac address from h/w (or use a random one if the h/w one isn't valid) when the dt mac address isn't valid. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/mvpp2.c')
-rw-r--r--drivers/net/ethernet/marvell/mvpp2.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index c6003508f166..dd0ee2691c86 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -7477,19 +7477,20 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) {
*mac_from = "device tree";
ether_addr_copy(dev->dev_addr, dt_mac_addr);
- } else {
- if (priv->hw_version == MVPP21) {
- mvpp21_get_mac_address(port, hw_mac_addr);
- if (is_valid_ether_addr(hw_mac_addr)) {
- *mac_from = "hardware";
- ether_addr_copy(dev->dev_addr, hw_mac_addr);
- return;
- }
- }
+ return;
+ }
- *mac_from = "random";
- eth_hw_addr_random(dev);
+ if (priv->hw_version == MVPP21) {
+ mvpp21_get_mac_address(port, hw_mac_addr);
+ if (is_valid_ether_addr(hw_mac_addr)) {
+ *mac_from = "hardware";
+ ether_addr_copy(dev->dev_addr, hw_mac_addr);
+ return;
+ }
}
+
+ *mac_from = "random";
+ eth_hw_addr_random(dev);
}
/* Ports initialization */