<html>
<head>
<meta content="text/html; charset=KOI8-R" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">My point in the previous email was that
<span style="color: rgb(51, 51, 51); font-family: Consolas,
'Liberation Mono', Courier, monospace; font-size: 12px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 16px; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform:
none; white-space: pre; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline
!important; float: none; ">intel_fetch_mac_eeprom </span>is
called before <span style="color: rgb(51, 51, 51); font-family:
Consolas, 'Liberation Mono', Courier, monospace; font-size:
12px; font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 16px; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform:
none; white-space: pre; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline
!important; float: none; ">is_valid_ether_addr</span>. If there
is a MAC in the EEPROM, the if statement surounding <span
style="color: rgb(51, 51, 51); font-family: Consolas,
'Liberation Mono', Courier, monospace; font-size: 12px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 16px; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform:
none; white-space: pre; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline
!important; float: none; ">intel_fetch_mac_eeprom </span>retruns
0 from the <span style="color: rgb(153, 0, 0); font-family:
Consolas, 'Liberation Mono', Courier, monospace; font-size:
12px; font-style: normal; font-variant: normal; font-weight:
bold; letter-spacing: normal; line-height: 16px; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform:
none; white-space: pre; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline
!important; float: none; ">intel_fetch_mac </span>function.<br>
<br>
This means that if there's a MAC in eeprom, the <span
style="color: rgb(51, 51, 51); font-family: Consolas,
'Liberation Mono', Courier, monospace; font-size: 12px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 16px; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform:
none; white-space: pre; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline
!important; float: none; ">is_valid_ether_addr</span> function
is never reached, and so the autoloaded MAC is never checked for
validity. <br>
<br>
So any checks I add to is_valid_ether_addr() will never be
reached.<br>
<br>
/Kieran<br>
<br>
On 27/07/2012 11:16, Anton D. Kachalov wrote:<br>
</div>
<blockquote cite="mid:143341343384192@webcorp7.yandex-team.ru"
type="cite">
<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" <a class="moz-txt-link-rfc2396E" href="mailto:keyz182@gmail.com"><keyz182@gmail.com></a>:</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 moz-do-not-send="true" 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 moz-do-not-send="true" href="http://dbyz.co.uk/ipxe1.png">http://dbyz.co.uk/ipxe1.png</a>
<a moz-do-not-send="true" 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 moz-do-not-send="true"
href="mailto:ipxe-devel@lists.ipxe.org">ipxe-devel@lists.ipxe.org</a><br>
<a moz-do-not-send="true"
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>
</blockquote>
<br>
</body>
</html>