<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">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>
      <pre style="margin: 0px; padding: 0px; border: 0px; font-size: 12px; font-family: Consolas, 'Liberation Mono', Courier, monospace; color: rgb(51, 51, 51); 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; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="line" id="LC212" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; "><span class="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">static</span> <span class="kt" style="margin: 0px; padding: 0px; border: 0px; color: rgb(68, 85, 136); font-weight: bold; ">int</span> <span class="nf" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 0, 0); font-weight: bold; ">intel_fetch_mac</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="k" style="margin: 0px; paddi
ng: 0px; border: 0px; font-weight: bold; ">struct</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel_nic</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">*</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="kt" style="margin: 0px; padding: 0px; border: 0px; color: rgb(68, 85, 136); font-weight: bold; ">uint8_t</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">*</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">hw_addr</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">{</span></div><div class="line" id="LC213" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">     <span class="k" style="margin: 0px; padding: 0px; border: 0px; font-weight
: bold; ">union</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel_receive_address</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">mac</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">;</span></div><div class="line" id="LC214" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">      <span class="kt" style="margin: 0px; padding: 0px; border: 0px; color: rgb(68, 85, 136); font-weight: bold; ">int</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">rc</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">;</span></div><div class="line" id="LC215" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">
</div><div class="line" id="LC216" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">     <span class="cm" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 153, 136); font-style: italic; ">/* Read current address from RAL0/RAH0 */</span></div><div class="line" id="LC217" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">    <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">mac</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">reg</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">low</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">cpu_to_le32</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" s
tyle="margin: 0px; padding: 0px; border: 0px; ">readl</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel</span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">-></span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">regs</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">+</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">INTEL_RAL0</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">);</span></div><div class="line" id="LC218" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">     <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">mac</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">.</span><span class="n" style="margin: 0px; padding
: 0px; border: 0px; ">reg</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">high</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">cpu_to_le32</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">readl</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel</span><span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">-></span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">regs</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">+</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">INTEL
_RAH0</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">);</span></div><div class="line" id="LC219" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">      <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">DBGC</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="s" style="margin: 0px; padding: 0px; border: 0px; color: rgb(221, 17, 68); ">"INTEL %p has autoloaded MAC address %s</span><span class="se" style="margin: 0px; padding: 0px; border: 0px; color: rgb(221, 17, 68); ">\n</span><span class="s" style="margin: 0px; padding: 0px; border: 0px; color: rgb(221, 17, 68); ">"</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span></div><div class="line" id="LC
220" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">          <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">eth_ntoa</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">mac</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">raw</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">);</span></div><div class="line" id="LC221" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">
</div><div class="line" id="LC222" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">     <span class="cm" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 153, 136); font-style: italic; ">/* Try to read address from EEPROM */</span></div><div class="line" id="LC223" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">        <span class="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">if</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">rc</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">=</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel_fetch_mac_eeprom</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">
intel</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">hw_addr</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">==</span> <span class="mi" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span></div><div class="line" id="LC224" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">          <span class="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">return</span> <span class="mi" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); ">0</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">;</span></div><div class="line" id="LC225" style="margin
: 0px; padding: 0px 0px 0px 10px; border: 0px; ">
</div><div class="line" id="LC226" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">     <span class="cm" style="margin: 0px; padding: 0px; border: 0px; color: rgb(153, 153, 136); font-style: italic; ">/* Use current address if valid */</span></div><div class="line" id="LC227" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">   <span class="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">if</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">is_valid_ether_addr</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">mac</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">raw</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="p"
 style="margin: 0px; padding: 0px; border: 0px; ">)</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">{</span></div><div class="line" id="LC228" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">              <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">memcpy</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">hw_addr</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">mac</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">.</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">raw</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">ETH_ALEN</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">);</span></div><di
v class="line" id="LC229" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">               <span class="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">return</span> <span class="mi" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 153, 153); ">0</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">;</span></div><div class="line" id="LC230" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">       <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">}</span></div><div class="line" id="LC231" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">
</div><div class="line" id="LC232" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">     <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">DBGC</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">(</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="s" style="margin: 0px; padding: 0px; border: 0px; color: rgb(221, 17, 68); ">"INTEL %p has no MAC address to use</span><span class="se" style="margin: 0px; padding: 0px; border: 0px; color: rgb(221, 17, 68); ">\n</span><span class="s" style="margin: 0px; padding: 0px; border: 0px; color: rgb(221, 17, 68); ">"</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">,</span> <span class="n" style="margin: 0px; padding: 0px; border: 0px; ">intel</span> <span class="p" style="margin: 0px; padding: 0px; border: 0px; ">);</span></div><div class="line" id="LC233" style=
"margin: 0px; padding: 0px 0px 0px 10px; border: 0px; ">   <span class="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">return</span> <span class="o" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold; ">-</span><span class="n" style="margin: 0px; padding: 0px; border: 0px; ">ENOENT</span><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">;</span></div><div class="line" id="LC234" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px; "><span class="p" style="margin: 0px; padding: 0px; border: 0px; ">}</span></div></pre>
      <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:<br>
    </div>
    <blockquote cite="mid:137651343382020@webcorp7.yandex-team.ru"
      type="cite">
      <pre wrap="">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 class="moz-txt-link-rfc2396E" href="mailto:keyz182@gmail.com"><keyz182@gmail.com></a>:
</pre>
      <blockquote type="cite">
        <pre wrap="">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 class="moz-txt-link-freetext" href="http://dbyz.co.uk/ipxe1.png">http://dbyz.co.uk/ipxe1.png</a>
<a class="moz-txt-link-freetext" 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>
      <pre wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>