david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[igbvf] Assign random MAC address if none is set

If the VF doesn't have a MAC address assigned we should create a
random MAC address.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Hannes Reinecke 2014-06-03 14:01:16 +02:00 committed by Michael Brown
parent d5cf058994
commit f63ec19dca
1 changed files with 4 additions and 10 deletions

View File

@ -871,20 +871,14 @@ int igbvf_probe ( struct pci_device *pdev )
DBG ("Error reading MAC address\n");
goto err_hw_init;
}
if ( ! is_valid_ether_addr(adapter->hw.mac.addr) ) {
/* Assign random MAC address */
eth_random_addr(adapter->hw.mac.addr);
}
}
memcpy ( netdev->hw_addr, adapter->hw.mac.addr, ETH_ALEN );
if ( ! is_valid_ether_addr( netdev->hw_addr ) ) {
DBG ("Invalid MAC Address: "
"%02x:%02x:%02x:%02x:%02x:%02x\n",
netdev->hw_addr[0], netdev->hw_addr[1],
netdev->hw_addr[2], netdev->hw_addr[3],
netdev->hw_addr[4], netdev->hw_addr[5]);
err = -EIO;
goto err_hw_init;
}
/* reset the hardware with the new settings */
igbvf_reset ( adapter );