summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2014-10-31 16:18:54 +0100
committerMichael Brown2014-10-31 16:24:40 +0100
commita937615151878f43fb25d05a669105d95cfba941 (patch)
treea127f9c47362d878d1d94195a79b5c3e8d64660c
parent[ping] Allow "ping" command output to be inhibited (diff)
downloadipxe-a937615151878f43fb25d05a669105d95cfba941.tar.gz
ipxe-a937615151878f43fb25d05a669105d95cfba941.tar.xz
ipxe-a937615151878f43fb25d05a669105d95cfba941.zip
[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>
-rw-r--r--src/drivers/net/intel.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/drivers/net/intel.c b/src/drivers/net/intel.c
index 8cc0e7f9c..a89f947b2 100644
--- a/src/drivers/net/intel.c
+++ b/src/drivers/net/intel.c
@@ -232,16 +232,16 @@ static int intel_fetch_mac ( struct intel_nic *intel, uint8_t *hw_addr ) {
DBGC ( intel, "INTEL %p has autoloaded MAC address %s\n",
intel, eth_ntoa ( mac.raw ) );
- /* Try to read address from EEPROM */
- if ( ( rc = intel_fetch_mac_eeprom ( intel, hw_addr ) ) == 0 )
- return 0;
-
/* Use current address if valid */
if ( is_valid_ether_addr ( mac.raw ) ) {
memcpy ( hw_addr, mac.raw, ETH_ALEN );
return 0;
}
+ /* Otherwise, try to read address from EEPROM */
+ if ( ( rc = intel_fetch_mac_eeprom ( intel, hw_addr ) ) == 0 )
+ return 0;
+
DBGC ( intel, "INTEL %p has no MAC address to use\n", intel );
return -ENOENT;
}