Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=928773c23a4cf053a34ad480439448f75efa350c
Commit:     928773c23a4cf053a34ad480439448f75efa350c
Parent:     36033766533176d61ba15793d8ef219775499c2f
Author:     Olof Johansson <[EMAIL PROTECTED]>
AuthorDate: Wed Sep 26 16:25:06 2007 -0500
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:53:44 2007 -0700

    pasemi_mac: pass in count of buffers to replenish rx ring with
    
    pasemi_mac: pass in count of buffers to replenish rx ring with
    
    Refactor replenish_rx_ring to take an argument for how many entries to
    fill. Since it's normally available from where it's called anyway, this
    is just simpler. It also removes the awkward logic to try to figure out
    if we're filling for the first time or not.
    
    Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/pasemi_mac.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 643fce8..c2d34a8 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -370,23 +370,18 @@ static void pasemi_mac_free_rx_resources(struct 
net_device *dev)
        mac->rx = NULL;
 }
 
-static void pasemi_mac_replenish_rx_ring(struct net_device *dev)
+static void pasemi_mac_replenish_rx_ring(struct net_device *dev, int limit)
 {
        struct pasemi_mac *mac = netdev_priv(dev);
        unsigned int i;
        int start = mac->rx->next_to_fill;
-       unsigned int limit, count;
-
-       limit = RING_AVAIL(mac->rx);
-       /* Check to see if we're doing first-time setup */
-       if (unlikely(mac->rx->next_to_clean == 0 && mac->rx->next_to_fill == 0))
-               limit = RX_RING_SIZE;
+       int count;
 
        if (limit <= 0)
                return;
 
        i = start;
-       for (count = limit; count; count--) {
+       for (count = 0; count < limit; count++) {
                struct pasemi_mac_buffer *info = &RX_DESC_INFO(mac, i);
                u64 *buff = &RX_BUFF(mac, i);
                struct sk_buff *skb;
@@ -417,10 +412,10 @@ static void pasemi_mac_replenish_rx_ring(struct 
net_device *dev)
 
        wmb();
 
-       write_dma_reg(mac, PAS_DMA_RXCHAN_INCR(mac->dma_rxch), limit - count);
-       write_dma_reg(mac, PAS_DMA_RXINT_INCR(mac->dma_if), limit - count);
+       write_dma_reg(mac, PAS_DMA_RXCHAN_INCR(mac->dma_rxch), count);
+       write_dma_reg(mac, PAS_DMA_RXINT_INCR(mac->dma_if), count);
 
-       mac->rx->next_to_fill += limit - count;
+       mac->rx->next_to_fill += count;
 }
 
 static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
@@ -538,7 +533,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int 
limit)
        }
 
        mac->rx->next_to_clean += limit - count;
-       pasemi_mac_replenish_rx_ring(mac->netdev);
+       pasemi_mac_replenish_rx_ring(mac->netdev, limit-count);
 
        spin_unlock(&mac->rx->lock);
 
@@ -825,7 +820,7 @@ static int pasemi_mac_open(struct net_device *dev)
        write_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch),
                           PAS_DMA_TXCHAN_TCMDSTA_EN);
 
-       pasemi_mac_replenish_rx_ring(dev);
+       pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE);
 
        flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
                PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to