* [PATCH] net/fec: fix link/queue interaction, wake queue iff link is up
@ 2010-10-06 11:31 Oskar Schirmer
2010-10-06 21:15 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Oskar Schirmer @ 2010-10-06 11:31 UTC (permalink / raw)
To: netdev; +Cc: Dan Malek, Sebastian Siewior, Hans J. Koch, Oskar Schirmer
with hardware slow in negotiation, the system did freeze
while trying to mount root on nfs at boot time.
while the driver did report being busy when the link is down
or no transmission buffers are available, it did not stop the
queue, causing instant retries. furthermore, transmission being
triggered with link down was caused by unconditional queue
wakes, especially on timeouts.
now, wake queue only iff link is up and transmission
buffers are available, and dont forget to wake queue
when link has been adjusted. next, add stop queue notification
upon driver induced transmission problems, so network stack has
a chance to handle the situation.
Signed-off-by: Oskar Schirmer <oskar@linutronix.de>
---
drivers/net/fec.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 768b840..c2da006 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -222,12 +222,14 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned short status;
unsigned long flags;
+ spin_lock_irqsave(&fep->hw_lock, flags);
if (!fep->link) {
/* Link is down or autonegotiation is in progress. */
+ netif_stop_queue(dev);
+ spin_unlock_irqrestore(&fep->hw_lock, flags);
return NETDEV_TX_BUSY;
}
- spin_lock_irqsave(&fep->hw_lock, flags);
/* Fill in a Tx ring entry */
bdp = fep->cur_tx;
@@ -238,6 +240,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
* This should not happen, since dev->tbusy should be set.
*/
printk("%s: tx queue full!.\n", dev->name);
+ netif_stop_queue(dev);
spin_unlock_irqrestore(&fep->hw_lock, flags);
return NETDEV_TX_BUSY;
}
@@ -309,7 +312,8 @@ fec_timeout(struct net_device *dev)
dev->stats.tx_errors++;
fec_restart(dev, fep->full_duplex);
- netif_wake_queue(dev);
+ if (fep->link && !fep->tx_full)
+ netif_wake_queue(dev);
}
static irqreturn_t
@@ -602,9 +606,11 @@ static void fec_enet_adjust_link(struct net_device *dev)
/* Link on or off change */
if (phy_dev->link != fep->link) {
fep->link = phy_dev->link;
- if (phy_dev->link)
+ if (phy_dev->link) {
fec_restart(dev, phy_dev->duplex);
- else
+ if (!fep->tx_full)
+ netif_wake_queue(dev);
+ } else
fec_stop(dev);
status_change = 1;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] net/fec: fix link/queue interaction, wake queue iff link is up
2010-10-06 11:31 [PATCH] net/fec: fix link/queue interaction, wake queue iff link is up Oskar Schirmer
@ 2010-10-06 21:15 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-10-06 21:15 UTC (permalink / raw)
To: oskar; +Cc: netdev, dan, bigeasy, hjk
From: Oskar Schirmer <oskar@linutronix.de>
Date: Wed, 6 Oct 2010 13:31:58 +0200
> with hardware slow in negotiation, the system did freeze
> while trying to mount root on nfs at boot time.
>
> while the driver did report being busy when the link is down
> or no transmission buffers are available, it did not stop the
> queue, causing instant retries. furthermore, transmission being
> triggered with link down was caused by unconditional queue
> wakes, especially on timeouts.
>
> now, wake queue only iff link is up and transmission
> buffers are available, and dont forget to wake queue
> when link has been adjusted. next, add stop queue notification
> upon driver induced transmission problems, so network stack has
> a chance to handle the situation.
>
> Signed-off-by: Oskar Schirmer <oskar@linutronix.de>
You should never have to do this.
As long as netif_carrier_on() and netif_carrier_off() are invoked
properly by the driver, the core networking will never send you
packets when netif_carrier_ok() is false.
I am not applying this patch, drivers should not manage tx queue
state using link status as a condition, that's the job of the
core networking.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-06 21:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 11:31 [PATCH] net/fec: fix link/queue interaction, wake queue iff link is up Oskar Schirmer
2010-10-06 21:15 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox