aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igbvf/netdev.c
diff options
context:
space:
mode:
authorMitch A Williams <mitch.a.williams@intel.com>2013-01-18 03:57:20 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2013-01-28 06:18:13 -0500
commit8d56b6d507e0c4f6e24680fd202cbaad445935c5 (patch)
tree15d1593e41ee1ab11ad162eb0fe1f89fbd641c8a /drivers/net/ethernet/intel/igbvf/netdev.c
parent5ac6f91d39e0884813dc010e14552143cd1d0d8b (diff)
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: Mitch Williams <mitch.a.williams@intel.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: Stefan Assmann <sassmann@kpanic.de> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Tested-by: Stefan Assmann <sassmann@redhat.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igbvf/netdev.c')
-rw-r--r--drivers/net/ethernet/intel/igbvf/netdev.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index 8f66d459218f..8224889e6845 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -2735,26 +2735,22 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2735 err = hw->mac.ops.reset_hw(hw); 2735 err = hw->mac.ops.reset_hw(hw);
2736 if (err) { 2736 if (err) {
2737 dev_info(&pdev->dev, 2737 dev_info(&pdev->dev,
2738 "PF still in reset state, assigning new address." 2738 "PF still in reset state. Is the PF interface up?\n");
2739 " Is the PF interface up?\n");
2740 eth_hw_addr_random(netdev);
2741 memcpy(adapter->hw.mac.addr, netdev->dev_addr,
2742 netdev->addr_len);
2743 } else { 2739 } else {
2744 err = hw->mac.ops.read_mac_addr(hw); 2740 err = hw->mac.ops.read_mac_addr(hw);
2745 if (err) { 2741 if (err)
2746 dev_err(&pdev->dev, "Error reading MAC address\n"); 2742 dev_info(&pdev->dev, "Error reading MAC address.\n");
2747 goto err_hw_init; 2743 else if (is_zero_ether_addr(adapter->hw.mac.addr))
2748 } 2744 dev_info(&pdev->dev, "MAC address not assigned by administrator.\n");
2749 memcpy(netdev->dev_addr, adapter->hw.mac.addr, 2745 memcpy(netdev->dev_addr, adapter->hw.mac.addr,
2750 netdev->addr_len); 2746 netdev->addr_len);
2751 } 2747 }
2752 2748
2753 if (!is_valid_ether_addr(netdev->dev_addr)) { 2749 if (!is_valid_ether_addr(netdev->dev_addr)) {
2754 dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", 2750 dev_info(&pdev->dev, "Assigning random MAC address.\n");
2755 netdev->dev_addr); 2751 eth_hw_addr_random(netdev);
2756 err = -EIO; 2752 memcpy(adapter->hw.mac.addr, netdev->dev_addr,
2757 goto err_hw_init; 2753 netdev->addr_len);
2758 } 2754 }
2759 2755
2760 setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, 2756 setup_timer(&adapter->watchdog_timer, &igbvf_watchdog,