Browse Source

[intel] Use autoloaded MAC address instead of EEPROM MAC address

The i350 (and possibly other Intel NICs) have a non-trivial
correspondence between the PCI function number and the external
physical port number.  For example, the i350 has a "LAN Function Sel"
bit within the EEPROM which can invert the mapping so that function 0
becomes port 3, function 1 becomes port 2, etc.

Unfortunately the MAC addresses within the EEPROM are indexed by
physical port number rather than PCI function number.  The end result
is that when anything other than the default mapping is used, iPXE
will use the wrong address as the base MAC address.

Fix by using the autoloaded MAC address if it is valid, and falling
back to reading the MAC address directly from the EEPROM only if no
autoloaded address is available.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
a937615151
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      src/drivers/net/intel.c

+ 4
- 4
src/drivers/net/intel.c View File

232
 	DBGC ( intel, "INTEL %p has autoloaded MAC address %s\n",
232
 	DBGC ( intel, "INTEL %p has autoloaded MAC address %s\n",
233
 	       intel, eth_ntoa ( mac.raw ) );
233
 	       intel, eth_ntoa ( mac.raw ) );
234
 
234
 
235
-	/* Try to read address from EEPROM */
236
-	if ( ( rc = intel_fetch_mac_eeprom ( intel, hw_addr ) ) == 0 )
237
-		return 0;
238
-
239
 	/* Use current address if valid */
235
 	/* Use current address if valid */
240
 	if ( is_valid_ether_addr ( mac.raw ) ) {
236
 	if ( is_valid_ether_addr ( mac.raw ) ) {
241
 		memcpy ( hw_addr, mac.raw, ETH_ALEN );
237
 		memcpy ( hw_addr, mac.raw, ETH_ALEN );
242
 		return 0;
238
 		return 0;
243
 	}
239
 	}
244
 
240
 
241
+	/* Otherwise, try to read address from EEPROM */
242
+	if ( ( rc = intel_fetch_mac_eeprom ( intel, hw_addr ) ) == 0 )
243
+		return 0;
244
+
245
 	DBGC ( intel, "INTEL %p has no MAC address to use\n", intel );
245
 	DBGC ( intel, "INTEL %p has no MAC address to use\n", intel );
246
 	return -ENOENT;
246
 	return -ENOENT;
247
 }
247
 }

Loading…
Cancel
Save