diff options
author | Andy Fleming <afleming@freescale.com> | 2008-12-17 16:52:30 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-17 16:52:30 -0800 |
commit | 42199884594bc336c9185441cbed99a9324dab34 (patch) | |
tree | b4cd25e04c66f47dd9520b6415ddaf9d09714368 /drivers | |
parent | 8c7396aebb68994c0519e438eecdf4d5fa9c7844 (diff) |
gianfar: Continue polling until both tx and rx are empty
gfar_poll would declare polling done once the rx queue was empty,
but the tx queue could still have packets left.
Stolen mostly from the e1000 driver.
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/gianfar.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index d243c9eea43..13f49643ba0 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -1843,7 +1843,8 @@ static int gfar_poll(struct napi_struct *napi, int budget) { struct gfar_private *priv = container_of(napi, struct gfar_private, napi); struct net_device *dev = priv->dev; - int howmany; + int tx_cleaned = 0; + int rx_cleaned = 0; unsigned long flags; /* Clear IEVENT, so interrupts aren't called again @@ -1852,13 +1853,16 @@ static int gfar_poll(struct napi_struct *napi, int budget) /* If we fail to get the lock, don't bother with the TX BDs */ if (spin_trylock_irqsave(&priv->txlock, flags)) { - gfar_clean_tx_ring(dev); + tx_cleaned = gfar_clean_tx_ring(dev); spin_unlock_irqrestore(&priv->txlock, flags); } - howmany = gfar_clean_rx_ring(dev, budget); + rx_cleaned = gfar_clean_rx_ring(dev, budget); - if (howmany < budget) { + if (tx_cleaned) + return budget; + + if (rx_cleaned < budget) { netif_rx_complete(dev, napi); /* Clear the halt bit in RSTAT */ @@ -1878,7 +1882,7 @@ static int gfar_poll(struct napi_struct *napi, int budget) } } - return howmany; + return rx_cleaned; } #ifdef CONFIG_NET_POLL_CONTROLLER |