diff options
author | stephen hemminger <shemminger@vyatta.com> | 2010-04-28 04:25:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-30 19:15:38 -0400 |
commit | 81a2e36df7de8bf9417de67f9d54b4f740072ed0 (patch) | |
tree | 7e419501ef2fe5d1b7a480044a4016cc3205c44f | |
parent | f84af32cbca70a3c6d30463dc08c7984af11c277 (diff) |
forcedeth: Stay in NAPI as long as there's work
The following does the same thing without the extra overhead
of testing all the registers. It also handles the out of memory
case.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Tested-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/forcedeth.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index a1c0e7bb70e8..5cf0e6615695 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3743,23 +3743,26 @@ static int nv_napi_poll(struct napi_struct *napi, int budget) | |||
3743 | u8 __iomem *base = get_hwbase(dev); | 3743 | u8 __iomem *base = get_hwbase(dev); |
3744 | unsigned long flags; | 3744 | unsigned long flags; |
3745 | int retcode; | 3745 | int retcode; |
3746 | int tx_work, rx_work; | 3746 | int rx_count, tx_work=0, rx_work=0; |
3747 | 3747 | ||
3748 | if (!nv_optimized(np)) { | 3748 | do { |
3749 | spin_lock_irqsave(&np->lock, flags); | 3749 | if (!nv_optimized(np)) { |
3750 | tx_work = nv_tx_done(dev, np->tx_ring_size); | 3750 | spin_lock_irqsave(&np->lock, flags); |
3751 | spin_unlock_irqrestore(&np->lock, flags); | 3751 | tx_work += nv_tx_done(dev, np->tx_ring_size); |
3752 | spin_unlock_irqrestore(&np->lock, flags); | ||
3752 | 3753 | ||
3753 | rx_work = nv_rx_process(dev, budget); | 3754 | rx_count = nv_rx_process(dev, budget); |
3754 | retcode = nv_alloc_rx(dev); | 3755 | retcode = nv_alloc_rx(dev); |
3755 | } else { | 3756 | } else { |
3756 | spin_lock_irqsave(&np->lock, flags); | 3757 | spin_lock_irqsave(&np->lock, flags); |
3757 | tx_work = nv_tx_done_optimized(dev, np->tx_ring_size); | 3758 | tx_work += nv_tx_done_optimized(dev, np->tx_ring_size); |
3758 | spin_unlock_irqrestore(&np->lock, flags); | 3759 | spin_unlock_irqrestore(&np->lock, flags); |
3759 | 3760 | ||
3760 | rx_work = nv_rx_process_optimized(dev, budget); | 3761 | rx_count = nv_rx_process_optimized(dev, budget); |
3761 | retcode = nv_alloc_rx_optimized(dev); | 3762 | retcode = nv_alloc_rx_optimized(dev); |
3762 | } | 3763 | } |
3764 | } while (retcode == 0 && | ||
3765 | rx_count > 0 && (rx_work += rx_count) < budget); | ||
3763 | 3766 | ||
3764 | if (retcode) { | 3767 | if (retcode) { |
3765 | spin_lock_irqsave(&np->lock, flags); | 3768 | spin_lock_irqsave(&np->lock, flags); |