[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:
parent
d5cf058994
commit
f63ec19dca
@ -871,20 +871,14 @@ int igbvf_probe ( struct pci_device *pdev )
|
|||||||
DBG ("Error reading MAC address\n");
|
DBG ("Error reading MAC address\n");
|
||||||
goto err_hw_init;
|
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 );
|
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 */
|
/* reset the hardware with the new settings */
|
||||||
igbvf_reset ( adapter );
|
igbvf_reset ( adapter );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user