diff options
author | Joe Perches <joe@perches.com> | 2011-04-16 10:15:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-17 20:56:37 -0400 |
commit | 482e3febc2e7df78411005dcdd7621c16b98b088 (patch) | |
tree | 93ba6fae8768ddfb20a05f17414f609a6c4dcc29 /drivers | |
parent | df4511feb76173db872c8845b63179dd15f2b7da (diff) |
via-rhine: Assign random MAC address if necessary
Roger Luethi has had several reports of Rhine NICs providing
an invalid MAC address. If so, assign a random MAC address so
the hardware can still be used.
Tested as a standalone interface, as carrier for ppp, and as a
bonding slave.
Original-patch-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/via-rhine.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 40f394ce113b..7f23ab913fd9 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -838,13 +838,15 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
838 | 838 | ||
839 | for (i = 0; i < 6; i++) | 839 | for (i = 0; i < 6; i++) |
840 | dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); | 840 | dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); |
841 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
842 | 841 | ||
843 | if (!is_valid_ether_addr(dev->perm_addr)) { | 842 | if (!is_valid_ether_addr(dev->dev_addr)) { |
844 | rc = -EIO; | 843 | /* Report it and use a random ethernet address instead */ |
845 | dev_err(&pdev->dev, "Invalid MAC address\n"); | 844 | netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr); |
846 | goto err_out_unmap; | 845 | random_ether_addr(dev->dev_addr); |
846 | netdev_info(dev, "Using random MAC address: %pM\n", | ||
847 | dev->dev_addr); | ||
847 | } | 848 | } |
849 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
848 | 850 | ||
849 | /* For Rhine-I/II, phy_id is loaded from EEPROM */ | 851 | /* For Rhine-I/II, phy_id is loaded from EEPROM */ |
850 | if (!phy_id) | 852 | if (!phy_id) |