Skip to content

Commit

Permalink
net/faraday: Disallow using reversed MAC address from hardware
Browse files Browse the repository at this point in the history
The initial MAC address is retrieved from hardware if it's not
provided by device-tree. The reserved MAC address from hardware
will be used if non-reserved MAC address is invalid. It will
cause mismatched MAC address seen by hardware and software.

This disallows using the reserved hardware MAC address to avoid
the mismatched MAC address seen by hardware and software.

Fixes: 113ce10 ("net/faraday: Read MAC address from chip")
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gavin Shan authored and David S. Miller committed Jul 21, 2016
1 parent c0d661c commit e6c044f
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions drivers/net/ethernet/faraday/ftgmac100.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,6 @@ static void ftgmac100_setup_mac(struct ftgmac100 *priv)
mac[4] = (l >> 8) & 0xff;
mac[5] = l & 0xff;

if (!is_valid_ether_addr(mac)) {
mac[5] = (m >> 8) & 0xff;
mac[4] = m & 0xff;
mac[3] = (l >> 24) & 0xff;
mac[2] = (l >> 16) & 0xff;
mac[1] = (l >> 8) & 0xff;
mac[0] = l & 0xff;
}

if (is_valid_ether_addr(mac)) {
ether_addr_copy(priv->netdev->dev_addr, mac);
dev_info(priv->dev, "Read MAC address %pM from chip\n", mac);
Expand Down

0 comments on commit e6c044f

Please sign in to comment.