Discussion:
Wrong EEMNGCNF register
(too old to reply)
Hodek, Roman
2015-09-14 11:15:39 UTC
Permalink
Hello there!

I've recently stumbled about the fact that igb driver uses a wrong EEMNGCTL
register for some mac types.

This register is used in e1000_82575.c:igb_get_cfg_done_82575() and defined in
e1000_regs.h:

#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */

But at least my i210 docs tell me a different offset for this register, 0x12030
to be exact. So I've added some code to use the correct register at least for
the Springville in my application (0x1533):

--- a/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-08
19:15:29.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-11
16:41:51.000000000 +0200
@@ -1259,8 +1258,18 @@
{
s32 timeout = PHY_CFG_TIMEOUT;
s32 ret_val = 0;
+ u32 reg;
u32 mask = E1000_NVM_CFG_DONE_PORT_0;

+ switch (hw->mac.type) {
+ case e1000_i210:
+ reg = E1000_EEMNGCTL_I210;
+ break;
+ default:
+ reg = E1000_EEMNGCTL;
+ break;
+ }
+
if (hw->bus.func == 1)
mask = E1000_NVM_CFG_DONE_PORT_1;
else if (hw->bus.func == E1000_FUNC_2)
@@ -1269,7 +1278,7 @@
mask = E1000_NVM_CFG_DONE_PORT_3;

while (timeout) {
- if (rd32(E1000_EEMNGCTL) & mask)
+ if (rd32(reg) & mask)
break;
usleep_range(1000,2000);
timeout--;
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:27:55.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:42:02.000000000 +0200
@@ -70,6 +70,7 @@
#define E1000_PBS 0x01008 /* Packet Buffer Size */
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
#define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
+#define E1000_EEMNGCTL_I210 0x12030 /* MNG EEprom Control */
#define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
#define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
#define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */


With that change, I can save ~ 200ms while turning on Ethernet, which otherwise
get lost while waiting for the timeout.

However, I don't know which MAC types are really affected by the move of
EEMNGCTL. Maybe it's better to use a condition like (hw->mac.type >=
e1000_i210) or similar, or to expand the cases in the switch stmt. I think you
might know better ;-)

Roman

------------------------------------------------------------------------------
Fujinaka, Todd
2015-09-14 14:36:31 UTC
Permalink
Thanks! I'll look into this today.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
***@intel.com
(503) 712-4565

-----Original Message-----
From: Hodek, Roman [mailto:***@siemens.com]
Sent: Monday, September 14, 2015 4:16 AM
To: e1000-***@lists.sourceforge.net
Subject: [E1000-devel] Wrong EEMNGCNF register

Hello there!

I've recently stumbled about the fact that igb driver uses a wrong EEMNGCTL register for some mac types.

This register is used in e1000_82575.c:igb_get_cfg_done_82575() and defined in
e1000_regs.h:

#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */

But at least my i210 docs tell me a different offset for this register, 0x12030 to be exact. So I've added some code to use the correct register at least for the Springville in my application (0x1533):

