[ipxe-devel] Intel 82576 MAC swapping

Anton D. Kachalov mouse at yandex-team.ru
Fri Jul 27 17:31:13 UTC 2012


Could you paste eeprom dumps from those 4 ports NICs?


27.07.2012, 20:59, "Kieran Evans" <keyz182 at gmail.com>:
> Looks like the validity check is necessary. On some other interfaces
> that are 4 port 82576s they were loading FF:FF:FF:FF:FF:FF from eeprom
> and using it.
>
> I've attached (and uploaded here https://gist.github.com/3189152) a
> patch with a validity check that works for those interfaces.
>
> There's 12 interfaces on this server though, so capturing the output is
> a little difficult, I'll try to get a video of it so I can pull out some
> frames to see the output.
>
> Here's the end of the debug output for now (the first two sets of output
> are the last two problem ports) http://dbyz.co.uk/ipxe7.png
>
> Here's the output from ifstat on that server (at least, the last 4/5ths
> of it) http://dbyz.co.uk/ipxe8.png
>
> /Kieran
>
> On 27/07/2012 16:38, Anton D. Kachalov wrote:
>
>>  Here is another one without shifting an offset.
>>
>>  27.07.2012, 19:36, "Anton D. Kachalov" <mouse at yandex-team.ru>:
>>>  Kieran,
>>>
>>>  regarding to "igb" driver, offset (in words) to EEPROM's MAC should be placed at 0x37 (in words) of EEPROM (page 178, table 6-1). It is 0xffff.
>>>
>>>  Try the attached patch.
>>>
>>>  I accidentally has added left shift by 2 instead of 1 :))
>>>>>      if ( ( rc = nvs_read ( &intel->eeprom, 0x37 << 2 /* NVM_ALT_MAC_ADDR_PTR */,
>>>>>
>>>>>      to this one:
>>>>>
>>>>>      if ( ( rc = nvs_read ( &intel->eeprom, 0x37 << 1 /* NVM_ALT_MAC_ADDR_PTR */,
>>>  27.07.2012, 19:01, "Kieran Evans" <keyz182 at gmail.com>:
>>>>     Anton, no luck there I'm afraid.
>>>>
>>>>     http://dbyz.co.uk/ipxe4.png
>>>>
>>>>     If you check the EEPROM dumps I sent earlier, you'll see that there is
>>>>     only one MAC in the whole EEPROM. Looking for it at different offsets
>>>>     will return garbage.
>>>>
>>>>     Just to be sure, I dumped the EEPROM from both interfaces (both linked
>>>>     in an earlier email) and they are identical, so they are sharing the
>>>>     same EEPROM.
>>>>
>>>>     /Kieran
>>>>
>>>>     On 27/07/2012 14:55, Anton D. Kachalov wrote:
>>>>>      Kieran,
>>>>>
>>>>>      my fault.
>>>>>
>>>>>      Fix this line:
>>>>>
>>>>>      if ( ( rc = nvs_read ( &intel->eeprom, 0x37 /* NVM_ALT_MAC_ADDR_PTR */,
>>>>>
>>>>>      to this one:
>>>>>
>>>>>      if ( ( rc = nvs_read ( &intel->eeprom, 0x37 << 2 /* NVM_ALT_MAC_ADDR_PTR */,
>>>  --
>>>  Anton D. Kachalov
>>>
>>>  ITO, R&D group, Senior System Engineer
>>>  Tel: +7 (495) 739-70-00 ext.7613
>>>  _______________________________________________
>>>  ipxe-devel mailing list
>>>  ipxe-devel at lists.ipxe.org
>>>  https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
>
> --- a/src/drivers/net/intel.c
> +++ b/src/drivers/net/intel.c
> @@ -181,21 +181,41 @@ static int intel_init_eeprom ( struct intel_nic *intel ) {
>  static int intel_fetch_mac_eeprom ( struct intel_nic *intel,
>                                     uint8_t *hw_addr ) {
>         int rc;
> +       uint16_t offset;
>
>         /* Initialise EEPROM */
>         if ( ( rc = intel_init_eeprom ( intel ) ) != 0 )
>                 return rc;
>
> +        if ( ( rc = nvs_read ( &intel->eeprom, 0x37 /* NVM_ALT_MAC_ADDR_PTR */,
> +                               &offset, sizeof(offset) ) ) != 0 ) {
> +                DBGC ( intel, "INTEL %p could not read EEPROM alternate MAC"
> +                       "address PTR: %s\n", intel, strerror ( rc ) );
> +                return rc;
> +        }
> +
> +        if (offset == 0xffff) {
> +                /* There is no Alternate MAC Address */
> +                return -1;
> +        }
> +
> +        if (intel->port == 1)
> +                offset += 3; /* E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 */
> +
>         /* Read base MAC address from EEPROM */
> -       if ( ( rc = nvs_read ( &intel->eeprom, INTEL_EEPROM_MAC,
> +       if ( ( rc = nvs_read ( &intel->eeprom, offset,
>                                hw_addr, ETH_ALEN ) ) != 0 ) {
>                 DBGC ( intel, "INTEL %p could not read EEPROM base MAC "
>                        "address: %s\n", intel, strerror ( rc ) );
>                 return rc;
>         }
>
> -       /* Adjust MAC address for multi-port devices */
> -       hw_addr[ETH_ALEN-1] ^= intel->port;
> +        if ( ! is_valid_ether_addr ( hw_addr ) ) {
> +                DBGC ( intel, "INTEL %p EEPROM MAC %s Tested as invalid, skipping ",
> +                        intel, eth_ntoa ( hw_addr ) );
> +                return -1;
> +        }
> +
>
>         DBGC ( intel, "INTEL %p has EEPROM MAC address %s (port %d)\n",
>                intel, eth_ntoa ( hw_addr ), intel->port );

-- 
Anton D. Kachalov

ITO, R&D group, Senior System Engineer
Tel: +7 (495) 739-70-00 ext.7613



More information about the ipxe-devel mailing list