Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203449
b: refs/heads/master
c: f163530
h: refs/heads/master
i:
  203447: d52be55
v: v3
  • Loading branch information
Kulikov Vasiliy authored and David S. Miller committed Jul 11, 2010
1 parent 8bbd721 commit 874ec2d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 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: 344dbf1073d1cea179ed0831547cab2b7ea4ea27
refs/heads/master: f163530407280485034c836d908b49787a8189bc
42 changes: 26 additions & 16 deletions trunk/drivers/net/82596.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,21 @@ static irqreturn_t i596_error(int irq, void *dev_id)
}
#endif

static inline void init_rx_bufs(struct net_device *dev)
static inline void remove_rx_bufs(struct net_device *dev)
{
struct i596_private *lp = dev->ml_priv;
struct i596_rbd *rbd;
int i;

for (i = 0, rbd = lp->rbds; i < rx_ring_size; i++, rbd++) {
if (rbd->skb == NULL)
break;
dev_kfree_skb(rbd->skb);
rbd->skb = NULL;
}
}

static inline int init_rx_bufs(struct net_device *dev)
{
struct i596_private *lp = dev->ml_priv;
int i;
Expand All @@ -537,8 +551,11 @@ static inline void init_rx_bufs(struct net_device *dev)
for (i = 0, rbd = lp->rbds; i < rx_ring_size; i++, rbd++) {
struct sk_buff *skb = dev_alloc_skb(PKT_BUF_SZ);

if (skb == NULL)
panic("82596: alloc_skb() failed");
if (skb == NULL) {
remove_rx_bufs(dev);
return -ENOMEM;
}

skb->dev = dev;
rbd->v_next = rbd+1;
rbd->b_next = WSWAPrbd(virt_to_bus(rbd+1));
Expand Down Expand Up @@ -574,19 +591,8 @@ static inline void init_rx_bufs(struct net_device *dev)
rfd->v_next = lp->rfds;
rfd->b_next = WSWAPrfd(virt_to_bus(lp->rfds));
rfd->cmd = CMD_EOL|CMD_FLEX;
}

static inline void remove_rx_bufs(struct net_device *dev)
{
struct i596_private *lp = dev->ml_priv;
struct i596_rbd *rbd;
int i;

for (i = 0, rbd = lp->rbds; i < rx_ring_size; i++, rbd++) {
if (rbd->skb == NULL)
break;
dev_kfree_skb(rbd->skb);
}
return 0;
}


Expand Down Expand Up @@ -1013,7 +1019,11 @@ static int i596_open(struct net_device *dev)
return -EAGAIN;
}
#endif
init_rx_bufs(dev);
res = init_rx_bufs(dev);
if (res) {
free_irq(dev->irq, dev);
return res;
}

netif_start_queue(dev);

Expand Down

0 comments on commit 874ec2d

Please sign in to comment.