--- a/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-08
19:15:29.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-11
16:41:51.000000000 +0200
@@ -1259,8 +1258,18 @@
{
s32 timeout = PHY_CFG_TIMEOUT;
s32 ret_val = 0;
+ u32 reg;
u32 mask = E1000_NVM_CFG_DONE_PORT_0;

+ switch (hw->mac.type) {
+ case e1000_i210:
+ reg = E1000_EEMNGCTL_I210;
+ break;
+ default:
+ reg = E1000_EEMNGCTL;
+ break;
+ }
+
if (hw->bus.func == 1)
mask = E1000_NVM_CFG_DONE_PORT_1;
else if (hw->bus.func == E1000_FUNC_2) @@ -1269,7 +1278,7 @@
mask = E1000_NVM_CFG_DONE_PORT_3;

while (timeout) {
- if (rd32(E1000_EEMNGCTL) & mask)
+ if (rd32(reg) & mask)
break;
usleep_range(1000,2000);
timeout--;
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:27:55.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:42:02.000000000 +0200
@@ -70,6 +70,7 @@
#define E1000_PBS 0x01008 /* Packet Buffer Size */
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ #define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
+#define E1000_EEMNGCTL_I210 0x12030 /* MNG EEprom Control */
#define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
#define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
#define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */


With that change, I can save ~ 200ms while turning on Ethernet, which otherwise get lost while waiting for the timeout.

However, I don't know which MAC types are really affected by the move of EEMNGCTL. Maybe it's better to use a condition like (hw->mac.type >=
e1000_i210) or similar, or to expand the cases in the switch stmt. I think you might know better ;-)

Roman
Fujinaka, Todd
2015-09-17 18:26:51 UTC
Permalink
Give me some time on this. I'm not sure if I found an error in our documentation or not.

Thanks.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
***@intel.com
(503) 712-4565

-----Original Message-----
From: Fujinaka, Todd [mailto:***@intel.com]
Sent: Monday, September 14, 2015 7:37 AM
To: Hodek, Roman; e1000-***@lists.sourceforge.net
Subject: Re: [E1000-devel] Wrong EEMNGCNF register

Thanks! I'll look into this today.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
***@intel.com
(503) 712-4565

-----Original Message-----
From: Hodek, Roman [mailto:***@siemens.com]
Sent: Monday, September 14, 2015 4:16 AM
To: e1000-***@lists.sourceforge.net
Subject: [E1000-devel] Wrong EEMNGCNF register

Hello there!

I've recently stumbled about the fact that igb driver uses a wrong EEMNGCTL register for some mac types.

This register is used in e1000_82575.c:igb_get_cfg_done_82575() and defined in
e1000_regs.h:

#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */

But at least my i210 docs tell me a different offset for this register, 0x12030 to be exact. So I've added some code to use the correct register at least for the Springville in my application (0x1533):

--- a/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-08
19:15:29.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-11
16:41:51.000000000 +0200
@@ -1259,8 +1258,18 @@
{
s32 timeout = PHY_CFG_TIMEOUT;
s32 ret_val = 0;
+ u32 reg;
u32 mask = E1000_NVM_CFG_DONE_PORT_0;

+ switch (hw->mac.type) {
+ case e1000_i210:
+ reg = E1000_EEMNGCTL_I210;
+ break;
+ default:
+ reg = E1000_EEMNGCTL;
+ break;
+ }
+
if (hw->bus.func == 1)
mask = E1000_NVM_CFG_DONE_PORT_1;
else if (hw->bus.func == E1000_FUNC_2) @@ -1269,7 +1278,7 @@
mask = E1000_NVM_CFG_DONE_PORT_3;

while (timeout) {
- if (rd32(E1000_EEMNGCTL) & mask)
+ if (rd32(reg) & mask)
break;
usleep_range(1000,2000);
timeout--;
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:27:55.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:42:02.000000000 +0200
@@ -70,6 +70,7 @@
#define E1000_PBS 0x01008 /* Packet Buffer Size */
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ #define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
+#define E1000_EEMNGCTL_I210 0x12030 /* MNG EEprom Control */
#define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
#define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
#define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */


With that change, I can save ~ 200ms while turning on Ethernet, which otherwise get lost while waiting for the timeout.

However, I don't know which MAC types are really affected by the move of EEMNGCTL. Maybe it's better to use a condition like (hw->mac.type >=
e1000_i210) or similar, or to expand the cases in the switch stmt. I think you might know better ;-)

Roman

------------------------------------------------------------------------------
_______________________________________________
E1000-devel mailing list
E1000-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired

------------------------------------------------------------------------------
_______________________________________________
E1000-devel mailing list
E1000-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Hodek, Roman
2015-09-18 06:31:28 UTC
Permalink
Post by Fujinaka, Todd
Give me some time on this. I'm not sure if I found an error in our documentation or not.
No problem, I'm not in a hurry ;-)

Roman

------------------------------------------------------------------------------
Loading...