Skip to contentSkip to conversation

e1000: LED indicates trouble, and [PATCH] enable/disable of force-link-up

PATCH NAK [email protected] 2 participants 4 messages Dec 3, 2008 – Dec 12, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: Hiroki Ohashi <[email protected]>

Hi all,

I faced the following situations.
The LED of NIC was indicated, even when the system was not linked the network (auto-negotiation failed or link partner cannot auto-negotiate).
LED should be indicate only when the network was linked. And so, it is a problem that LED indicates.

I think the indicating the LED is a problem for maintenance. I cannot know the condition of the link, because I confirm to link up by LED's indication.

We are using 82571EB ethernet controler and serdes interface.

I think this problem is caused by the e1000 device driver setting LU and SLU bits in the interface and forcing the link to go up.
I deleted this logic. (the following modification.) Then, LED was turned off.

================================

e1000_hw.c renamed from e1000_hw.c.org +2 -0
@@ -3069,6 +3069,7 @@I
             hw->autoneg_failed = 1;
             return 0;
         }
+#if 0
         DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
 
         /* Disable auto-negotiation in the TXCW register */
@@ -3078,6 +3079,7 @@
         ctrl = E1000_READ_REG(hw, CTRL);
         ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
         E1000_WRITE_REG(hw, CTRL, ctrl);
+#endif
 
         /* Configure Flow Control after forcing link up. */
         ret_val = e1000_config_fc_after_link_up(hw);

================================

I think the e1000 driver should enable/disable force-link-up depending on the condition of the link.
But I don't know a good way to do this.
If you have any good ideas, please let me know.

As a temporary idea, I thought of a way of adding a module parameter to control enable/disable force-link-up.
The patch is as follows.

This patch adds "disable_force_link_up_when_autoneg_failed" as module parameter. When this is 0, force-link-up is disable.

From: Hiroshi Shimamoto <[email protected]>

================================

net/e1000/e1000_hw.h renamed from net/e1000/e1000_hw.h.org +26 -1
@@ -1469,6 +1469,7 @@ struct e1000_hw {
 	bool			has_manc2h;
 	bool			rx_needs_kicking;
 	bool			has_smbus;
+	bool			disable_force_link_up_when_autoneg_failed;
 };
