Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103462
b: refs/heads/master
c: 2813317
h: refs/heads/master
v: v3
  • Loading branch information
Francois Romieu authored and Jeff Garzik committed Jul 11, 2008
1 parent 81fb6ef commit 4cfa9fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 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: 8ac53afccf7ab383fd97db8910117ae7892c72a7
refs/heads/master: 28133176082d9bcafb5958b8fac80943e51d5eda
28 changes: 14 additions & 14 deletions trunk/drivers/net/via-velocity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ static void velocity_free_rings(struct velocity_info *vptr)
pci_free_consistent(vptr->pdev, size, vptr->rd_ring, vptr->rd_pool_dma);
}

static inline void velocity_give_many_rx_descs(struct velocity_info *vptr)
static void velocity_give_many_rx_descs(struct velocity_info *vptr)
{
struct mac_regs __iomem *regs = vptr->mac_regs;
int avail, dirty, unusable;
Expand All @@ -1182,7 +1182,7 @@ static inline void velocity_give_many_rx_descs(struct velocity_info *vptr)

static int velocity_rx_refill(struct velocity_info *vptr)
{
int dirty = vptr->rd_dirty, done = 0, ret = 0;
int dirty = vptr->rd_dirty, done = 0;

do {
struct rx_desc *rd = vptr->rd_ring + dirty;
Expand All @@ -1192,8 +1192,7 @@ static int velocity_rx_refill(struct velocity_info *vptr)
break;

if (!vptr->rd_info[dirty].skb) {
ret = velocity_alloc_rx_buf(vptr, dirty);
if (ret < 0)
if (velocity_alloc_rx_buf(vptr, dirty) < 0)
break;
}
done++;
Expand All @@ -1203,10 +1202,9 @@ static int velocity_rx_refill(struct velocity_info *vptr)
if (done) {
vptr->rd_dirty = dirty;
vptr->rd_filled += done;
velocity_give_many_rx_descs(vptr);
}

return ret;
return done;
}

/**
Expand All @@ -1219,25 +1217,27 @@ static int velocity_rx_refill(struct velocity_info *vptr)

static int velocity_init_rd_ring(struct velocity_info *vptr)
{
int ret;
int mtu = vptr->dev->mtu;
int ret = -ENOMEM;

vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;

vptr->rd_info = kcalloc(vptr->options.numrx,
sizeof(struct velocity_rd_info), GFP_KERNEL);
if (!vptr->rd_info)
return -ENOMEM;
goto out;

vptr->rd_filled = vptr->rd_dirty = vptr->rd_curr = 0;

ret = velocity_rx_refill(vptr);
if (ret < 0) {
if (velocity_rx_refill(vptr) != vptr->options.numrx) {
VELOCITY_PRT(MSG_LEVEL_ERR, KERN_ERR
"%s: failed to allocate RX buffer.\n", vptr->dev->name);
velocity_free_rd_ring(vptr);
goto out;
}

ret = 0;
out:
return ret;
}

Expand Down Expand Up @@ -1412,10 +1412,8 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status)

vptr->rd_curr = rd_curr;

if (works > 0 && velocity_rx_refill(vptr) < 0) {
VELOCITY_PRT(MSG_LEVEL_ERR, KERN_ERR
"%s: rx buf allocation failure\n", vptr->dev->name);
}
if ((works > 0) && (velocity_rx_refill(vptr) > 0))
velocity_give_many_rx_descs(vptr);

VAR_USED(stats);
return works;
Expand Down Expand Up @@ -1877,6 +1875,8 @@ static int velocity_open(struct net_device *dev)
/* Ensure chip is running */
pci_set_power_state(vptr->pdev, PCI_D0);

velocity_give_many_rx_descs(vptr);

velocity_init_registers(vptr, VELOCITY_INIT_COLD);

ret = request_irq(vptr->pdev->irq, &velocity_intr, IRQF_SHARED,
Expand Down

0 comments on commit 4cfa9fb

Please sign in to comment.