Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jorge Boncompte [DTI2] and committed by
David S. Miller
4e55f578 3b829366

+31 -27
+5 -15
net/atm/br2684.c
··· 489 489 */ 490 490 static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 491 491 { 492 - struct sk_buff_head queue; 493 - int err; 494 492 struct br2684_vcc *brvcc; 495 - struct sk_buff *skb, *tmp; 496 - struct sk_buff_head *rq; 497 493 struct br2684_dev *brdev; 498 494 struct net_device *net_dev; 499 495 struct atm_backend_br2684 be; 500 - unsigned long flags; 496 + int err; 501 497 502 498 if (copy_from_user(&be, arg, sizeof be)) 503 499 return -EFAULT; ··· 546 550 atmvcc->push = br2684_push; 547 551 atmvcc->pop = br2684_pop; 548 552 549 - __skb_queue_head_init(&queue); 550 - rq = &sk_atm(atmvcc)->sk_receive_queue; 551 - 552 - spin_lock_irqsave(&rq->lock, flags); 553 - skb_queue_splice_init(rq, &queue); 554 - spin_unlock_irqrestore(&rq->lock, flags); 555 - 556 - skb_queue_walk_safe(&queue, skb, tmp) 557 - br2684_push(atmvcc, skb); 558 - 559 553 /* initialize netdev carrier state */ 560 554 if (atmvcc->dev->signal == ATM_PHY_SIG_LOST) 561 555 netif_carrier_off(net_dev); ··· 553 567 netif_carrier_on(net_dev); 554 568 555 569 __module_get(THIS_MODULE); 570 + 571 + /* re-process everything received between connection setup and 572 + backend setup */ 573 + vcc_process_recv_queue(atmvcc); 556 574 return 0; 557 575 558 576 error:
+1 -12
net/atm/clip.c
··· 455 455 456 456 static int clip_mkip(struct atm_vcc *vcc, int timeout) 457 457 { 458 - struct sk_buff_head *rq, queue; 459 458 struct clip_vcc *clip_vcc; 460 - struct sk_buff *skb, *tmp; 461 - unsigned long flags; 462 459 463 460 if (!vcc->push) 464 461 return -EBADFD; ··· 476 479 vcc->push = clip_push; 477 480 vcc->pop = clip_pop; 478 481 479 - __skb_queue_head_init(&queue); 480 - rq = &sk_atm(vcc)->sk_receive_queue; 481 - 482 - spin_lock_irqsave(&rq->lock, flags); 483 - skb_queue_splice_init(rq, &queue); 484 - spin_unlock_irqrestore(&rq->lock, flags); 485 - 486 482 /* re-process everything received between connection setup and MKIP */ 487 - skb_queue_walk_safe(&queue, skb, tmp) 488 - clip_push(vcc, skb); 483 + vcc_process_recv_queue(vcc); 489 484 490 485 return 0; 491 486 }
+20
net/atm/common.c
··· 214 214 } 215 215 EXPORT_SYMBOL(vcc_release_async); 216 216 217 + void 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 + } 235 + EXPORT_SYMBOL(vcc_process_recv_queue); 236 + 217 237 void atm_dev_signal_change(struct atm_dev *dev, char signal) 218 238 { 219 239 pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n",
+1
net/atm/common.h
··· 24 24 char __user *optval, unsigned int optlen); 25 25 int vcc_getsockopt(struct socket *sock, int level, int optname, 26 26 char __user *optval, int __user *optlen); 27 + void vcc_process_recv_queue(struct atm_vcc *vcc); 27 28 28 29 int atmpvc_init(void); 29 30 void atmpvc_exit(void);
+4
net/atm/pppoatm.c
··· 303 303 atmvcc->push = pppoatm_push; 304 304 atmvcc->pop = pppoatm_pop; 305 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 310 return 0; 307 311 } 308 312