Skip to content

Commit

Permalink
[igbvf] Assign random MAC address if none is set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hreinecke authored and mcb30 committed Jun 12, 2014
1 parent d5cf058 commit f63ec19
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/drivers/net/igbvf/igbvf_main.c
Expand Up @@ -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 );

Expand Down

0 comments on commit f63ec19

Please sign in to comment.