Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224522
b: refs/heads/master
c: 6a63262
h: refs/heads/master
v: v3
  • Loading branch information
Jonas Bonn authored and David S. Miller committed Nov 28, 2010
1 parent 981d5e7 commit 015ae96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 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: 4f64bcb2fc093a3a9d7d41220004491ce88e4dd3
refs/heads/master: 6a632625c7da7594d059b88dae0e9c591af147ba
17 changes: 13 additions & 4 deletions trunk/drivers/net/ethoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static int ethoc_rx(struct net_device *dev, int limit)
unsigned int entry;
struct ethoc_bd bd;

entry = priv->num_tx + (priv->cur_rx % priv->num_rx);
entry = priv->num_tx + priv->cur_rx;
ethoc_read_bd(priv, entry, &bd);
if (bd.stat & RX_BD_EMPTY) {
ethoc_ack_irq(priv, INT_MASK_RX);
Expand Down Expand Up @@ -456,7 +456,8 @@ static int ethoc_rx(struct net_device *dev, int limit)
bd.stat &= ~RX_BD_STATS;
bd.stat |= RX_BD_EMPTY;
ethoc_write_bd(priv, entry, &bd);
priv->cur_rx++;
if (++priv->cur_rx == priv->num_rx)
priv->cur_rx = 0;
}

return count;
Expand Down Expand Up @@ -503,7 +504,7 @@ static int ethoc_tx(struct net_device *dev, int limit)
for (count = 0; count < limit; ++count) {
unsigned int entry;

entry = priv->dty_tx % priv->num_tx;
entry = priv->dty_tx & (priv->num_tx-1);

ethoc_read_bd(priv, entry, &bd);

Expand Down Expand Up @@ -1000,9 +1001,17 @@ static int __devinit ethoc_probe(struct platform_device *pdev)
/* calculate the number of TX/RX buffers, maximum 128 supported */
num_bd = min_t(unsigned int,
128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ);
priv->num_tx = max(2, num_bd / 4);
if (num_bd < 4) {
ret = -ENODEV;
goto error;
}
/* num_tx must be a power of two */
priv->num_tx = rounddown_pow_of_two(num_bd >> 1);
priv->num_rx = num_bd - priv->num_tx;

dev_dbg(&pdev->dev, "ethoc: num_tx: %d num_rx: %d\n",
priv->num_tx, priv->num_rx);

priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void*), GFP_KERNEL);
if (!priv->vma) {
ret = -ENOMEM;
Expand Down

0 comments on commit 015ae96

Please sign in to comment.