diff options
author | Andy Fleming <afleming@freescale.com> | 2008-12-17 19:52:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-17 19:52:30 -0500 |
commit | 42199884594bc336c9185441cbed99a9324dab34 (patch) | |
tree | b4cd25e04c66f47dd9520b6415ddaf9d09714368 /drivers/net/gianfar.c | |
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/net/gianfar.c')
-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 d243c9eea43a..13f49643ba0b 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) | |||
1843 | { | 1843 | { |
1844 | struct gfar_private *priv = container_of(napi, struct gfar_private, napi); | 1844 | struct gfar_private *priv = container_of(napi, struct gfar_private, napi); |
1845 | struct net_device *dev = priv->dev; | 1845 | struct net_device *dev = priv->dev; |
1846 | int howmany; | 1846 | int tx_cleaned = 0; |
1847 | int rx_cleaned = 0; | ||
1847 | unsigned long flags; | 1848 | unsigned long flags; |
1848 | 1849 | ||
1849 | /* Clear IEVENT, so interrupts aren't called again | 1850 | /* Clear IEVENT, so interrupts aren't called again |
@@ -1852,13 +1853,16 @@ static int gfar_poll(struct napi_struct *napi, int budget) | |||
1852 | 1853 | ||
1853 | /* If we fail to get the lock, don't bother with the TX BDs */ | 1854 | /* If we fail to get the lock, don't bother with the TX BDs */ |
1854 | if (spin_trylock_irqsave(&priv->txlock, flags)) { | 1855 | if (spin_trylock_irqsave(&priv->txlock, flags)) { |
1855 | gfar_clean_tx_ring(dev); | 1856 | tx_cleaned = gfar_clean_tx_ring(dev); |
1856 | spin_unlock_irqrestore(&priv->txlock, flags); | 1857 | spin_unlock_irqrestore(&priv->txlock, flags); |
1857 | } | 1858 | } |
1858 | 1859 | ||
1859 | howmany = gfar_clean_rx_ring(dev, budget); | 1860 | rx_cleaned = gfar_clean_rx_ring(dev, budget); |
1860 | 1861 | ||
1861 | if (howmany < budget) { | 1862 | if (tx_cleaned) |
1863 | return budget; | ||
1864 | |||
1865 | if (rx_cleaned < budget) { | ||
1862 | netif_rx_complete(dev, napi); | 1866 | netif_rx_complete(dev, napi); |
1863 | 1867 | ||
1864 | /* Clear the halt bit in RSTAT */ | 1868 | /* Clear the halt bit in RSTAT */ |
@@ -1878,7 +1882,7 @@ static int gfar_poll(struct napi_struct *napi, int budget) | |||
1878 | } | 1882 | } |
1879 | } | 1883 | } |
1880 | 1884 | ||
1881 | return howmany; | 1885 | return rx_cleaned; |
1882 | } | 1886 | } |
1883 | 1887 | ||
1884 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1888 | #ifdef CONFIG_NET_POLL_CONTROLLER |