--- drivers/net/e1000/e1000_param.c.org
+++ drivers/net/e1000/e1000_param.c
@@ -196,6 +196,13 @@ E1000_PARAM(SmartPowerDownEnable, "Enabl
  */
 E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
 
+/* Enable Force Link Up When AutoNeg Failed
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 1 (force link up enabled)  */
+E1000_PARAM(EnableForceLinkOnSERDES, "Enable force link up when AutoNeg failed");
+
 struct e1000_option {
 	enum { enable_option, range_option, list_option } type;
 	const char *name;
@@ -534,6 +541,23 @@ void __devinit e1000_check_options(struc
 			adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def;
 		}
 	}
+	{ /* Enable Force Link Up When AutoNeg Failed */
+		struct e1000_option opt = {
+			.type = enable_option,
+			.name = "Enable Force Link Up When AutoNeg Failed",
+			.err  = "defaulting to Enabled",
+			.def  = OPTION_ENABLED
+		};
+
+		if (num_EnableForceLinkOnSERDES > bd) {
+			unsigned int force_link_up = EnableForceLinkOnSERDES [bd];
+			e1000_validate_option(&force_link_up, &opt, adapter);
+			adapter->hw.disable_force_link_up_when_autoneg_failed = !force_link_up;
+
+		} else {
+			adapter->hw.disable_force_link_up_when_autoneg_failed = !opt.def;
+		}
+	}
 
 	switch (adapter->hw.media_type) {
 	case e1000_media_type_fiber:
net/e1000/e1000_hw.c renamed from net/e1000/e1000_hw.c.org +6 -0
@@ -3062,6 +3062,12 @@ s32 e1000_check_for_link(struct e1000_hw
             hw->autoneg_failed = 1;
             return 0;
         }
+
+        if (hw->disable_force_link_up_when_autoneg_failed) {
+            DEBUGOUT("Force Link Up Disabled\n");
+            return -E1000_ERR_PHY;
+        }
+
         DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
 
         /* Disable auto-negotiation in the TXCW register */

================================

#1 lore raw
Quoted 124 lines · On Tue, Dec 2, 2008 at 11:36 PM, <[email protected]> wrote:

From: Hiroki Ohashi <[email protected]>

Hi all,

I faced the following situations.
The LED of NIC was indicated, even when the system was not linked the network (auto-negotiation failed or link partner cannot auto-negotiate).
LED should be indicate only when the network was linked. And so, it is a problem that LED indicates.

I think the indicating the LED is a problem for maintenance. I cannot know the condition of the link, because I confirm to link up by LED's indication.

We are using 82571EB ethernet controler and serdes interface.

I think this problem is caused by the e1000 device driver setting LU and SLU bits in the interface and forcing the link to go up.
I deleted this logic. (the following modification.) Then, LED was turned off.

================================

e1000_hw.c renamed from e1000_hw.c.org +2 -0
@@ -3069,6 +3069,7 @@I
            hw->autoneg_failed = 1;
            return 0;
        }
+#if 0
        DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
 
        /* Disable auto-negotiation in the TXCW register */
@@ -3078,6 +3079,7 @@
        ctrl = E1000_READ_REG(hw, CTRL);
        ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
        E1000_WRITE_REG(hw, CTRL, ctrl);
+#endif
 
        /* Configure Flow Control after forcing link up. */
        ret_val = e1000_config_fc_after_link_up(hw);

================================

I think the e1000 driver should enable/disable force-link-up depending on the condition of the link.
But I don't know a good way to do this.
If you have any good ideas, please let me know.

As a temporary idea, I thought of a way of adding a module parameter to control enable/disable force-link-up.
The patch is as follows.

This patch adds "disable_force_link_up_when_autoneg_failed" as module parameter. When this is 0, force-link-up is disable.

From: Hiroshi Shimamoto <[email protected]>

================================

net/e1000/e1000_hw.h renamed from net/e1000/e1000_hw.h.org +1 -0
@@ -1469,6 +1469,7 @@ struct e1000_hw {
       bool                    has_manc2h;
       bool                    rx_needs_kicking;
       bool                    has_smbus;
+       bool                    disable_force_link_up_when_autoneg_failed;
 };
net/e1000/e1000_param.c renamed from net/e1000/e1000_param.c.org +24 -0
@@ -196,6 +196,13 @@ E1000_PARAM(SmartPowerDownEnable, "Enabl
 */
 E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
 
+/* Enable Force Link Up When AutoNeg Failed
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 1 (force link up enabled)  */
+E1000_PARAM(EnableForceLinkOnSERDES, "Enable force link up when AutoNeg failed");
+
 struct e1000_option {
       enum { enable_option, range_option, list_option } type;
       const char *name;
@@ -534,6 +541,23 @@ void __devinit e1000_check_options(struc
                       adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def;
               }
       }
+       { /* Enable Force Link Up When AutoNeg Failed */
+               struct e1000_option opt = {
+                       .type = enable_option,
+                       .name = "Enable Force Link Up When AutoNeg Failed",
+                       .err  = "defaulting to Enabled",
+                       .def  = OPTION_ENABLED
+               };
+
+               if (num_EnableForceLinkOnSERDES > bd) {
+                       unsigned int force_link_up = EnableForceLinkOnSERDES [bd];
+                       e1000_validate_option(&force_link_up, &opt, adapter);
+                       adapter->hw.disable_force_link_up_when_autoneg_failed = !force_link_up;
+
+               } else {
+                       adapter->hw.disable_force_link_up_when_autoneg_failed = !opt.def;
+               }
+       }
 
       switch (adapter->hw.media_type) {
       case e1000_media_type_fiber:
net/e1000/e1000_hw.c renamed from net/e1000/e1000_hw.c.org +6 -0
@@ -3062,6 +3062,12 @@ s32 e1000_check_for_link(struct e1000_hw
            hw->autoneg_failed = 1;
            return 0;
        }
+
+        if (hw->disable_force_link_up_when_autoneg_failed) {
+            DEBUGOUT("Force Link Up Disabled\n");
+            return -E1000_ERR_PHY;
+        }
+
        DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
 
        /* Disable auto-negotiation in the TXCW register */
Quoted 3 lines

================================
--

I am a little confused. You state you are using an NIC (82571EB) which is currently not supported by e1000, but is supported in the e1000e driver. Then you suggest a change to the e1000 driver to resolve an issue you see with your 82571EB NIC.

So I would suggest you use the e1000e driver first.

Also the Link LED is supposed to indicated that there is a "physical" link, in which case you can have a physical connection and still fail auto-neg. So I do not necessarily agree with your interpretation of what a link LED is supposed to indicate.

NAK.

Signature · 8 lines
Cheers,
Jeff

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
#2 lore raw

Jeff Kirsher wrote (2008/12/03 17:12:00 +0900 ):

Quoted 134 lines · On Tue, Dec 2, 2008 at 11:36 PM, <[email protected]> wrote:
Quoted 124 lines

From: Hiroki Ohashi <[email protected]>

Hi all,

I faced the following situations.
The LED of NIC was indicated, even when the system was not linked the network (auto-negotiation failed or link partner cannot auto-negotiate).
LED should be indicate only when the network was linked. And so, it is a problem that LED indicates.

I think the indicating the LED is a problem for maintenance. I cannot know the condition of the link, because I confirm to link up by LED's indication.

We are using 82571EB ethernet controler and serdes interface.

I think this problem is caused by the e1000 device driver setting LU and SLU bits in the interface and forcing the link to go up.
I deleted this logic. (the following modification.) Then, LED was turned off.

================================

e1000_hw.c renamed from e1000_hw.c.org +2 -0
@@ -3069,6 +3069,7 @@I
            hw->autoneg_failed = 1;
            return 0;
        }
+#if 0
        DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
 
        /* Disable auto-negotiation in the TXCW register */
@@ -3078,6 +3079,7 @@
        ctrl = E1000_READ_REG(hw, CTRL);
        ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
        E1000_WRITE_REG(hw, CTRL, ctrl);
+#endif
 
        /* Configure Flow Control after forcing link up. */
        ret_val = e1000_config_fc_after_link_up(hw);

================================

I think the e1000 driver should enable/disable force-link-up depending on the condition of the link.
But I don't know a good way to do this.
If you have any good ideas, please let me know.

As a temporary idea, I thought of a way of adding a module parameter to control enable/disable force-link-up.
The patch is as follows.

This patch adds "disable_force_link_up_when_autoneg_failed" as module parameter. When this is 0, force-link-up is disable.

From: Hiroshi Shimamoto <[email protected]>

================================

net/e1000/e1000_hw.h renamed from net/e1000/e1000_hw.h.org +1 -0
@@ -1469,6 +1469,7 @@ struct e1000_hw {
       bool                    has_manc2h;
       bool                    rx_needs_kicking;
       bool                    has_smbus;
+       bool                    disable_force_link_up_when_autoneg_failed;
 };
net/e1000/e1000_param.c renamed from net/e1000/e1000_param.c.org +24 -0
@@ -196,6 +196,13 @@ E1000_PARAM(SmartPowerDownEnable, "Enabl
 */
 E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
 
+/* Enable Force Link Up When AutoNeg Failed
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 1 (force link up enabled)  */
+E1000_PARAM(EnableForceLinkOnSERDES, "Enable force link up when AutoNeg failed");
+
 struct e1000_option {
       enum { enable_option, range_option, list_option } type;
       const char *name;
@@ -534,6 +541,23 @@ void __devinit e1000_check_options(struc
                       adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def;
               }
       }
+       { /* Enable Force Link Up When AutoNeg Failed */
+               struct e1000_option opt = {
+                       .type = enable_option,
+                       .name = "Enable Force Link Up When AutoNeg Failed",
+                       .err  = "defaulting to Enabled",
+                       .def  = OPTION_ENABLED
+               };
+
+               if (num_EnableForceLinkOnSERDES > bd) {
+                       unsigned int force_link_up = EnableForceLinkOnSERDES [bd];
+                       e1000_validate_option(&force_link_up, &opt, adapter);
+                       adapter->hw.disable_force_link_up_when_autoneg_failed = !force_link_up;
+
+               } else {
+                       adapter->hw.disable_force_link_up_when_autoneg_failed = !opt.def;
+               }
+       }
 
       switch (adapter->hw.media_type) {
       case e1000_media_type_fiber:
net/e1000/e1000_hw.c renamed from net/e1000/e1000_hw.c.org +6 -0
@@ -3062,6 +3062,12 @@ s32 e1000_check_for_link(struct e1000_hw
            hw->autoneg_failed = 1;
            return 0;
        }
+
+        if (hw->disable_force_link_up_when_autoneg_failed) {
+            DEBUGOUT("Force Link Up Disabled\n");
+            return -E1000_ERR_PHY;
+        }
+
        DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
 
        /* Disable auto-negotiation in the TXCW register */
Quoted 3 lines

================================
--

I am a little confused. You state you are using an NIC (82571EB) which is currently not supported by e1000, but is supported in the e1000e driver. Then you suggest a change to the e1000 driver to resolve an issue you see with your 82571EB NIC.

Quoted 1 line

So I would suggest you use the e1000e driver first.

Thank you, I will try again using e1000e driver.

Quoted 4 lines

Also the Link LED is supposed to indicated that there is a "physical" link, in which case you can have a physical connection and still fail auto-neg. So I do not necessarily agree with your interpretation of what a link LED is supposed to indicate.

My explanation was insufficiently.
My system was NOT connected LAN cable to NIC, but the Link LED was indicated.
So the problem is the LED is indicated without connecting the cable.

Quoted 5 lines

NAK.

Signature · 2 lines
Cheers,
Jeff

Hiroki Ohashi

#3 lore raw

[email protected] wrote (2008/12/04 18:24:21 +0900 ):

Quoted 21 lines

Jeff Kirsher wrote (2008/12/03 17:12:00 +0900 ):

Quoted 18 lines · On Tue, Dec 2, 2008 at 11:36 PM, <[email protected]> wrote:
Quoted 17 lines

From: Hiroki Ohashi <[email protected]>

Hi all,

I faced the following situations.
The LED of NIC was indicated, even when the system was not linked the network (auto-negotiation failed or link partner cannot auto-negotiate).
LED should be indicate only when the network was linked. And so, it is a problem that LED indicates.

I think the indicating the LED is a problem for maintenance. I cannot know the condition of the link, because I confirm to link up by LED's indication.

We are using 82571EB ethernet controler and serdes interface.

...

Quoted 15 lines
Quoted 7 lines

I am a little confused. You state you are using an NIC (82571EB) which is currently not supported by e1000, but is supported in the e1000e driver. Then you suggest a change to the e1000 driver to resolve an issue you see with your 82571EB NIC.

So I would suggest you use the e1000e driver first.

Thank you, I will try again using e1000e driver.

Quoted 4 lines

Also the Link LED is supposed to indicated that there is a "physical" link, in which case you can have a physical connection and still fail auto-neg. So I do not necessarily agree with your interpretation of what a link LED is supposed to indicate.

Quoted 5 lines

My explanation was insufficiently.
My system was NOT connected LAN cable to NIC, but the Link LED was indicated.
So the problem is the LED is indicated without connecting the cable.

I tried again using kernel 2.6.27.8 (e1000e driver).
The LED of NIC was indicated, even when the system was not connected LAN cable.
When I deleted logic of force-link-up (the following modification.), the LED was turned off.

I think it is a problem that LED indicates.
If you have any good way to modify, please let me know. (Patches are considering.)

================================================

net/e1000e/lib.c renamed from net/e1000e/lib.c.org +1 -0
@@ -539,8 +539,6 @@ s32 e1000e_check_for_serdes_link(struct 
                        mac->autoneg_failed = 1;
                        return 0;
                }
+#if 0
                hw_dbg(hw, "NOT RXing /C/, disable AutoNeg and force link.\n");
 
                /* Disable auto-negotiation in the TXCW register */
@@ -550,7 +548,7 @@ s32 e1000e_check_for_serdes_link(struct 
                ctrl = er32(CTRL);
                ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
                ew32(CTRL, ctrl);
+#endif
-
                /* Configure Flow Control after forcing link up. */
                ret_val = e1000e_config_fc_after_link_up(hw);
                if (ret_val) {

================================================

Hiroki Ohashi