Browse Source

[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>
tags/v1.20.1
Hannes Reinecke 10 years ago
parent
commit
f63ec19dca
1 changed files with 4 additions and 10 deletions
  1. 4
    10
      src/drivers/net/igbvf/igbvf_main.c

+ 4
- 10
src/drivers/net/igbvf/igbvf_main.c View File

@@ -871,20 +871,14 @@ int igbvf_probe ( struct pci_device *pdev )
871 871
 			DBG ("Error reading MAC address\n");
872 872
 			goto err_hw_init;
873 873
 		}
874
+		if ( ! is_valid_ether_addr(adapter->hw.mac.addr) ) {
875
+			/* Assign random MAC address */
876
+			eth_random_addr(adapter->hw.mac.addr);
877
+		}
874 878
 	}
875 879
 
876 880
 	memcpy ( netdev->hw_addr, adapter->hw.mac.addr, ETH_ALEN );
877 881
 
878
-	if ( ! is_valid_ether_addr( netdev->hw_addr ) ) {
879
-		DBG ("Invalid MAC Address: "
880
-		        "%02x:%02x:%02x:%02x:%02x:%02x\n",
881
-		        netdev->hw_addr[0], netdev->hw_addr[1],
882
-		        netdev->hw_addr[2], netdev->hw_addr[3],
883
-		        netdev->hw_addr[4], netdev->hw_addr[5]);
884
-		err = -EIO;
885
-		goto err_hw_init;
886
-	}
887
-
888 882
 	/* reset the hardware with the new settings */
889 883
 	igbvf_reset ( adapter );
890 884
 

Loading…
Cancel
Save