<div>Kieran,</div><div>š</div><div>First, driver read autoload MAC from INTEL_RAL/INTEL_RAH.</div><div>Then driver fetch MAC from EEPROM. After driver tries to validate autoloaded MAC. If it fits, it copies to "hw_addr" otherwise EEPROM MAC will be used. Usually, EEPROM of embedded NICs programmed by the motherboard vendor, because MAC address space is a vendor specific.</div><div>š</div><div>Try to add two additional checks before "<span style="margin:0px;padding:0px;border:0px none;">is_valid_ether_addr()" to see which check fails:</span></div><div>š</div><div>š</div><div>š</div><div>š</div><div>š</div><div>š</div><div>š</div><div><span style="margin:0px;padding:0px;border:0px none;">is_multicast_ether_addr(mac.raw) must return 0<br /></span></div><div><span style="margin:0px;padding:0px;border:0px none;">is_zero_ether_addr(mac.raw) must return 0<br /></span></div><div>š</div><div>27.07.2012, 14:06, "Kieran Evans" <keyz182@gmail.com>:</div><blockquote type="cite"><div>Hi, unless I'm mis-reading this, or I've misunderstood, this code looks like it will always use the EEPROM MAC if it exists (i.e. the return 0 after intel_fetch_mac_eeprom is before the is_valid_ether_addr, so it'll never be reached).<br /> <br /> <br /><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">static</span> <span style="margin:0px;padding:0px;border:0px none;color:#445588;font-weight:bold;">int</span> <span style="margin:0px;padding:0px;border:0px none;color:#990000;font-weight:bold;">intel_fetch_mac</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span>struct</span> <span style="margin:0px;padding:0px;border:0px none;">intel_nic</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">*</span><span style="margin:0px;padding:0px;border:0px none;">intel</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;color:#445588;font-weight:bold;">uint8_t</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">*</span><span style="margin:0px;padding:0px;border:0px none;">hw_addr</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;">{</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span>union</span> <span style="margin:0px;padding:0px;border:0px none;">intel_receive_address</span> <span style="margin:0px;padding:0px;border:0px none;">mac</span><span style="margin:0px;padding:0px;border:0px none;">;</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;color:#445588;font-weight:bold;">int</span> <span style="margin:0px;padding:0px;border:0px none;">rc</span><span style="margin:0px;padding:0px;border:0px none;">;</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;">š</div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;color:#999988;font-style:italic;">/* Read current address from RAL0/RAH0 */</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">mac</span><span style="margin:0px;padding:0px;border:0px none;">.</span><span style="margin:0px;padding:0px;border:0px none;">reg</span><span style="margin:0px;padding:0px;border:0px none;">.</span><span style="margin:0px;padding:0px;border:0px none;">low</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">=</span> <span style="margin:0px;padding:0px;border:0px none;">cpu_to_le32</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span>readl</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">intel</span><span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">-></span><span style="margin:0px;padding:0px;border:0px none;">regs</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">+</span> <span style="margin:0px;padding:0px;border:0px none;">INTEL_RAL0</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;">);</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">mac</span><span style="margin:0px;padding:0px;border:0px none;">.</span><span style="margin:0px;padding:0px;border:0px none;">reg</span><span style="margin:0px;padding:0px;border:0px none;">.</span><span style="margin:0px;padding:0px;border:0px none;">high</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">=</span> <span style="margin:0px;padding:0px;border:0px none;">cpu_to_le32</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">readl</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">intel</span><span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">-></span><span style="margin:0px;padding:0px;border:0px none;">regs</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">+</span> <span style="margin:0px;padding:0px;border:0px none;">INTEL _RAH0</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;">);</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">DBGC</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">intel</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;color:#dd1144;">"INTEL %p has autoloaded MAC address %s</span><span style="margin:0px;padding:0px;border:0px none;color:#dd1144;">\n</span><span style="margin:0px;padding:0px;border:0px none;color:#dd1144;">"</span><span style="margin:0px;padding:0px;border:0px none;">,</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">intel</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;">eth_ntoa</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">mac</span><span style="margin:0px;padding:0px;border:0px none;">.</span><span style="margin:0px;padding:0px;border:0px none;">raw</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;">);</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;">š</div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;color:#999988;font-style:italic;">/* Try to read address from EEPROM */</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">if</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">rc</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">=</span> <span style="margin:0px;padding:0px;border:0px none;">intel_fetch_mac_eeprom</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;"> intel</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;">hw_addr</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">==</span> <span style="margin:0px;padding:0px;border:0px none;color:#009999;">0</span> <span style="margin:0px;padding:0px;border:0px none;">)</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">return</span> <span style="margin:0px;padding:0px;border:0px none;color:#009999;">0</span><span style="margin:0px;padding:0px;border:0px none;">;</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;">š</div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;color:#999988;font-style:italic;">/* Use current address if valid */</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">if</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">is_valid_ether_addr</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">mac</span><span style="margin:0px;padding:0px;border:0px none;">.</span><span style="margin:0px;padding:0px;border:0px none;">raw</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;">)</span> <span style="margin:0px;padding:0px;border:0px none;">{</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">memcpy</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">hw_addr</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;">mac</span><span style="margin:0px;padding:0px;border:0px none;">.</span><span style="margin:0px;padding:0px;border:0px none;">raw</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;">ETH_ALEN</span> <span style="margin:0px;padding:0px;border:0px none;">);</span>< /div> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">return</span> <span style="margin:0px;padding:0px;border:0px none;color:#009999;">0</span><span style="margin:0px;padding:0px;border:0px none;">;</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">}</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;">š</div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">DBGC</span> <span style="margin:0px;padding:0px;border:0px none;">(</span> <span style="margin:0px;padding:0px;border:0px none;">intel</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;color:#dd1144;">"INTEL %p has no MAC address to use</span><span style="margin:0px;padding:0px;border:0px none;color:#dd1144;">\n</span><span style="margin:0px;padding:0px;border:0px none;color:#dd1144;">"</span><span style="margin:0px;padding:0px;border:0px none;">,</span> <span style="margin:0px;padding:0px;border:0px none;">intel</span> <span style="margin:0px;padding:0px;border:0px none;">);</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">return</span> <span style="margin:0px;padding:0px;border:0px none;font-weight:bold;">-</span><span style="margin:0px;padding:0px;border:0px none;">ENOENT</span><span style="margin:0px;padding:0px;border:0px none;">;</span></div><div style="margin:0px;padding:0px 0px 0px 10px;border:0px none;"><span style="margin:0px;padding:0px;border:0px none;">}</span></div><br /> It seems like this is the correct way to do things, as if a user has burned a custom MAC into the EEPROM, then that's the one to use. I assume (though I can't find any info to back this up) that intel burns the default MAC into the eeprom too, and that's why there's MAC addresses in the EEPROM even though I never changed them. Could this issue be down to PCI device enumeration? I.e. the two ports are being enumerated in a different order by iPXE than elsewhere, so even though the auto-assigned mac is correct, when it checks the EEPROM, it's seeing a different value becauseš it thinks port 0 is port 1 and port 1 is 0?<br /> <br /> /Kieran<br /> <br /> Also, oops, forgot to reply to the list,š last time, so list email added back in.<br /> <br /> On 27/07/2012 10:40, Anton D. Kachalov wrote:</div><blockquote cite="mid:137651343382020@webcorp7.yandex-team.ru" type="cite"><pre>EEPROM macs used only when autoloaded is not complain by "is_valid_ether_addr" routine (lines 226-230). Try to add more debug messages here to track why driver going to use EEPROM's MAC instead of autloaded.

27.07.2012, 13:14, "Kieran Evans" <a href="mailto:keyz182@gmail.com"><keyz182@gmail.com></a>:
</pre><blockquote type="cite"><pre>Hmm, it seems that the autoloaded and EEPROM MACs are at odds (I'm the
only person to have touched these servers since they were purchased, and
no modification of the EEPROM has been made, no setting of alternate MAC
addresses etc).

<a href="http://dbyz.co.uk/ipxe1.png">http://dbyz.co.uk/ipxe1.png</a>
<a href="http://dbyz.co.uk/ipxe2.png">http://dbyz.co.uk/ipxe2.png</a>

After seeing that, I can think of two possible temporary workarounds,
but not sure about perminent fixes.

Workaround A: Set the MACs in EEPROM the other way around. (May then
confuse linux, so needs checking)
Workaround B: Compile iPXE with Mac loading from the EEPROM disabled
(Comment out line 223+224 of src/drivers/net/intel.c ?)

Any ideas on a more perminent workaround/fix? I'm fairly lucky as I only
have 4 servers with this NIC/Problem, so modifying the eeprom is only
half an hour of my time, but this could be a much bigger issue elsewhere.

</pre></blockquote></blockquote><br /><p>_______________________________________________<br />ipxe-devel mailing list<br /><a href="mailto:ipxe-devel@lists.ipxe.org">ipxe-devel@lists.ipxe.org</a><br /><a href="https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel">https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel</a></p></blockquote><div>-- <br />Anton D. Kachalov<br /><br />ITO, R&D group, Senior System Engineer<br />Tel: +7 (495) 739-70-00 ext.7613</div>