Our 1 Gigabit and 10 Gigabit products have some specific access rules.  The manuals outline the details, but they are all located in the definitions chapter and I’ve skipped over my fair share of those types of chapters.  This blog will cover the when, where and why of these rules and where to watch out in your implementation.

 

Why is usually a late question to ask, but we’re starting with it.  All the MAC registers are 32 bit, dword accesses.  Some registers (like the VLAN and multicast hash tables) are much bigger, but you still access them one dword at a time.  Outw, UINT32, use what you must, but make sure it does an atomic 32 bit read of the register.  Anything bigger or smaller will not latch the internal logic and it won’t complete.  Why 32 bits?  It makes the access engine very straightforward and it keeps the MAC logic discreet.  By not having byte, or qword accesses available, we can keep the MAC register logic down. That means fewer gates and that means smaller products and less heat to dissipate.

 

So when doing accesses to registers that “span” across two 32 bit registers (like RAR and some stats registers) read the lower dword first.  This will help avoid carries from the lower register to the upper register during the time between the two reads.  When writing to a register that spans, write the latching part last.  In the case of the RAR, there is an “Address valid” bit.  If you write that first, there will be a timeframe (albeit small) that half right addresses will be valid.

 

That’s for the MAC registers.  Now to deal with the NVM/EEPROM.  This is where bits, bytes and words really get messy.  Most NVM devices are expressed as size X bits.  Most of our documentation uses words.  Tools like ethtool use accesses in bytes.  Outch!  Most engineers can do the math in their head, but with some of our features (iSCSI, management) requiring certain sizes of NVM, missing the size means missing the feature.  Not pretty.  To make matters worse, there are byte swapping issues when you start talking about word vs byte.  X Y become YX when reading words.  Since the manuals are in words, you need to keep track.  The Intel-provided tools do it all in words, but ethtool and the Linux guys like it in bytes.  A script should be able to keep track of it for you.

 

Being aware of the access size requirements the Intel® Ethernet devices have will keep you from misreading the NVM or not being able to get data out of the device.  If you have any tips for the NVM or the registers let me know in the comments!

 

Thanks for using Intel® Ethernet.