atm: idt77252: Use generic SKB queue management instead of home-grown scheme.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2008-09-21 21:38:26 -07:00
parent 43f59c8939
commit ceade961c4
2 changed files with 10 additions and 26 deletions

View file

@ -1114,11 +1114,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
rpp = &vc->rcv.rx_pool; rpp = &vc->rcv.rx_pool;
__skb_queue_tail(&rpp->queue, skb);
rpp->len += skb->len; rpp->len += skb->len;
if (!rpp->count++)
rpp->first = skb;
*rpp->last = skb;
rpp->last = &skb->next;
if (stat & SAR_RSQE_EPDU) { if (stat & SAR_RSQE_EPDU) {
unsigned char *l1l2; unsigned char *l1l2;
@ -1145,7 +1142,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
atomic_inc(&vcc->stats->rx_err); atomic_inc(&vcc->stats->rx_err);
return; return;
} }
if (rpp->count > 1) { if (skb_queue_len(&rpp->queue) > 1) {
struct sk_buff *sb; struct sk_buff *sb;
skb = dev_alloc_skb(rpp->len); skb = dev_alloc_skb(rpp->len);
@ -1161,12 +1158,9 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
dev_kfree_skb(skb); dev_kfree_skb(skb);
return; return;
} }
sb = rpp->first; skb_queue_walk(&rpp->queue, sb)
for (i = 0; i < rpp->count; i++) {
memcpy(skb_put(skb, sb->len), memcpy(skb_put(skb, sb->len),
sb->data, sb->len); sb->data, sb->len);
sb = sb->next;
}
recycle_rx_pool_skb(card, rpp); recycle_rx_pool_skb(card, rpp);
@ -1180,7 +1174,6 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
return; return;
} }
skb->next = NULL;
flush_rx_pool(card, rpp); flush_rx_pool(card, rpp);
if (!atm_charge(vcc, skb->truesize)) { if (!atm_charge(vcc, skb->truesize)) {
@ -1918,25 +1911,18 @@ recycle_rx_skb(struct idt77252_dev *card, struct sk_buff *skb)
static void static void
flush_rx_pool(struct idt77252_dev *card, struct rx_pool *rpp) flush_rx_pool(struct idt77252_dev *card, struct rx_pool *rpp)
{ {
skb_queue_head_init(&rpp->queue);
rpp->len = 0; rpp->len = 0;
rpp->count = 0;
rpp->first = NULL;
rpp->last = &rpp->first;
} }
static void static void
recycle_rx_pool_skb(struct idt77252_dev *card, struct rx_pool *rpp) recycle_rx_pool_skb(struct idt77252_dev *card, struct rx_pool *rpp)
{ {
struct sk_buff *skb, *next; struct sk_buff *skb, *tmp;
int i;
skb = rpp->first; skb_queue_walk_safe(&rpp->queue, skb, tmp)
for (i = 0; i < rpp->count; i++) {
next = skb->next;
skb->next = NULL;
recycle_rx_skb(card, skb); recycle_rx_skb(card, skb);
skb = next;
}
flush_rx_pool(card, rpp); flush_rx_pool(card, rpp);
} }
@ -2537,7 +2523,7 @@ idt77252_close(struct atm_vcc *vcc)
waitfor_idle(card); waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags); spin_unlock_irqrestore(&card->cmd_lock, flags);
if (vc->rcv.rx_pool.count) { if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
DPRINTK("%s: closing a VC with pending rx buffers.\n", DPRINTK("%s: closing a VC with pending rx buffers.\n",
card->name); card->name);
@ -2970,7 +2956,7 @@ close_card_oam(struct idt77252_dev *card)
waitfor_idle(card); waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags); spin_unlock_irqrestore(&card->cmd_lock, flags);
if (vc->rcv.rx_pool.count) { if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
DPRINTK("%s: closing a VC " DPRINTK("%s: closing a VC "
"with pending rx buffers.\n", "with pending rx buffers.\n",
card->name); card->name);

View file

@ -173,10 +173,8 @@ struct scq_info
}; };
struct rx_pool { struct rx_pool {
struct sk_buff *first; struct sk_buff_head queue;
struct sk_buff **last;
unsigned int len; unsigned int len;
unsigned int count;
}; };
struct aal1 { struct aal1 {