• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/ppp-2.4.4/modules/

Lines Matching refs:cp

192     comp_state_t *cp;
198 cp = (comp_state_t *) ALLOC_SLEEP(sizeof(comp_state_t));
199 if (cp == NULL)
201 bzero((caddr_t)cp, sizeof(comp_state_t));
202 WR(q)->q_ptr = q->q_ptr = (caddr_t) cp;
203 cp->mru = PPP_MRU;
204 cp->mtu = PPP_MTU;
205 cp->xstate = NULL;
206 cp->rstate = NULL;
207 vj_compress_init(&cp->vj_comp, -1);
209 if (!(thread = kernel_thread_w_arg(first_task, ppp_comp_alloc, (void *)cp)))
211 cp->thread = thread;
221 comp_state_t *cp;
224 cp = (comp_state_t *) q->q_ptr;
225 if (cp != NULL) {
226 if (cp->xstate != NULL)
227 (*cp->xcomp->comp_free)(cp->xstate);
228 if (cp->rstate != NULL)
229 (*cp->rcomp->decomp_free)(cp->rstate);
231 if (!cp->thread)
234 thread_terminate(cp->thread);
236 FREE(cp, sizeof(comp_state_t));
253 ppp_comp_alloc(comp_state_t *cp)
267 cp = thread->reply_port;
273 assert_wait((vm_offset_t)&cp->memreq.thread_status, TRUE);
278 cmd = cp->memreq.cmd;
279 compressor_options = &cp->memreq.comp_opts[0];
282 cp->memreq.returned_mem = cp->xcomp->comp_alloc(compressor_options, len);
283 if (!cp->memreq.returned_mem) {
284 cp->memreq.thread_status = ENOSR;
286 cp->memreq.thread_status = 0;
289 cp->memreq.returned_mem = cp->rcomp->decomp_alloc(compressor_options, len);
290 if (!cp->memreq.returned_mem) {
291 cp->memreq.thread_status = ENOSR;
293 cp->memreq.thread_status = 0;
326 comp_state_t *cp;
336 cp = (comp_state_t *) q->q_ptr;
337 if (cp == 0) {
338 DPRINT("cp == 0 in ppp_comp_wput\n");
359 DPRINT1("ppp_comp_wput/%d: PPPIO_CFLAGS b_cont = 0!\n", cp->unit);
364 cp->flags = (cp->flags & ~mask) | (flags & mask);
366 if (cp->xstate != NULL) {
367 (*cp->xcomp->comp_free)(cp->xstate);
368 cp->xstate = NULL;
370 if (cp->rstate != NULL) {
371 (*cp->rcomp->decomp_free)(cp->rstate);
372 cp->rstate = NULL;
374 cp->flags &= ~CCP_ISUP;
378 ((int *) mp->b_cont->b_rptr)[0] = cp->flags;
389 DPRINT1("ppp_comp_wput/%d: PPPIO_VJINIT b_cont = 0!\n", cp->unit);
396 vj_compress_init(&cp->vj_comp, nxslots);
397 cp->vj_last_ierrors = cp->stats.ppp_ierrors;
407 DPRINT1("ppp_comp_wput/%d: PPPIO_[XR]COMP b_cont = 0!\n", cp->unit);
426 if (cp->xstate != NULL) {
427 (*cp->xcomp->comp_free)(cp->xstate);
428 cp->xstate = NULL;
430 cp->xcomp = *comp;
431 cp->xstate = (*comp)->comp_alloc(opt_data, len);
432 if (cp->xstate == NULL)
435 if (cp->rstate != NULL) {
436 (*cp->rcomp->decomp_free)(cp->rstate);
437 cp->rstate = NULL;
439 cp->rcomp = *comp;
440 cp->rstate = (*comp)->decomp_alloc(opt_data, len);
441 if (cp->rstate == NULL)
445 if ((error = cp->memreq.thread_status) != EAGAIN)
447 if (cp->xstate) {
448 (*cp->xcomp->comp_free)(cp->xstate);
449 cp->xstate = 0;
453 if (sizeof (cp->memreq.comp_opts) < len) {
456 cp->memreq.thread_status = ENOSR;
457 cp->memreq.returned_mem = 0;
461 if (cp->memreq.thread_status == 0 && !cp->memreq.returned_mem) {
462 bcopy(opt_data, cp->memreq.comp_opts, len);
463 cp->memreq.cmd = PPPIO_XCOMP;
464 cp->xcomp = *comp;
465 error = cp->memreq.thread_status = EAGAIN;
466 thread_wakeup((vm_offset_t)&cp->memreq.thread_status);
468 cp->xstate = cp->memreq.returned_mem;
469 cp->memreq.returned_mem = 0;
470 cp->memreq.thread_status = 0;
473 if (cp->rstate) {
474 (*cp->rcomp->decomp_free)(cp->rstate);
475 cp->rstate = NULL;
477 if (sizeof (cp->memreq.comp_opts) < len) {
480 cp->memreq.thread_status = ENOSR;
481 cp->memreq.returned_mem = 0;
483 if (cp->memreq.thread_status == 0 && !cp->memreq.returned_mem) {
484 bcopy(opt_data, cp->memreq.comp_opts, len);
485 cp->memreq.cmd = PPPIO_RCOMP;
486 cp->rcomp = *comp;
487 error = cp->memreq.thread_status = EAGAIN;
488 thread_wakeup((vm_offset_t)&cp->memreq.thread_status);
490 cp->rstate = cp->memreq.returned_mem;
491 cp->memreq.returned_mem = 0;
492 cp->memreq.thread_status = 0;
502 if ((cp->flags & LAST_MOD) == 0) {
517 psp->p = cp->stats;
518 psp->vj = cp->vj_comp.stats;
535 if (cp->xstate != 0)
536 (*cp->xcomp->comp_stat)(cp->xstate, &csp->c);
537 if (cp->rstate != 0)
538 (*cp->rcomp->decomp_stat)(cp->rstate, &csp->d);
546 DPRINT1("ppp_comp_wput/%d: PPPIO_DEBUG b_cont = 0!\n", cp->unit);
551 DPRINT1("ppp_comp%d: debug log enabled\n", cp->unit);
552 cp->flags |= DBGLOG;
561 cp->flags |= LAST_MOD;
586 cp->mtu = ((unsigned short *)mp->b_rptr)[1];
589 cp->mru = ((unsigned short *)mp->b_rptr)[1];
592 cp->unit = mp->b_rptr[1];
610 comp_state_t *cp;
615 cp = (comp_state_t *) q->q_ptr;
616 if (cp == 0) {
617 DPRINT("cp == 0 in ppp_comp_wsrv\n");
640 cp->stats.ppp_oerrors++;
662 cp->stats.ppp_oerrors++;
671 if (proto == PPP_IP && (cp->flags & COMP_VJC)) {
674 type = vj_compress_tcp(ip, len - PPP_HDRLEN, &cp->vj_comp,
675 (cp->flags & COMP_VJCCID), &vjhdr);
697 else if (proto != PPP_LCP && (cp->flags & CCP_COMP_RUN)
698 && cp->xstate != NULL) {
700 (*cp->xcomp->compress)(cp->xstate, &cmp, mp, len,
701 (cp->flags & CCP_ISUP? cp->mtu + PPP_HDRLEN: 0));
714 if ((cp->flags & COMP_AC)
717 if (proto < 0x100 && (cp->flags & COMP_PROT))
719 } else if (proto < 0x100 && (cp->flags & COMP_PROT)) {
726 cp->stats.ppp_opackets++;
727 cp->stats.ppp_obytes += msgdsize(mp);
739 comp_state_t *cp;
743 cp = (comp_state_t *) q->q_ptr;
744 if (cp == 0) {
745 DPRINT("cp == 0 in ppp_comp_rput\n");
767 psp->vj = cp->vj_comp.stats;
776 ++cp->stats.ppp_ierrors;
779 ++cp->stats.ppp_oerrors;
799 comp_state_t *cp;
803 cp = (comp_state_t *) q->q_ptr;
804 if (cp == 0) {
805 DPRINT("cp == 0 in ppp_comp_rsrv\n");
817 cp->stats.ppp_ibytes += len;
818 cp->stats.ppp_ipackets++;
839 if (hlen < ((cp->flags & DECOMP_AC)? 0: 2)
840 + ((cp->flags & DECOMP_PROT)? 1: 2)) {
890 if ((cp->flags & CCP_ISUP)
891 && (cp->flags & CCP_DECOMP_RUN) && cp->rstate
892 && (cp->flags & CCP_ERR) == 0) {
893 rv = (*cp->rcomp->decompress)(cp->rstate, mp, &dmp);
904 cp->flags |= CCP_ERROR;
905 ++cp->stats.ppp_ierrors;
909 cp->flags |= CCP_FATALERROR;
910 ++cp->stats.ppp_ierrors;
915 } else if (cp->rstate && (cp->flags & CCP_DECOMP_RUN)) {
916 (*cp->rcomp->incomp)(cp->rstate, mp);
925 if ((cp->flags & DECOMP_VJC) == 0 || len <= 0)
958 if (cp->stats.ppp_ierrors != cp->vj_last_ierrors) {
959 if (cp->flags & DBGLOG)
960 DPRINT1("ppp%d: resetting VJ\n", cp->unit);
961 vj_uncompress_err(&cp->vj_comp);
962 cp->vj_last_ierrors = cp->stats.ppp_ierrors;
966 &cp->vj_comp, &iphdr, &iphlen);
968 if (cp->flags & DBGLOG)
970 cp->unit, len);
971 ++cp->vj_last_ierrors; /* so we don't reset next time */
1014 cp->vj_last_ierrors = cp->stats.ppp_ierrors;
1015 if (!vj_uncompress_uncomp(dp, hlen, &cp->vj_comp)) {
1016 if (cp->flags & DBGLOG)
1018 cp->unit, len);
1019 ++cp->vj_last_ierrors; /* don't need to reset next time */
1032 cp->stats.ppp_ierrors++;
1050 comp_state_t *cp;
1057 cp = (comp_state_t *) q->q_ptr;
1068 cp->flags &= ~CCP_ISUP;
1072 if ((cp->flags & (CCP_ISOPEN | CCP_ISUP)) == CCP_ISOPEN
1076 if (cp->xstate != NULL
1077 && (*cp->xcomp->comp_init)
1078 (cp->xstate, dp + CCP_HDRLEN, clen - CCP_HDRLEN,
1079 cp->unit, 0, ((cp->flags & DBGLOG) != 0)))
1080 cp->flags |= CCP_COMP_RUN;
1082 if (cp->rstate != NULL
1083 && (*cp->rcomp->decomp_init)
1084 (cp->rstate, dp + CCP_HDRLEN, clen - CCP_HDRLEN,
1085 cp->unit, 0, cp->mru, ((cp->flags & DBGLOG) != 0)))
1086 cp->flags = (cp->flags & ~CCP_ERR) | CCP_DECOMP_RUN;
1092 if (cp->flags & CCP_ISUP) {
1094 if (cp->xstate && (cp->flags & CCP_COMP_RUN))
1095 (*cp->xcomp->comp_reset)(cp->xstate);
1097 if (cp->rstate && (cp->flags & CCP_DECOMP_RUN)) {
1098 (*cp->rcomp->decomp_reset)(cp->rstate);
1099 cp->flags &= ~CCP_ERROR;