summaryrefslogtreecommitdiff
path: root/net/atm/br2684.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-05-28 16:36:47 -0700
committerDavid S. Miller <davem@davemloft.net>2009-05-28 16:36:47 -0700
commitb6211ae7f2e56837c6a4849316396d1535606e90 (patch)
tree4145a71b4832290a70f5932b2b962f94b940b56a /net/atm/br2684.c
parent46c37672d7fff0097385eb0cbd01aa0254dad0aa (diff)
atm: Use SKB queue and list helpers instead of doing it by-hand.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/br2684.c')
-rw-r--r--net/atm/br2684.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 3100a8940afc..bfa8fa9894fc 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -445,9 +445,10 @@ free_skb:
*/
static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
{
+ struct sk_buff_head queue;
int err;
struct br2684_vcc *brvcc;
- struct sk_buff *skb;
+ struct sk_buff *skb, *tmp;
struct sk_buff_head *rq;
struct br2684_dev *brdev;
struct net_device *net_dev;
@@ -505,29 +506,20 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
barrier();
atmvcc->push = br2684_push;
+ __skb_queue_head_init(&queue);
rq = &sk_atm(atmvcc)->sk_receive_queue;
spin_lock_irqsave(&rq->lock, flags);
- if (skb_queue_empty(rq)) {
- skb = NULL;
- } else {
- /* NULL terminate the list. */
- rq->prev->next = NULL;
- skb = rq->next;
- }
- rq->prev = rq->next = (struct sk_buff *)rq;
- rq->qlen = 0;
+ skb_queue_splice_init(rq, &queue);
spin_unlock_irqrestore(&rq->lock, flags);
- while (skb) {
- struct sk_buff *next = skb->next;
+ skb_queue_walk_safe(&queue, skb, tmp) {
+ struct net_device *dev = skb->dev;
- skb->next = skb->prev = NULL;
- br2684_push(atmvcc, skb);
- skb->dev->stats.rx_bytes -= skb->len;
- skb->dev->stats.rx_packets--;
+ dev->stats.rx_bytes -= skb->len;
+ dev->stats.rx_packets--;
- skb = next;
+ br2684_push(atmvcc, skb);
}
__module_get(THIS_MODULE);
return 0;