• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/net/

Lines Matching refs: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,
174 struct syncppp *ap;
177 ap = tty->disc_data;
178 if (ap != NULL)
179 atomic_inc(&ap->refcnt);
181 return ap;
184 static void sp_put(struct syncppp *ap)
186 if (atomic_dec_and_test(&ap->refcnt))
187 up(&ap->dead_sem);
196 struct syncppp *ap;
199 ap = kmalloc(sizeof(*ap), GFP_KERNEL);
201 if (ap == 0)
205 memset(ap, 0, sizeof(*ap));
206 ap->tty = tty;
207 ap->mru = PPP_MRU;
208 spin_lock_init(&ap->xmit_lock);
209 spin_lock_init(&ap->recv_lock);
210 ap->xaccm[0] = ~0U;
211 ap->xaccm[3] = 0x60000000U;
212 ap->raccm = ~0U;
214 skb_queue_head_init(&ap->rqueue);
215 tasklet_init(&ap->tsk, ppp_sync_process, (unsigned long) ap);
217 atomic_set(&ap->refcnt, 1);
218 init_MUTEX_LOCKED(&ap->dead_sem);
220 ap->chan.private = ap;
221 ap->chan.ops = &sync_ops;
222 ap->chan.mtu = PPP_MRU;
223 ap->chan.hdrlen = 2; /* for A/C bytes */
224 err = ppp_register_channel(&ap->chan);
228 tty->disc_data = ap;
233 kfree(ap);
249 struct syncppp *ap;
252 ap = tty->disc_data;
255 if (ap == 0)
259 * We have now ensured that nobody can start using ap from now
265 if (!atomic_dec_and_test(&ap->refcnt))
266 down(&ap->dead_sem);
267 tasklet_kill(&ap->tsk);
269 ppp_unregister_channel(&ap->chan);
270 skb_queue_purge(&ap->rqueue);
271 if (ap->tpkt != 0)
272 kfree_skb(ap->tpkt);
273 kfree(ap);
314 struct syncppp *ap = sp_get(tty);
318 if (ap == 0)
324 if (ap == 0)
327 if (put_user(ppp_channel_index(&ap->chan), p))
334 if (ap == 0)
337 if (put_user(ppp_unit_number(&ap->chan), p))
350 ppp_sync_flush_output(ap);
365 sp_put(ap);
384 struct syncppp *ap = sp_get(tty);
387 if (ap == 0)
389 spin_lock_irqsave(&ap->recv_lock, flags);
390 ppp_sync_input(ap, buf, cflags, count);
391 spin_unlock_irqrestore(&ap->recv_lock, flags);
392 if (!skb_queue_empty(&ap->rqueue))
393 tasklet_schedule(&ap->tsk);
394 sp_put(ap);
403 struct syncppp *ap = sp_get(tty);
406 if (ap == 0)
408 set_bit(XMIT_WAKEUP, &ap->xmit_flags);
409 tasklet_schedule(&ap->tsk);
410 sp_put(ap);
447 struct syncppp *ap = chan->private;
456 val = ap->flags | ap->rbits;
464 ap->flags = val & ~SC_RCV_BITS;
465 spin_lock_irq(&ap->recv_lock);
466 ap->rbits = val & SC_RCV_BITS;
467 spin_unlock_irq(&ap->recv_lock);
472 if (put_user(ap->xaccm[0], p))
477 if (get_user(ap->xaccm[0], p))
483 if (put_user(ap->raccm, p))
488 if (get_user(ap->raccm, p))
494 if (copy_to_user(argp, ap->xaccm, sizeof(ap->xaccm)))
503 memcpy(ap->xaccm, accm, sizeof(ap->xaccm));
508 if (put_user(ap->mru, (int __user *) argp))
517 ap->mru = val;
534 struct syncppp *ap = (struct syncppp *) arg;
538 while ((skb = skb_dequeue(&ap->rqueue)) != NULL) {
541 ppp_input_error(&ap->chan, 0);
545 ppp_input(&ap->chan, skb);
549 if (test_bit(XMIT_WAKEUP, &ap->xmit_flags) && ppp_sync_push(ap))
550 ppp_output_wakeup(&ap->chan);
558 ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb)
574 if (data[0] == 0 && (ap->flags & SC_COMP_PROT) && !islcp)
578 if ((ap->flags & SC_COMP_AC) == 0 || islcp) {
596 ap->last_xmit = jiffies;
598 if (skb && ap->flags & SC_LOG_OUTPKT)
617 struct syncppp *ap = chan->private;
619 ppp_sync_push(ap);
621 if (test_and_set_bit(XMIT_FULL, &ap->xmit_flags))
623 skb = ppp_sync_txmunge(ap, skb);
625 ap->tpkt = skb;
627 clear_bit(XMIT_FULL, &ap->xmit_flags);
629 ppp_sync_push(ap);
637 ppp_sync_push(struct syncppp *ap)
640 struct tty_struct *tty = ap->tty;
643 if (!spin_trylock_bh(&ap->xmit_lock))
646 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags))
648 if (!tty_stuffed && ap->tpkt != 0) {
650 sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len);
653 if (sent < ap->tpkt->len) {
656 kfree_skb(ap->tpkt);
657 ap->tpkt = NULL;
658 clear_bit(XMIT_FULL, &ap->xmit_flags);
664 spin_unlock_bh(&ap->xmit_lock);
665 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
666 || (!tty_stuffed && ap->tpkt != 0)))
668 if (!spin_trylock_bh(&ap->xmit_lock))
674 if (ap->tpkt != 0) {
675 kfree_skb(ap->tpkt);
676 ap->tpkt = NULL;
677 clear_bit(XMIT_FULL, &ap->xmit_flags);
680 spin_unlock_bh(&ap->xmit_lock);
689 ppp_sync_flush_output(struct syncppp *ap)
693 spin_lock_bh(&ap->xmit_lock);
694 if (ap->tpkt != NULL) {
695 kfree_skb(ap->tpkt);
696 ap->tpkt = NULL;
697 clear_bit(XMIT_FULL, &ap->xmit_flags);
700 spin_unlock_bh(&ap->xmit_lock);
702 ppp_output_wakeup(&ap->chan);
716 ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
725 if (ap->flags & SC_LOG_INPKT)
729 if ((skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2)) == 0) {
765 skb_queue_tail(&ap->rqueue, skb);
772 skb_queue_tail(&ap->rqueue, skb);