All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smsc911x: reset last known duplex and carrier on open
@ 2009-03-17 18:06 Steve Glendinning
  2009-03-19  6:38 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Glendinning @ 2009-03-17 18:06 UTC (permalink / raw)
  To: netdev; +Cc: Ian Saturley, David Miller, Steve Glendinning

smsc911x_phy_adjust_link is called periodically by the phy layer (as
it's run in polling mode), and it only updates the hardware when it sees
a change in duplex or carrier.  This patch clears the last known values
every time the interface is brought up, instead of only when the module
is loaded.

Without this patch the adjust_link function never updates the hardware
after an ifconfig down; ifconfig up.  On a full duplex link this causes
the tx error counter to increment, even though packets are correctly
transmitted, as the default MAC_CR register setting is for half duplex.

The tx errors are "no carrier" errors, which should be ignored in
full-duplex mode.  When MAC_CR is set to "full duplex" mode they are
correctly ignored by the hardware.

Note that even with this patch the tx error counter can increment if
packets are transmitted between "ifconfig up" and the first phy poll
interval.  An improved solution would use the phy interrupt with phylib,
but I haven't managed to make this work 100% robustly yet.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
---
 drivers/net/smsc911x.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 9a78dae..d1590ac 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -1225,6 +1225,10 @@ static int smsc911x_open(struct net_device *dev)
 	dev_info(&dev->dev, "SMSC911x/921x identified at %#08lx, IRQ: %d\n",
 		 (unsigned long)pdata->ioaddr, dev->irq);
 
+	/* Reset the last known duplex and carrier */
+	pdata->last_duplex = -1;
+	pdata->last_carrier = -1;
+
 	/* Bring the PHY up */
 	phy_start(pdata->phy_dev);
 
-- 
1.6.0.6


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

* Re: [PATCH] smsc911x: reset last known duplex and carrier on open
  2009-03-17 18:06 [PATCH] smsc911x: reset last known duplex and carrier on open Steve Glendinning
@ 2009-03-19  6:38 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-03-19  6:38 UTC (permalink / raw)
  To: steve.glendinning; +Cc: netdev, ian.saturley

From: Steve Glendinning <steve.glendinning@smsc.com>
Date: Tue, 17 Mar 2009 18:06:39 +0000

> smsc911x_phy_adjust_link is called periodically by the phy layer (as
> it's run in polling mode), and it only updates the hardware when it sees
> a change in duplex or carrier.  This patch clears the last known values
> every time the interface is brought up, instead of only when the module
> is loaded.
> 
> Without this patch the adjust_link function never updates the hardware
> after an ifconfig down; ifconfig up.  On a full duplex link this causes
> the tx error counter to increment, even though packets are correctly
> transmitted, as the default MAC_CR register setting is for half duplex.
> 
> The tx errors are "no carrier" errors, which should be ignored in
> full-duplex mode.  When MAC_CR is set to "full duplex" mode they are
> correctly ignored by the hardware.
> 
> Note that even with this patch the tx error counter can increment if
> packets are transmitted between "ifconfig up" and the first phy poll
> interval.  An improved solution would use the phy interrupt with phylib,
> but I haven't managed to make this work 100% robustly yet.
> 
> Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>

Patch applied, thanks Steve.

If only other driver maintainers wrote as nice commit log
messages as you do, these days I'm lucky if I get a coherent
header line. :-/


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

end of thread, other threads:[~2009-03-19  6:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-17 18:06 [PATCH] smsc911x: reset last known duplex and carrier on open Steve Glendinning
2009-03-19  6:38 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.