Skip to content

Commit

Permalink
via-rhine: Assign random MAC address if necessary
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joe Perches authored and David S. Miller committed Apr 18, 2011
1 parent df4511f commit 482e3fe
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/net/via-rhine.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,13 +838,15 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,

for (i = 0; i < 6; i++)
dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);

if (!is_valid_ether_addr(dev->perm_addr)) {
rc = -EIO;
dev_err(&pdev->dev, "Invalid MAC address\n");
goto err_out_unmap;
if (!is_valid_ether_addr(dev->dev_addr)) {
/* Report it and use a random ethernet address instead */
netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr);
random_ether_addr(dev->dev_addr);
netdev_info(dev, "Using random MAC address: %pM\n",
dev->dev_addr);
}
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);

/* For Rhine-I/II, phy_id is loaded from EEPROM */
if (!phy_id)
Expand Down

0 comments on commit 482e3fe

Please sign in to comment.