• Home
  • Raw
  • Download

Lines Matching full:ap

89 static struct sk_buff* ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *);
94 static int ppp_sync_push(struct syncppp *ap);
95 static void ppp_sync_flush_output(struct syncppp *ap);
96 static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
136 struct syncppp *ap; in sp_get() local
139 ap = tty->disc_data; in sp_get()
140 if (ap != NULL) in sp_get()
141 refcount_inc(&ap->refcnt); in sp_get()
143 return ap; in sp_get()
146 static void sp_put(struct syncppp *ap) in sp_put() argument
148 if (refcount_dec_and_test(&ap->refcnt)) in sp_put()
149 complete(&ap->dead_cmp); in sp_put()
158 struct syncppp *ap; in ppp_sync_open() local
165 ap = kzalloc(sizeof(*ap), GFP_KERNEL); in ppp_sync_open()
167 if (!ap) in ppp_sync_open()
171 ap->tty = tty; in ppp_sync_open()
172 ap->mru = PPP_MRU; in ppp_sync_open()
173 spin_lock_init(&ap->xmit_lock); in ppp_sync_open()
174 spin_lock_init(&ap->recv_lock); in ppp_sync_open()
175 ap->xaccm[0] = ~0U; in ppp_sync_open()
176 ap->xaccm[3] = 0x60000000U; in ppp_sync_open()
177 ap->raccm = ~0U; in ppp_sync_open()
179 skb_queue_head_init(&ap->rqueue); in ppp_sync_open()
180 tasklet_init(&ap->tsk, ppp_sync_process, (unsigned long) ap); in ppp_sync_open()
182 refcount_set(&ap->refcnt, 1); in ppp_sync_open()
183 init_completion(&ap->dead_cmp); in ppp_sync_open()
185 ap->chan.private = ap; in ppp_sync_open()
186 ap->chan.ops = &sync_ops; in ppp_sync_open()
187 ap->chan.mtu = PPP_MRU; in ppp_sync_open()
188 ap->chan.hdrlen = 2; /* for A/C bytes */ in ppp_sync_open()
190 ap->chan.speed = speed; in ppp_sync_open()
191 err = ppp_register_channel(&ap->chan); in ppp_sync_open()
195 tty->disc_data = ap; in ppp_sync_open()
200 kfree(ap); in ppp_sync_open()
216 struct syncppp *ap; in ppp_sync_close() local
219 ap = tty->disc_data; in ppp_sync_close()
222 if (!ap) in ppp_sync_close()
226 * We have now ensured that nobody can start using ap from now in ppp_sync_close()
232 if (!refcount_dec_and_test(&ap->refcnt)) in ppp_sync_close()
233 wait_for_completion(&ap->dead_cmp); in ppp_sync_close()
234 tasklet_kill(&ap->tsk); in ppp_sync_close()
236 ppp_unregister_channel(&ap->chan); in ppp_sync_close()
237 skb_queue_purge(&ap->rqueue); in ppp_sync_close()
238 kfree_skb(ap->tpkt); in ppp_sync_close()
239 kfree(ap); in ppp_sync_close()
281 struct syncppp *ap = sp_get(tty); in ppp_synctty_ioctl() local
285 if (!ap) in ppp_synctty_ioctl()
291 if (put_user(ppp_channel_index(&ap->chan), p)) in ppp_synctty_ioctl()
298 if (put_user(ppp_unit_number(&ap->chan), p)) in ppp_synctty_ioctl()
306 ppp_sync_flush_output(ap); in ppp_synctty_ioctl()
322 sp_put(ap); in ppp_synctty_ioctl()
338 struct syncppp *ap = sp_get(tty); in ppp_sync_receive() local
341 if (!ap) in ppp_sync_receive()
343 spin_lock_irqsave(&ap->recv_lock, flags); in ppp_sync_receive()
344 ppp_sync_input(ap, buf, cflags, count); in ppp_sync_receive()
345 spin_unlock_irqrestore(&ap->recv_lock, flags); in ppp_sync_receive()
346 if (!skb_queue_empty(&ap->rqueue)) in ppp_sync_receive()
347 tasklet_schedule(&ap->tsk); in ppp_sync_receive()
348 sp_put(ap); in ppp_sync_receive()
355 struct syncppp *ap = sp_get(tty); in ppp_sync_wakeup() local
358 if (!ap) in ppp_sync_wakeup()
360 set_bit(XMIT_WAKEUP, &ap->xmit_flags); in ppp_sync_wakeup()
361 tasklet_schedule(&ap->tsk); in ppp_sync_wakeup()
362 sp_put(ap); in ppp_sync_wakeup()
399 struct syncppp *ap = chan->private; in ppp_sync_ioctl() local
408 val = ap->flags | ap->rbits; in ppp_sync_ioctl()
416 ap->flags = val & ~SC_RCV_BITS; in ppp_sync_ioctl()
417 spin_lock_irq(&ap->recv_lock); in ppp_sync_ioctl()
418 ap->rbits = val & SC_RCV_BITS; in ppp_sync_ioctl()
419 spin_unlock_irq(&ap->recv_lock); in ppp_sync_ioctl()
424 if (put_user(ap->xaccm[0], p)) in ppp_sync_ioctl()
429 if (get_user(ap->xaccm[0], p)) in ppp_sync_ioctl()
435 if (put_user(ap->raccm, p)) in ppp_sync_ioctl()
440 if (get_user(ap->raccm, p)) in ppp_sync_ioctl()
446 if (copy_to_user(argp, ap->xaccm, sizeof(ap->xaccm))) in ppp_sync_ioctl()
455 memcpy(ap->xaccm, accm, sizeof(ap->xaccm)); in ppp_sync_ioctl()
460 if (put_user(ap->mru, (int __user *) argp)) in ppp_sync_ioctl()
473 ap->mru = val; in ppp_sync_ioctl()
490 struct syncppp *ap = (struct syncppp *) arg; in ppp_sync_process() local
494 while ((skb = skb_dequeue(&ap->rqueue)) != NULL) { in ppp_sync_process()
497 ppp_input_error(&ap->chan, 0); in ppp_sync_process()
501 ppp_input(&ap->chan, skb); in ppp_sync_process()
505 if (test_bit(XMIT_WAKEUP, &ap->xmit_flags) && ppp_sync_push(ap)) in ppp_sync_process()
506 ppp_output_wakeup(&ap->chan); in ppp_sync_process()
514 ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb) in ppp_sync_txmunge() argument
530 if (data[0] == 0 && (ap->flags & SC_COMP_PROT) && !islcp) in ppp_sync_txmunge()
534 if ((ap->flags & SC_COMP_AC) == 0 || islcp) { in ppp_sync_txmunge()
552 ap->last_xmit = jiffies; in ppp_sync_txmunge()
554 if (skb && ap->flags & SC_LOG_OUTPKT) in ppp_sync_txmunge()
573 struct syncppp *ap = chan->private; in ppp_sync_send() local
575 ppp_sync_push(ap); in ppp_sync_send()
577 if (test_and_set_bit(XMIT_FULL, &ap->xmit_flags)) in ppp_sync_send()
579 skb = ppp_sync_txmunge(ap, skb); in ppp_sync_send()
581 ap->tpkt = skb; in ppp_sync_send()
583 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_send()
585 ppp_sync_push(ap); in ppp_sync_send()
593 ppp_sync_push(struct syncppp *ap) in ppp_sync_push() argument
596 struct tty_struct *tty = ap->tty; in ppp_sync_push()
599 if (!spin_trylock_bh(&ap->xmit_lock)) in ppp_sync_push()
602 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) in ppp_sync_push()
604 if (!tty_stuffed && ap->tpkt) { in ppp_sync_push()
606 sent = tty->ops->write(tty, ap->tpkt->data, ap->tpkt->len); in ppp_sync_push()
609 if (sent < ap->tpkt->len) { in ppp_sync_push()
612 consume_skb(ap->tpkt); in ppp_sync_push()
613 ap->tpkt = NULL; in ppp_sync_push()
614 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_push()
620 spin_unlock_bh(&ap->xmit_lock); in ppp_sync_push()
621 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) || in ppp_sync_push()
622 (!tty_stuffed && ap->tpkt))) in ppp_sync_push()
624 if (!spin_trylock_bh(&ap->xmit_lock)) in ppp_sync_push()
630 if (ap->tpkt) { in ppp_sync_push()
631 kfree_skb(ap->tpkt); in ppp_sync_push()
632 ap->tpkt = NULL; in ppp_sync_push()
633 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_push()
636 spin_unlock_bh(&ap->xmit_lock); in ppp_sync_push()
645 ppp_sync_flush_output(struct syncppp *ap) in ppp_sync_flush_output() argument
649 spin_lock_bh(&ap->xmit_lock); in ppp_sync_flush_output()
650 if (ap->tpkt != NULL) { in ppp_sync_flush_output()
651 kfree_skb(ap->tpkt); in ppp_sync_flush_output()
652 ap->tpkt = NULL; in ppp_sync_flush_output()
653 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_flush_output()
656 spin_unlock_bh(&ap->xmit_lock); in ppp_sync_flush_output()
658 ppp_output_wakeup(&ap->chan); in ppp_sync_flush_output()
672 ppp_sync_input(struct syncppp *ap, const unsigned char *buf, in ppp_sync_input() argument
681 if (ap->flags & SC_LOG_INPKT) in ppp_sync_input()
685 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); in ppp_sync_input()
720 skb_queue_tail(&ap->rqueue, skb); in ppp_sync_input()
727 skb_queue_tail(&ap->rqueue, skb); in ppp_sync_input()