Commit 8d56b6d5 authored by Mitch A Williams's avatar Mitch A Williams Committed by Jeff Kirsher

igbvf: be sane about random MAC addresses

Tighten up some of the code surrounding MAC addresses. Since the PF is
now giving all zeros instead of a random address, check for this case
and generate a random address. This ensures that we always know when we
have a random address and udev won't get upset about it.

Additionally, tighten up some of the log messages and clean up the
formatting.
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Stefan Assmann <sassmann@kpanic.de>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Tested-by: default avatarStefan Assmann <sassmann@redhat.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 5ac6f91d
...@@ -2735,26 +2735,22 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2735,26 +2735,22 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err = hw->mac.ops.reset_hw(hw); err = hw->mac.ops.reset_hw(hw);
if (err) { if (err) {
dev_info(&pdev->dev, dev_info(&pdev->dev,
"PF still in reset state, assigning new address." "PF still in reset state. Is the PF interface up?\n");
" Is the PF interface up?\n");
eth_hw_addr_random(netdev);
memcpy(adapter->hw.mac.addr, netdev->dev_addr,
netdev->addr_len);
} else { } else {
err = hw->mac.ops.read_mac_addr(hw); err = hw->mac.ops.read_mac_addr(hw);
if (err) { if (err)
dev_err(&pdev->dev, "Error reading MAC address\n"); dev_info(&pdev->dev, "Error reading MAC address.\n");
goto err_hw_init; else if (is_zero_ether_addr(adapter->hw.mac.addr))
} dev_info(&pdev->dev, "MAC address not assigned by administrator.\n");
memcpy(netdev->dev_addr, adapter->hw.mac.addr, memcpy(netdev->dev_addr, adapter->hw.mac.addr,
netdev->addr_len); netdev->addr_len);
} }
if (!is_valid_ether_addr(netdev->dev_addr)) { if (!is_valid_ether_addr(netdev->dev_addr)) {
dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", dev_info(&pdev->dev, "Assigning random MAC address.\n");
netdev->dev_addr); eth_hw_addr_random(netdev);
err = -EIO; memcpy(adapter->hw.mac.addr, netdev->dev_addr,
goto err_hw_init; netdev->addr_len);
} }
setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, setup_timer(&adapter->watchdog_timer, &igbvf_watchdog,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment