Patchwork sky2: set carrier off in probe

login
register
mail settings
Submitter Stephen Hemminger
Date Oct. 30, 2009, 3:34 p.m.
Message ID <20091030083452.68ca227e@nehalam>
Download mbox | patch
Permalink /patch/37310/
State Rejected
Delegated to: David Miller
Headers show

Comments

Stephen Hemminger - Oct. 30, 2009, 3:34 p.m.
Why not fix the problem in a generic way?


---
Subject: ethtool: link is only up if device is running


Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--
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
David Miller - Oct. 30, 2009, 6:11 p.m.
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Fri, 30 Oct 2009 08:34:52 -0700

> Why not fix the problem in a generic way?

Drivers still need to make sure carrier is off when their
->open() routine runs, so that the transition event from
link down to link up occurs properly when the device is brought
up.

So mucking around with this carrier test will only hide the
bugs, not make things easier.
--
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

Patch

--- a/net/core/ethtool.c	2009-10-30 08:32:52.584728610 -0700
+++ b/net/core/ethtool.c	2009-10-30 08:33:31.806667877 -0700
@@ -27,7 +27,7 @@ 
 
 u32 ethtool_op_get_link(struct net_device *dev)
 {
-	return netif_carrier_ok(dev) ? 1 : 0;
+	return netif_running(dev) && netif_carrier_ok(dev);
 }
 
 u32 ethtool_op_get_rx_csum(struct net_device *dev)