aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2011-11-21 05:25:57 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-22 16:15:42 -0500
commit4e55f5785825f18b1eb6c5cc5a9717e276925805 (patch)
tree31a7c44400e598e82e1de0a7326952d00b28767d /net
parent3b829366cc6d0adeb4df2c2d917926f6b41c573d (diff)
atm: Introduce vcc_process_recv_queue
This function moves the implementation found in the clip and br2684 modules to common code, correctly unlinks the skb from the queue before pushing it and makes pppoatm use it. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/atm/br2684.c20
-rw-r--r--net/atm/clip.c13
-rw-r--r--net/atm/common.c20
-rw-r--r--net/atm/common.h1
-rw-r--r--net/atm/pppoatm.c4
5 files changed, 31 insertions, 27 deletions
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 81cf33b1527d..53b0aa14a1e6 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -489,15 +489,11 @@ free_skb:
489 */ 489 */
490static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 490static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
491{ 491{
492 struct sk_buff_head queue;
493 int err;
494 struct br2684_vcc *brvcc; 492 struct br2684_vcc *brvcc;
495 struct sk_buff *skb, *tmp;
496 struct sk_buff_head *rq;
497 struct br2684_dev *brdev; 493 struct br2684_dev *brdev;
498 struct net_device *net_dev; 494 struct net_device *net_dev;
499 struct atm_backend_br2684 be; 495 struct atm_backend_br2684 be;
500 unsigned long flags; 496 int err;
501 497
502 if (copy_from_user(&be, arg, sizeof be)) 498 if (copy_from_user(&be, arg, sizeof be))
503 return -EFAULT; 499 return -EFAULT;
@@ -550,16 +546,6 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
550 atmvcc->push = br2684_push; 546 atmvcc->push = br2684_push;
551 atmvcc->pop = br2684_pop; 547 atmvcc->pop = br2684_pop;
552 548
553 __skb_queue_head_init(&queue);
554 rq = &sk_atm(atmvcc)->sk_receive_queue;
555
556 spin_lock_irqsave(&rq->lock, flags);
557 skb_queue_splice_init(rq, &queue);
558 spin_unlock_irqrestore(&rq->lock, flags);
559
560 skb_queue_walk_safe(&queue, skb, tmp)
561 br2684_push(atmvcc, skb);
562
563 /* initialize netdev carrier state */ 549 /* initialize netdev carrier state */
564 if (atmvcc->dev->signal == ATM_PHY_SIG_LOST) 550 if (atmvcc->dev->signal == ATM_PHY_SIG_LOST)
565 netif_carrier_off(net_dev); 551 netif_carrier_off(net_dev);
@@ -567,6 +553,10 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
567 netif_carrier_on(net_dev); 553 netif_carrier_on(net_dev);
568 554
569 __module_get(THIS_MODULE); 555 __module_get(THIS_MODULE);
556
557 /* re-process everything received between connection setup and
558 backend setup */
559 vcc_process_recv_queue(atmvcc);
570 return 0; 560 return 0;
571 561
572error: 562error:
diff --git a/net/atm/clip.c b/net/atm/clip.c
index e2de7c548b3a..11439a7f6782 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -455,10 +455,7 @@ static netdev_tx_t clip_start_xmit(struct sk_buff *skb,
455 455
456static int clip_mkip(struct atm_vcc *vcc, int timeout) 456static int clip_mkip(struct atm_vcc *vcc, int timeout)
457{ 457{
458 struct sk_buff_head *rq, queue;
459 struct clip_vcc *clip_vcc; 458 struct clip_vcc *clip_vcc;
460 struct sk_buff *skb, *tmp;
461 unsigned long flags;
462 459
463 if (!vcc->push) 460 if (!vcc->push)
464 return -EBADFD; 461 return -EBADFD;
@@ -479,16 +476,8 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout)
479 vcc->push = clip_push; 476 vcc->push = clip_push;
480 vcc->pop = clip_pop; 477 vcc->pop = clip_pop;
481 478
482 __skb_queue_head_init(&queue);
483 rq = &sk_atm(vcc)->sk_receive_queue;
484
485 spin_lock_irqsave(&rq->lock, flags);
486 skb_queue_splice_init(rq, &queue);
487 spin_unlock_irqrestore(&rq->lock, flags);
488
489 /* re-process everything received between connection setup and MKIP */ 479 /* re-process everything received between connection setup and MKIP */
490 skb_queue_walk_safe(&queue, skb, tmp) 480 vcc_process_recv_queue(vcc);
491 clip_push(vcc, skb);
492 481
493 return 0; 482 return 0;
494} 483}
diff --git a/net/atm/common.c b/net/atm/common.c
index 14ff9fe39989..0b4c58fe3919 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -214,6 +214,26 @@ void vcc_release_async(struct atm_vcc *vcc, int reply)
214} 214}
215EXPORT_SYMBOL(vcc_release_async); 215EXPORT_SYMBOL(vcc_release_async);
216 216
217void vcc_process_recv_queue(struct atm_vcc *vcc)
218{
219 struct sk_buff_head queue, *rq;
220 struct sk_buff *skb, *tmp;
221 unsigned long flags;
222
223 __skb_queue_head_init(&queue);
224 rq = &sk_atm(vcc)->sk_receive_queue;
225
226 spin_lock_irqsave(&rq->lock, flags);
227 skb_queue_splice_init(rq, &queue);
228 spin_unlock_irqrestore(&rq->lock, flags);
229
230 skb_queue_walk_safe(&queue, skb, tmp) {
231 __skb_unlink(skb, &queue);
232 vcc->push(vcc, skb);
233 }
234}
235EXPORT_SYMBOL(vcc_process_recv_queue);
236
217void atm_dev_signal_change(struct atm_dev *dev, char signal) 237void atm_dev_signal_change(struct atm_dev *dev, char signal)
218{ 238{
219 pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n", 239 pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n",
diff --git a/net/atm/common.h b/net/atm/common.h
index f48a76b6cdf4..cc3c2dae4d79 100644
--- a/net/atm/common.h
+++ b/net/atm/common.h
@@ -24,6 +24,7 @@ int vcc_setsockopt(struct socket *sock, int level, int optname,
24 char __user *optval, unsigned int optlen); 24 char __user *optval, unsigned int optlen);
25int vcc_getsockopt(struct socket *sock, int level, int optname, 25int vcc_getsockopt(struct socket *sock, int level, int optname,
26 char __user *optval, int __user *optlen); 26 char __user *optval, int __user *optlen);
27void vcc_process_recv_queue(struct atm_vcc *vcc);
27 28
28int atmpvc_init(void); 29int atmpvc_init(void);
29void atmpvc_exit(void); 30void atmpvc_exit(void);
diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c
index db4a11c61d15..df35d9a3b5fe 100644
--- a/net/atm/pppoatm.c
+++ b/net/atm/pppoatm.c
@@ -303,6 +303,10 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg)
303 atmvcc->push = pppoatm_push; 303 atmvcc->push = pppoatm_push;
304 atmvcc->pop = pppoatm_pop; 304 atmvcc->pop = pppoatm_pop;
305 __module_get(THIS_MODULE); 305 __module_get(THIS_MODULE);
306
307 /* re-process everything received between connection setup and
308 backend setup */
309 vcc_process_recv_queue(atmvcc);
306 return 0; 310 return 0;
307} 311}
308 312