• Home
  • Raw
  • Download

Lines Matching refs:ap

92 static struct sk_buff* ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *);
97 static int ppp_sync_push(struct syncppp *ap);
98 static void ppp_sync_flush_output(struct syncppp *ap);
99 static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
139 struct syncppp *ap; in sp_get() local
142 ap = tty->disc_data; in sp_get()
143 if (ap != NULL) in sp_get()
144 atomic_inc(&ap->refcnt); in sp_get()
146 return ap; in sp_get()
149 static void sp_put(struct syncppp *ap) in sp_put() argument
151 if (atomic_dec_and_test(&ap->refcnt)) in sp_put()
152 complete(&ap->dead_cmp); in sp_put()
161 struct syncppp *ap; in ppp_sync_open() local
168 ap = kzalloc(sizeof(*ap), GFP_KERNEL); in ppp_sync_open()
170 if (!ap) in ppp_sync_open()
174 ap->tty = tty; in ppp_sync_open()
175 ap->mru = PPP_MRU; in ppp_sync_open()
176 spin_lock_init(&ap->xmit_lock); in ppp_sync_open()
177 spin_lock_init(&ap->recv_lock); in ppp_sync_open()
178 ap->xaccm[0] = ~0U; in ppp_sync_open()
179 ap->xaccm[3] = 0x60000000U; in ppp_sync_open()
180 ap->raccm = ~0U; in ppp_sync_open()
182 skb_queue_head_init(&ap->rqueue); in ppp_sync_open()
183 tasklet_init(&ap->tsk, ppp_sync_process, (unsigned long) ap); in ppp_sync_open()
185 atomic_set(&ap->refcnt, 1); in ppp_sync_open()
186 init_completion(&ap->dead_cmp); in ppp_sync_open()
188 ap->chan.private = ap; in ppp_sync_open()
189 ap->chan.ops = &sync_ops; in ppp_sync_open()
190 ap->chan.mtu = PPP_MRU; in ppp_sync_open()
191 ap->chan.hdrlen = 2; /* for A/C bytes */ in ppp_sync_open()
193 ap->chan.speed = speed; in ppp_sync_open()
194 err = ppp_register_channel(&ap->chan); in ppp_sync_open()
198 tty->disc_data = ap; in ppp_sync_open()
203 kfree(ap); in ppp_sync_open()
219 struct syncppp *ap; in ppp_sync_close() local
222 ap = tty->disc_data; in ppp_sync_close()
225 if (!ap) in ppp_sync_close()
235 if (!atomic_dec_and_test(&ap->refcnt)) in ppp_sync_close()
236 wait_for_completion(&ap->dead_cmp); in ppp_sync_close()
237 tasklet_kill(&ap->tsk); in ppp_sync_close()
239 ppp_unregister_channel(&ap->chan); in ppp_sync_close()
240 skb_queue_purge(&ap->rqueue); in ppp_sync_close()
241 kfree_skb(ap->tpkt); in ppp_sync_close()
242 kfree(ap); in ppp_sync_close()
283 struct syncppp *ap = sp_get(tty); in ppp_synctty_ioctl() local
287 if (!ap) in ppp_synctty_ioctl()
293 if (put_user(ppp_channel_index(&ap->chan), p)) in ppp_synctty_ioctl()
300 if (put_user(ppp_unit_number(&ap->chan), p)) in ppp_synctty_ioctl()
308 ppp_sync_flush_output(ap); in ppp_synctty_ioctl()
324 sp_put(ap); in ppp_synctty_ioctl()
340 struct syncppp *ap = sp_get(tty); in ppp_sync_receive() local
343 if (!ap) in ppp_sync_receive()
345 spin_lock_irqsave(&ap->recv_lock, flags); in ppp_sync_receive()
346 ppp_sync_input(ap, buf, cflags, count); in ppp_sync_receive()
347 spin_unlock_irqrestore(&ap->recv_lock, flags); in ppp_sync_receive()
348 if (!skb_queue_empty(&ap->rqueue)) in ppp_sync_receive()
349 tasklet_schedule(&ap->tsk); in ppp_sync_receive()
350 sp_put(ap); in ppp_sync_receive()
357 struct syncppp *ap = sp_get(tty); in ppp_sync_wakeup() local
360 if (!ap) in ppp_sync_wakeup()
362 set_bit(XMIT_WAKEUP, &ap->xmit_flags); in ppp_sync_wakeup()
363 tasklet_schedule(&ap->tsk); in ppp_sync_wakeup()
364 sp_put(ap); in ppp_sync_wakeup()
401 struct syncppp *ap = chan->private; in ppp_sync_ioctl() local
410 val = ap->flags | ap->rbits; in ppp_sync_ioctl()
418 ap->flags = val & ~SC_RCV_BITS; in ppp_sync_ioctl()
419 spin_lock_irq(&ap->recv_lock); in ppp_sync_ioctl()
420 ap->rbits = val & SC_RCV_BITS; in ppp_sync_ioctl()
421 spin_unlock_irq(&ap->recv_lock); in ppp_sync_ioctl()
426 if (put_user(ap->xaccm[0], p)) in ppp_sync_ioctl()
431 if (get_user(ap->xaccm[0], p)) in ppp_sync_ioctl()
437 if (put_user(ap->raccm, p)) in ppp_sync_ioctl()
442 if (get_user(ap->raccm, p)) in ppp_sync_ioctl()
448 if (copy_to_user(argp, ap->xaccm, sizeof(ap->xaccm))) in ppp_sync_ioctl()
457 memcpy(ap->xaccm, accm, sizeof(ap->xaccm)); in ppp_sync_ioctl()
462 if (put_user(ap->mru, (int __user *) argp)) in ppp_sync_ioctl()
471 ap->mru = val; in ppp_sync_ioctl()
488 struct syncppp *ap = (struct syncppp *) arg; in ppp_sync_process() local
492 while ((skb = skb_dequeue(&ap->rqueue)) != NULL) { in ppp_sync_process()
495 ppp_input_error(&ap->chan, 0); in ppp_sync_process()
499 ppp_input(&ap->chan, skb); in ppp_sync_process()
503 if (test_bit(XMIT_WAKEUP, &ap->xmit_flags) && ppp_sync_push(ap)) in ppp_sync_process()
504 ppp_output_wakeup(&ap->chan); in ppp_sync_process()
512 ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb) in ppp_sync_txmunge() argument
528 if (data[0] == 0 && (ap->flags & SC_COMP_PROT) && !islcp) in ppp_sync_txmunge()
532 if ((ap->flags & SC_COMP_AC) == 0 || islcp) { in ppp_sync_txmunge()
550 ap->last_xmit = jiffies; in ppp_sync_txmunge()
552 if (skb && ap->flags & SC_LOG_OUTPKT) in ppp_sync_txmunge()
571 struct syncppp *ap = chan->private; in ppp_sync_send() local
573 ppp_sync_push(ap); in ppp_sync_send()
575 if (test_and_set_bit(XMIT_FULL, &ap->xmit_flags)) in ppp_sync_send()
577 skb = ppp_sync_txmunge(ap, skb); in ppp_sync_send()
579 ap->tpkt = skb; in ppp_sync_send()
581 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_send()
583 ppp_sync_push(ap); in ppp_sync_send()
591 ppp_sync_push(struct syncppp *ap) in ppp_sync_push() argument
594 struct tty_struct *tty = ap->tty; in ppp_sync_push()
597 if (!spin_trylock_bh(&ap->xmit_lock)) in ppp_sync_push()
600 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) in ppp_sync_push()
602 if (!tty_stuffed && ap->tpkt) { in ppp_sync_push()
604 sent = tty->ops->write(tty, ap->tpkt->data, ap->tpkt->len); in ppp_sync_push()
607 if (sent < ap->tpkt->len) { in ppp_sync_push()
610 consume_skb(ap->tpkt); in ppp_sync_push()
611 ap->tpkt = NULL; in ppp_sync_push()
612 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_push()
618 spin_unlock_bh(&ap->xmit_lock); in ppp_sync_push()
619 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) || in ppp_sync_push()
620 (!tty_stuffed && ap->tpkt))) in ppp_sync_push()
622 if (!spin_trylock_bh(&ap->xmit_lock)) in ppp_sync_push()
628 if (ap->tpkt) { in ppp_sync_push()
629 kfree_skb(ap->tpkt); in ppp_sync_push()
630 ap->tpkt = NULL; in ppp_sync_push()
631 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_push()
634 spin_unlock_bh(&ap->xmit_lock); in ppp_sync_push()
643 ppp_sync_flush_output(struct syncppp *ap) in ppp_sync_flush_output() argument
647 spin_lock_bh(&ap->xmit_lock); in ppp_sync_flush_output()
648 if (ap->tpkt != NULL) { in ppp_sync_flush_output()
649 kfree_skb(ap->tpkt); in ppp_sync_flush_output()
650 ap->tpkt = NULL; in ppp_sync_flush_output()
651 clear_bit(XMIT_FULL, &ap->xmit_flags); in ppp_sync_flush_output()
654 spin_unlock_bh(&ap->xmit_lock); in ppp_sync_flush_output()
656 ppp_output_wakeup(&ap->chan); in ppp_sync_flush_output()
670 ppp_sync_input(struct syncppp *ap, const unsigned char *buf, in ppp_sync_input() argument
679 if (ap->flags & SC_LOG_INPKT) in ppp_sync_input()
683 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()