* Setting alternate MAC addresses on e1000
@ 2008-04-01 13:15 Carsten Aulbert
2008-04-01 17:17 ` Brandeburg, Jesse
2008-04-08 17:02 ` Andy Gospodarek
0 siblings, 2 replies; 7+ messages in thread
From: Carsten Aulbert @ 2008-04-01 13:15 UTC (permalink / raw)
To: netdev
Hi,
I know that quite a few e1000 experts are reading here, so I hope to
have some luck here:
I need to reprogram the MAC addresses of several 82573E/L NICs. I tried
the obvious approach first using ethtool -E to write the numbers into
the first six bytes and this works quite ok [1], except that I need to
specifically change the second MAC not necessarily the first one. This
approach only changed the first NIC and left the second unchanged.
I've browsed http://download.intel.com/design/network/manuals/31608004.pdf
quite a bit, but except finding that I seem to need to set word 0x37 to
point to 12 free bytes I have not come up with much. For example, I
don't know where I would find those 12 free bytes.
Anyone with a different approach or a hint how to succeed?
TIA
Carsten
[1] Along the lines of
ethtool -E eth0 magic $MAGIC offset 0x0 value 0x${numbers[0]}
[...]
where magic is MAGIC=0x108c8086
However this does not work on eth1 :(
^ permalink raw reply [flat|nested] 7+ messages in thread* RE: Setting alternate MAC addresses on e1000 2008-04-01 13:15 Setting alternate MAC addresses on e1000 Carsten Aulbert @ 2008-04-01 17:17 ` Brandeburg, Jesse 2008-04-02 8:07 ` Carsten Aulbert 2008-04-08 17:02 ` Andy Gospodarek 1 sibling, 1 reply; 7+ messages in thread From: Brandeburg, Jesse @ 2008-04-01 17:17 UTC (permalink / raw) To: Carsten Aulbert, netdev; +Cc: e1000-devel Carsten Aulbert wrote: > where magic is MAGIC=0x108c8086 > > However this does not work on eth1 :( I think you need a different MAGIC for eth1 since they are separate parts (different device ID) with separate eeproms, then the first 6 byte change should work for eth1 too. in the future e1000-devel@lists.sf.net might be more appropriate to Intel specific hardware questions. but copying netdev is still okay. Thanks, Jesse ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting alternate MAC addresses on e1000 2008-04-01 17:17 ` Brandeburg, Jesse @ 2008-04-02 8:07 ` Carsten Aulbert 2008-04-02 17:41 ` Brandeburg, Jesse 0 siblings, 1 reply; 7+ messages in thread From: Carsten Aulbert @ 2008-04-02 8:07 UTC (permalink / raw) To: Brandeburg, Jesse; +Cc: netdev, e1000-devel Hi Jesse, thanks for the hint, I was stupid to think these two NIC are just using the very same EEPROM. Brandeburg, Jesse wrote: > Carsten Aulbert wrote: >> where magic is MAGIC=0x108c8086 >> >> However this does not work on eth1 :( > > I think you need a different MAGIC for eth1 since they are separate > parts (different device ID) with separate eeproms, then the first 6 byte > change should work for eth1 too. > Yes, with MAGIC=0x109a8086 I can set the MAC address of eth1. > in the future e1000-devel@lists.sf.net might be more appropriate to > Intel specific hardware questions. but copying netdev is still okay. Will do, starting with a closely related question: The Intel specs state that word 37H is a pointer to an "alternate MAC address". My boss things it would be wise to let the original MAC address in place and just add another MAC address, so that we can easily revert to the old "official" one by writing 0xffff into that word. Has anyone experience with that approach? In principle that should be easy, however, I don't know where/how to find 6 free bytes from the table given in Intel's docs. Thanks again and hopefully someone has some light for my brain ;) Cheers Carsten ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting alternate MAC addresses on e1000 2008-04-02 8:07 ` Carsten Aulbert @ 2008-04-02 17:41 ` Brandeburg, Jesse 0 siblings, 0 replies; 7+ messages in thread From: Brandeburg, Jesse @ 2008-04-02 17:41 UTC (permalink / raw) To: Carsten Aulbert; +Cc: e1000-devel, netdev Carsten Aulbert wrote: > Yes, with MAGIC=0x109a8086 I can set the MAC address of eth1. good, I think you need to just use that way. > The Intel specs state that word 37H is a pointer to an "alternate MAC > address". My boss things it would be wise to let the original MAC > address in place and just add another MAC address, so that we can > easily revert to the old "official" one by writing 0xffff into that > word. The alternate MAC address typically refers to a MAC used only for management/ASF/IPMI traffic. I don't think that is what you want. According to our internal documents that I have access to, word 37h is not what you think it is on 82573V/L. PXE Words (words 30h thru 3Eh) Words 30h through 3Eh have been reserved for configuration and version values to be used by PXE code. > Has anyone experience with that approach? In principle that should be > easy, however, I don't know where/how to find 6 free bytes from the > table given in Intel's docs. > > Thanks again and hopefully someone has some light for my brain ;) I think that you should stick with programming the original MAC address. Start messing around with other words and you're bound to get yourself into trouble. Jesse ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting alternate MAC addresses on e1000 2008-04-01 13:15 Setting alternate MAC addresses on e1000 Carsten Aulbert 2008-04-01 17:17 ` Brandeburg, Jesse @ 2008-04-08 17:02 ` Andy Gospodarek 2008-04-08 17:26 ` Kok, Auke 1 sibling, 1 reply; 7+ messages in thread From: Andy Gospodarek @ 2008-04-08 17:02 UTC (permalink / raw) To: Carsten Aulbert; +Cc: netdev, bill.hayes On Tue, Apr 01, 2008 at 03:15:54PM +0200, Carsten Aulbert wrote: > Hi, > > I know that quite a few e1000 experts are reading here, so I hope to > have some luck here: > > I need to reprogram the MAC addresses of several 82573E/L NICs. I tried > the obvious approach first using ethtool -E to write the numbers into > the first six bytes and this works quite ok [1], except that I need to > specifically change the second MAC not necessarily the first one. This > approach only changed the first NIC and left the second unchanged. > > I've browsed http://download.intel.com/design/network/manuals/31608004.pdf > quite a bit, but except finding that I seem to need to set word 0x37 to > point to 12 free bytes I have not come up with much. For example, I > don't know where I would find those 12 free bytes. > > Anyone with a different approach or a hint how to succeed? > > TIA > > Carsten > Bill posted a patch for this a while back (but it was not accepted since support for that hardware is offically moving to e1000e). This may be what you want.... Port alternate MAC address support from the sourceforge e1000 driver to the upstream e1000 driver. Signed-off-by: Bill Hayes <bill.hayes@hp.com> --- drivers/net/e1000/e1000_hw.c | 42 +++++++++++++++++++++++++++++++++++++++--- drivers/net/e1000/e1000_hw.h | 2 ++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 8fa0fe4..07e3178 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c @@ -719,6 +719,11 @@ e1000_reset_hw(struct e1000_hw *hw) DEBUGOUT("Masking off all interrupts\n"); E1000_WRITE_REG(hw, IMC, 0xffffffff); + if (hw->mac_type == e1000_82571 && hw->alt_mac_addr_is_present) { + hw->laa_is_present = 1; + e1000_rar_set(hw, hw->mac_addr, E1000_RAR_ENTRIES - 1); + } + /* Clear any pending interrupt events. */ icr = E1000_READ_REG(hw, ICR); @@ -5693,11 +5698,41 @@ e1000_read_mac_addr(struct e1000_hw * hw) { uint16_t offset; uint16_t eeprom_data, i; + u16 mac_addr_offset = 0; DEBUGFUNC("e1000_read_mac_addr"); + if (hw->mac_type == e1000_82571) { + /* Check for an alternate MAC address. An alternate MAC address can + * be setup by pre-boot software and must be treated like a permanent + * address and must override the actual permanent MAC address. */ + if (e1000_read_eeprom(hw, EEPROM_ALT_MAC_ADDR_PTR, 1, + &mac_addr_offset) < 0) { + DEBUGOUT("EEPROM Read Error\n"); + return -E1000_ERR_EEPROM; + } + if (mac_addr_offset == 0xFFFF) + mac_addr_offset = 0; + + if (mac_addr_offset) { + if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) + mac_addr_offset += NODE_ADDRESS_SIZE/sizeof(u16); + + /* make sure we have a valid mac address here before using it */ + if (e1000_read_eeprom(hw, mac_addr_offset, 1, &eeprom_data) < 0) { + DEBUGOUT("EEPROM Read Error\n"); + return -E1000_ERR_EEPROM; + } + if (eeprom_data & 0x0001) + mac_addr_offset = 0; + } + + if (mac_addr_offset) + hw->alt_mac_addr_is_present = 1; + } + for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) { - offset = i >> 1; + offset = mac_addr_offset + (i >> 1); if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { DEBUGOUT("EEPROM Read Error\n"); return -E1000_ERR_EEPROM; @@ -5713,8 +5748,9 @@ e1000_read_mac_addr(struct e1000_hw * hw) case e1000_82546_rev_3: case e1000_82571: case e1000_80003es2lan: - if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) - hw->perm_mac_addr[5] ^= 0x01; + if (!mac_addr_offset && + (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) + hw->perm_mac_addr[5] ^= 0x01; break; } diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index a2a86c5..e18760d 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h @@ -1456,6 +1456,7 @@ struct e1000_hw { boolean_t tbi_compatibility_en; boolean_t tbi_compatibility_on; boolean_t laa_is_present; + boolean_t alt_mac_addr_is_present; boolean_t phy_reset_disable; boolean_t initialize_hw_bits_disable; boolean_t fc_send_xon; @@ -2286,6 +2287,7 @@ struct e1000_host_command_info { #define EEPROM_INIT_CONTROL3_PORT_A 0x0024 #define EEPROM_CFG 0x0012 #define EEPROM_FLASH_VERSION 0x0032 +#define EEPROM_ALT_MAC_ADDR_PTR 0x0037 #define EEPROM_CHECKSUM_REG 0x003F #define E1000_EEPROM_CFG_DONE 0x00040000 /* MNG config cycle done */ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Setting alternate MAC addresses on e1000 2008-04-08 17:02 ` Andy Gospodarek @ 2008-04-08 17:26 ` Kok, Auke 2008-04-08 17:45 ` Carsten Aulbert 0 siblings, 1 reply; 7+ messages in thread From: Kok, Auke @ 2008-04-08 17:26 UTC (permalink / raw) To: Andy Gospodarek; +Cc: Carsten Aulbert, netdev, bill.hayes Andy Gospodarek wrote: > On Tue, Apr 01, 2008 at 03:15:54PM +0200, Carsten Aulbert wrote: >> Hi, >> >> I know that quite a few e1000 experts are reading here, so I hope to >> have some luck here: >> >> I need to reprogram the MAC addresses of several 82573E/L NICs. I tried >> the obvious approach first using ethtool -E to write the numbers into >> the first six bytes and this works quite ok [1], except that I need to >> specifically change the second MAC not necessarily the first one. This >> approach only changed the first NIC and left the second unchanged. >> >> I've browsed http://download.intel.com/design/network/manuals/31608004.pdf >> quite a bit, but except finding that I seem to need to set word 0x37 to >> point to 12 free bytes I have not come up with much. For example, I >> don't know where I would find those 12 free bytes. >> >> Anyone with a different approach or a hint how to succeed? >> >> TIA >> >> Carsten >> > > Bill posted a patch for this a while back (but it was not accepted since > support for that hardware is offically moving to e1000e). This may be > what you want.... yeah I thought of that as well and after digging through the documentation I don't think this will work for 82573's - it seems that only 82571 hardware supports this feature, which is not what Carsten needs. as stated above, the alternate eeprom layout of the 82573 seems to also indicate that. Auke > Port alternate MAC address support from the sourceforge > e1000 driver to the upstream e1000 driver. > > Signed-off-by: Bill Hayes <bill.hayes@hp.com> > --- > > drivers/net/e1000/e1000_hw.c | 42 +++++++++++++++++++++++++++++++++++++++--- > drivers/net/e1000/e1000_hw.h | 2 ++ > 2 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c > index 8fa0fe4..07e3178 100644 > --- a/drivers/net/e1000/e1000_hw.c > +++ b/drivers/net/e1000/e1000_hw.c > @@ -719,6 +719,11 @@ e1000_reset_hw(struct e1000_hw *hw) > DEBUGOUT("Masking off all interrupts\n"); > E1000_WRITE_REG(hw, IMC, 0xffffffff); > > + if (hw->mac_type == e1000_82571 && hw->alt_mac_addr_is_present) { > + hw->laa_is_present = 1; > + e1000_rar_set(hw, hw->mac_addr, E1000_RAR_ENTRIES - 1); > + } > + > /* Clear any pending interrupt events. */ > icr = E1000_READ_REG(hw, ICR); > > @@ -5693,11 +5698,41 @@ e1000_read_mac_addr(struct e1000_hw * hw) > { > uint16_t offset; > uint16_t eeprom_data, i; > + u16 mac_addr_offset = 0; > > DEBUGFUNC("e1000_read_mac_addr"); > > + if (hw->mac_type == e1000_82571) { > + /* Check for an alternate MAC address. An alternate MAC address can > + * be setup by pre-boot software and must be treated like a permanent > + * address and must override the actual permanent MAC address. */ > + if (e1000_read_eeprom(hw, EEPROM_ALT_MAC_ADDR_PTR, 1, > + &mac_addr_offset) < 0) { > + DEBUGOUT("EEPROM Read Error\n"); > + return -E1000_ERR_EEPROM; > + } > + if (mac_addr_offset == 0xFFFF) > + mac_addr_offset = 0; > + > + if (mac_addr_offset) { > + if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) > + mac_addr_offset += NODE_ADDRESS_SIZE/sizeof(u16); > + > + /* make sure we have a valid mac address here before using it */ > + if (e1000_read_eeprom(hw, mac_addr_offset, 1, &eeprom_data) < 0) { > + DEBUGOUT("EEPROM Read Error\n"); > + return -E1000_ERR_EEPROM; > + } > + if (eeprom_data & 0x0001) > + mac_addr_offset = 0; > + } > + > + if (mac_addr_offset) > + hw->alt_mac_addr_is_present = 1; > + } > + > for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) { > - offset = i >> 1; > + offset = mac_addr_offset + (i >> 1); > if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { > DEBUGOUT("EEPROM Read Error\n"); > return -E1000_ERR_EEPROM; > @@ -5713,8 +5748,9 @@ e1000_read_mac_addr(struct e1000_hw * hw) > case e1000_82546_rev_3: > case e1000_82571: > case e1000_80003es2lan: > - if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) > - hw->perm_mac_addr[5] ^= 0x01; > + if (!mac_addr_offset && > + (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) > + hw->perm_mac_addr[5] ^= 0x01; > break; > } > > diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h > index a2a86c5..e18760d 100644 > --- a/drivers/net/e1000/e1000_hw.h > +++ b/drivers/net/e1000/e1000_hw.h > @@ -1456,6 +1456,7 @@ struct e1000_hw { > boolean_t tbi_compatibility_en; > boolean_t tbi_compatibility_on; > boolean_t laa_is_present; > + boolean_t alt_mac_addr_is_present; > boolean_t phy_reset_disable; > boolean_t initialize_hw_bits_disable; > boolean_t fc_send_xon; > @@ -2286,6 +2287,7 @@ struct e1000_host_command_info { > #define EEPROM_INIT_CONTROL3_PORT_A 0x0024 > #define EEPROM_CFG 0x0012 > #define EEPROM_FLASH_VERSION 0x0032 > +#define EEPROM_ALT_MAC_ADDR_PTR 0x0037 > #define EEPROM_CHECKSUM_REG 0x003F > > #define E1000_EEPROM_CFG_DONE 0x00040000 /* MNG config cycle done */ > > - > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting alternate MAC addresses on e1000 2008-04-08 17:26 ` Kok, Auke @ 2008-04-08 17:45 ` Carsten Aulbert 0 siblings, 0 replies; 7+ messages in thread From: Carsten Aulbert @ 2008-04-08 17:45 UTC (permalink / raw) To: Kok, Auke; +Cc: Andy Gospodarek, netdev, bill.hayes Hi all, Kok, Auke schrieb: >> Bill posted a patch for this a while back (but it was not accepted since >> support for that hardware is offically moving to e1000e). This may be >> what you want.... > > yeah I thought of that as well and after digging through the documentation I don't > think this will work for 82573's - it seems that only 82571 hardware supports this > feature, which is not what Carsten needs. > > as stated above, the alternate eeprom layout of the 82573 seems to also indicate that. Thanks for not forgetting me :) I wasn't able to reply yet because I'm buried in work, but the initial tip, to just use a different ID for the second device worked already. Though I don't use the alternate MAC possibility, I can change the MAC address easily - and already did that on ~280 nodes on Sunday. So, I would say, please consider my problem solved. Thanks to all of you who replied and the rest for the thoughts and the software! Cheers Carsten ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-04-08 17:45 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-01 13:15 Setting alternate MAC addresses on e1000 Carsten Aulbert 2008-04-01 17:17 ` Brandeburg, Jesse 2008-04-02 8:07 ` Carsten Aulbert 2008-04-02 17:41 ` Brandeburg, Jesse 2008-04-08 17:02 ` Andy Gospodarek 2008-04-08 17:26 ` Kok, Auke 2008-04-08 17:45 ` Carsten Aulbert
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).