forcedeth: Account for consumed budget in napi poll
authorTom Herbert <therbert@google.com>
Wed, 5 May 2010 18:15:21 +0000 (18:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 May 2010 04:24:17 +0000 (21:24 -0700)
Repeated calls to nv_rx_process in napi poll routine do not take
portion of budget that has been consumed in previous calls.  Fix by
subtracting the number of packets processed.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/forcedeth.c

index f9e1dd48ac56a8e562dfd0962e72f600bb8b5882..e282d0ae6a3dcb14b80db8fdd80f674c92091b6d 100644 (file)
@@ -3564,14 +3564,15 @@ static int nv_napi_poll(struct napi_struct *napi, int budget)
                        tx_work += nv_tx_done(dev, np->tx_ring_size);
                        spin_unlock_irqrestore(&np->lock, flags);
 
-                       rx_count = nv_rx_process(dev, budget);
+                       rx_count = nv_rx_process(dev, budget - rx_work);
                        retcode = nv_alloc_rx(dev);
                } else {
                        spin_lock_irqsave(&np->lock, flags);
                        tx_work += nv_tx_done_optimized(dev, np->tx_ring_size);
                        spin_unlock_irqrestore(&np->lock, flags);
 
-                       rx_count = nv_rx_process_optimized(dev, budget);
+                       rx_count = nv_rx_process_optimized(dev,
+                           budget - rx_work);
                        retcode = nv_alloc_rx_optimized(dev);
                }
        } while (retcode == 0 &&