Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66834
b: refs/heads/master
c: 928773c
h: refs/heads/master
v: v3
  • Loading branch information
Olof Johansson authored and David S. Miller committed Oct 10, 2007
1 parent 75feee9 commit a2fe6dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 36033766533176d61ba15793d8ef219775499c2f
refs/heads/master: 928773c23a4cf053a34ad480439448f75efa350c
21 changes: 8 additions & 13 deletions trunk/drivers/net/pasemi_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a2fe6dc

Please sign in to comment.