public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] via-rhine: link state fix
@ 2006-03-28 18:53 Roger Luethi
  2006-03-28 20:48 ` Jeff Garzik
  2006-03-29 22:29 ` Jeff Garzik
  0 siblings, 2 replies; 3+ messages in thread
From: Roger Luethi @ 2006-03-28 18:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jeff Garzik, vda, rlrevell, linux-kernel

Problems with link state detection have been reported several times in the
past months.

Denis Vlasenko did all the work tracking it down. Jeff Garzik suggested the
proper place for the fix.

When using the mii library, the driver needs to check mii->force_media
and set dev->state accordingly.

Roger

Signed-off-by: Roger Luethi <rl@hellgate.ch>

--- linux-2.6.15.6/drivers/net/via-rhine.c.orig	2006-03-12 13:32:16.000000000 +0100
+++ linux-2.6.15.6/drivers/net/via-rhine.c	2006-03-12 22:01:36.000000000 +0100
@@ -1085,6 +1085,25 @@
 	else
 	    iowrite8(ioread8(ioaddr + ChipCmd1) & ~Cmd1FDuplex,
 		   ioaddr + ChipCmd1);
+	if (debug > 1)
+		printk(KERN_INFO "%s: force_media %d, carrier %d\n", dev->name,
+			rp->mii_if.force_media, netif_carrier_ok(dev));
+}
+
+/* Called after status of force_media possibly changed */
+void rhine_set_carrier(struct mii_if_info *mii)
+{
+	if (mii->force_media) {
+		/* autoneg is off: Link is always assumed to be up */
+		if (!netif_carrier_ok(mii->dev))
+			netif_carrier_on(mii->dev);
+	}
+	else	/* Let MMI library update carrier status */
+		rhine_check_media(mii->dev, 0);
+	if (debug > 1)
+		printk(KERN_INFO "%s: force_media %d, carrier %d\n",
+		       mii->dev->name, mii->force_media,
+		       netif_carrier_ok(mii->dev));
 }
 
 static void rhine_check_media_task(struct net_device *dev)
@@ -1782,6 +1801,7 @@
 	spin_lock_irq(&rp->lock);
 	rc = mii_ethtool_sset(&rp->mii_if, cmd);
 	spin_unlock_irq(&rp->lock);
+	rhine_set_carrier(&rp->mii_if);
 
 	return rc;
 }
@@ -1869,6 +1889,7 @@
 	spin_lock_irq(&rp->lock);
 	rc = generic_mii_ioctl(&rp->mii_if, if_mii(rq), cmd, NULL);
 	spin_unlock_irq(&rp->lock);
+	rhine_set_carrier(&rp->mii_if);
 
 	return rc;
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] via-rhine: link state fix
  2006-03-28 18:53 [PATCH] via-rhine: link state fix Roger Luethi
@ 2006-03-28 20:48 ` Jeff Garzik
  2006-03-29 22:29 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2006-03-28 20:48 UTC (permalink / raw)
  To: Roger Luethi; +Cc: Andrew Morton, vda, rlrevell, linux-kernel

Roger Luethi wrote:
> Problems with link state detection have been reported several times in the
> past months.
> 
> Denis Vlasenko did all the work tracking it down. Jeff Garzik suggested the
> proper place for the fix.
> 
> When using the mii library, the driver needs to check mii->force_media
> and set dev->state accordingly.
> 
> Roger
> 
> Signed-off-by: Roger Luethi <rl@hellgate.ch>

ACK, will apply this...



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] via-rhine: link state fix
  2006-03-28 18:53 [PATCH] via-rhine: link state fix Roger Luethi
  2006-03-28 20:48 ` Jeff Garzik
@ 2006-03-29 22:29 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2006-03-29 22:29 UTC (permalink / raw)
  To: Roger Luethi; +Cc: Andrew Morton, vda, rlrevell, linux-kernel

Roger Luethi wrote:
> Problems with link state detection have been reported several times in the
> past months.
> 
> Denis Vlasenko did all the work tracking it down. Jeff Garzik suggested the
> proper place for the fix.
> 
> When using the mii library, the driver needs to check mii->force_media
> and set dev->state accordingly.
> 
> Roger
> 
> Signed-off-by: Roger Luethi <rl@hellgate.ch>

applied



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-29 22:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-28 18:53 [PATCH] via-rhine: link state fix Roger Luethi
2006-03-28 20:48 ` Jeff Garzik
2006-03-29 22:29 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox