• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/isdn/i4l/

Lines Matching refs:is

34 static int isdn_ppp_set_compressor(struct ippp_struct *is,struct isdn_ppp_comp_data *);
40 struct ippp_struct *is,struct ippp_struct *master,int type);
45 static void isdn_ppp_ccp_kickup(struct ippp_struct *is);
46 static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
49 static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is);
50 static void isdn_ppp_ccp_reset_free(struct ippp_struct *is);
51 static void isdn_ppp_ccp_reset_free_state(struct ippp_struct *is,
54 static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_struct *is,
56 static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
58 static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
110 struct ippp_struct *is;
134 is = ippp_table[lp->ppp_slot];
135 if ((is->state & IPPP_CONNECT))
137 else if (is->state & IPPP_ASSIGNED)
138 is->state = IPPP_OPEN; /* fallback to 'OPEN but not ASSIGNED' state */
140 if (is->debug & 0x1)
141 printk(KERN_DEBUG "isdn_ppp_free %d %lx %lx\n", lp->ppp_slot, (long) lp, (long) is->lp);
143 is->lp = NULL; /* link is down .. set lp to NULL */
144 lp->ppp_slot = -1; /* is this OK ?? */
152 * This function is allways called with holding dev->lock so
153 * no additional lock is needed
160 struct ippp_struct *is;
204 is = ippp_table[i];
205 is->lp = lp;
206 is->unit = unit;
207 is->state = IPPP_OPEN | IPPP_ASSIGNED; /* assigned to a netdevice but not connected */
245 struct ippp_struct *is;
252 is = ippp_table[slot];
253 if (is->state)
254 wake_up_interruptible(&is->wq);
255 is->state = IPPP_CLOSEWAIT;
282 struct ippp_struct *is;
291 is = file->private_data = ippp_table[slot];
294 slot, min, is->state);
297 is->link_compressor = is->compressor = NULL;
298 is->link_decompressor = is->decompressor = NULL;
299 is->link_comp_stat = is->comp_stat = NULL;
300 is->link_decomp_stat = is->decomp_stat = NULL;
301 is->compflags = 0;
303 is->reset = isdn_ppp_ccp_reset_alloc(is);
305 is->lp = NULL;
306 is->mp_seqno = 0; /* MP sequence number */
307 is->pppcfg = 0; /* ppp configuration */
308 is->mpppcfg = 0; /* mppp configuration */
309 is->last_link_seqno = -1; /* MP: maybe set to Bundle-MIN, when joining a bundle ?? */
310 is->unit = -1; /* set, when we have our interface */
311 is->mru = 1524; /* MRU, default 1524 */
312 is->maxcid = 16; /* VJ: maxcid */
313 is->tk = current;
314 init_waitqueue_head(&is->wq);
315 is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */
316 is->last = is->rq;
317 is->minor = min;
322 is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */
325 is->pass_filter = NULL;
326 is->active_filter = NULL;
328 is->state = IPPP_OPEN;
340 struct ippp_struct *is;
344 is = file->private_data;
346 if (!is) {
350 if (is->debug & 0x1)
351 printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", min, (long) is->lp);
353 if (is->lp) { /* a lp address says: this link is still up */
354 isdn_net_dev *p = is->lp->netdev;
360 is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */
363 * isdn_ppp_free() sets is->lp to NULL and lp->ppp_slot to -1
369 kfree(is->rq[i].buf);
370 is->rq[i].buf = NULL;
372 is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */
373 is->last = is->rq;
377 slhc_free(is->slcomp);
378 is->slcomp = NULL;
381 kfree(is->pass_filter);
382 is->pass_filter = NULL;
383 kfree(is->active_filter);
384 is->active_filter = NULL;
388 if(is->comp_stat)
389 is->compressor->free(is->comp_stat);
390 if(is->link_comp_stat)
391 is->link_compressor->free(is->link_comp_stat);
392 if(is->link_decomp_stat)
393 is->link_decompressor->free(is->link_decomp_stat);
394 if(is->decomp_stat)
395 is->decompressor->free(is->decomp_stat);
396 is->compressor = is->link_compressor = NULL;
397 is->decompressor = is->link_decompressor = NULL;
398 is->comp_stat = is->link_comp_stat = NULL;
399 is->decomp_stat = is->link_decomp_stat = NULL;
402 if(is->reset)
403 isdn_ppp_ccp_reset_free(is);
405 /* this slot is ready for new connections */
406 is->state = 0;
450 /* uprog.len is unsigned short, so no overflow here */
475 struct ippp_struct *is;
480 is = file->private_data;
481 lp = is->lp;
483 if (is->debug & 0x1)
484 printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x state: %x\n", min, cmd, is->state);
486 if (!(is->state & IPPP_OPEN))
492 if (!(is->state & IPPP_CONNECT))
497 (int) min, (int) is->unit, (int) val);
498 return isdn_ppp_bundle(is, val);
504 if ((r = set_arg(argp, &is->unit, sizeof(is->unit) )))
515 if ((r = set_arg(argp, &is->mpppcfg, sizeof(is->mpppcfg) )))
521 is->mpppcfg = val;
524 if ((r = set_arg(argp, &is->pppcfg,sizeof(is->pppcfg) )))
531 if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) {
534 is->pppcfg = val; /* isdn_ppp_xmit test for SC_ENABLE_IP !!! */
539 is->pppcfg = val;
552 is->mru = val;
562 if (is->maxcid != val) {
566 if (is->debug & 0x1)
568 is->maxcid = val;
575 if (is->slcomp)
576 slhc_free(is->slcomp);
577 is->slcomp = sltmp;
582 if ((r = set_arg(argp, &is->debug, sizeof(is->debug) )))
588 is->debug = val;
608 return isdn_ppp_set_compressor(is, &data);
636 kfree(is->pass_filter);
637 is->pass_filter = code;
638 is->pass_len = len;
647 kfree(is->active_filter);
648 is->active_filter = code;
649 is->active_len = len;
665 struct ippp_struct *is;
667 is = file->private_data;
669 if (is->debug & 0x2)
674 poll_wait(file, &is->wq, wait);
676 if (!(is->state & IPPP_OPEN)) {
677 if(is->state == IPPP_CLOSEWAIT)
685 spin_lock_irqsave(&is->buflock, flags);
686 bl = is->last;
687 bf = is->first;
689 * if IPPP_NOBLOCK is set we return even if we have nothing to read
691 if (bf->next != bl || (is->state & IPPP_NOBLOCK)) {
692 is->state &= ~IPPP_NOBLOCK;
695 spin_unlock_irqrestore(&is->buflock, flags);
709 struct ippp_struct *is;
715 is = ippp_table[slot];
717 if (!(is->state & IPPP_CONNECT)) {
732 spin_lock_irqsave(&is->buflock, flags);
733 bf = is->first;
734 bl = is->last;
737 printk(KERN_WARNING "ippp: Queue is full; discarding first buffer\n");
740 is->first = bf;
745 is->last = bl->next;
746 spin_unlock_irqrestore(&is->buflock, flags);
747 wake_up_interruptible(&is->wq);
753 * reports, that there is data
759 struct ippp_struct *is;
764 is = file->private_data;
766 if (!(is->state & IPPP_OPEN))
772 spin_lock_irqsave(&is->buflock, flags);
773 b = is->first->next;
776 spin_unlock_irqrestore(&is->buflock, flags);
782 is->first = b;
784 spin_unlock_irqrestore(&is->buflock, flags);
800 struct ippp_struct *is;
804 is = file->private_data;
806 if (!(is->state & IPPP_CONNECT))
809 lp = is->lp;
851 if (is->debug & 0x40) {
853 isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
919 static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
934 if (is->pppcfg & SC_REJ_COMP_AC)
953 // protocol field is compressed
971 struct ippp_struct *is;
984 is = ippp_table[slot];
986 if (is->debug & 0x4) {
987 printk(KERN_DEBUG "ippp_receive: is:%08lx lp:%08lx slot:%d unit:%d len:%d\n",
988 (long)is,(long)lp,lp->ppp_slot,is->unit,(int) skb->len);
989 isdn_ppp_frame_log("receive", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
992 if (isdn_ppp_skip_ac(is, skb) < 0) {
1003 if (is->compflags & SC_LINK_DECOMP_ON) {
1004 skb = isdn_ppp_decompress(skb, is, NULL, &proto);
1009 if (!(is->mpppcfg & SC_REJ_MP_PROT)) { // we agreed to receive MPPP
1028 struct ippp_struct *is, *mis;
1038 is = ippp_table[slot];
1051 if (is->debug & 0x10) {
1053 isdn_ppp_frame_log("rpush", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
1056 skb = isdn_ppp_decompress(skb, is, mis, &proto);
1062 if (is->debug & 0x20)
1067 if (is->debug & 0x20)
1077 if (is->debug & 0x20)
1091 if (is->debug & 0x20)
1126 longer - the job is done already */
1140 * a four-byte PPP header on each packet (which is still present) */
1149 if (is->pass_filter
1150 && sk_run_filter(skb, is->pass_filter, is->pass_len) == 0) {
1151 if (is->debug & 0x2)
1156 if (!(is->active_filter
1157 && sk_run_filter(skb, is->active_filter,
1158 is->active_len) == 0)) {
1159 if (is->debug & 0x2)
1275 * after this line .. requeueing in the device queue is no longer allowed!!!
1376 compression is negotiated, that means, CCP is up */
1380 printk(KERN_DEBUG "isdn_ppp: CCP not yet up - sending as-is\n");
1463 struct ippp_struct *is = ippp_table[lp->ppp_slot];
1494 drop |= is->pass_filter
1495 && sk_run_filter(skb, is->pass_filter, is->pass_len) == 0;
1496 drop |= is->active_filter
1497 && sk_run_filter(skb, is->active_filter, is->active_len) == 0;
1505 /* this is _not_ rfc1990 header, but something we convert both short and long
1507 * byte 0 is flags as in rfc1990
1508 * bytes 1...4 is 24-bit seqence number converted to host byte order
1550 struct ippp_struct * is;
1558 is = ippp_table[lp->ppp_slot];
1564 is->mp_seqno = 0;
1574 is->last_link_seqno = 0;
1590 struct ippp_struct *is;
1611 is = ippp_table[slot];
1615 if (is->debug & 0x8)
1618 newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ,
1619 skb, is->last_link_seqno);
1622 /* if this packet seq # is less than last already processed one,
1637 is->last_link_seqno = minseq = newseq;
1656 /* if this new fragment is before the first one, then enqueue it now. */
1673 * indicates there is a contiguous sequence present)
1676 * is an incomplete sequence below minseq, no new fragments would
1680 * - new fragment is inserted in the proper sequence ('newfrag' is
1682 * - we hit a gap in the sequence, so no reassembly/processing is
1685 * algorithm for this code is derived from code in the book
1731 /* if start is non-null and we have end fragment, then
1747 * reassembled the packet and sequence is contiguous
1749 * if sequence is contiguous, but we haven't reassembled yet,
1751 * if sequence is not contiguous, either clear everyting
1757 /* if we just reassembled and the next one is here,
1934 isdn_ppp_bundle(struct ippp_struct *is, int unit)
1951 nlp = is->lp;
2155 static void isdn_ppp_ccp_kickup(struct ippp_struct *is)
2157 isdn_ppp_fill_rq(NULL, 0, PPP_COMP, is->lp->ppp_slot);
2160 /* In-kernel handling of CCP Reset-Request and Reset-Ack is necessary,
2161 but absolutely nontrivial. The most abstruse problem we are facing is
2164 to the (de)compressor, but indeed is not covered by the current API to
2165 the (de)compressor. The API is a prototype version from PPP where only
2167 rather simple in their reset handling. Especially, their is only one
2172 the framework and the (de)compressor. Bad enough, LZS is different
2178 kernel because it is not just the same simple one as in (i)pppd but
2190 /* Send a CCP Reset-Request or Reset-Ack directly from the kernel. This is
2191 getting that lengthy because there is no simple "send-this-frame-out"
2195 static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
2203 isdn_net_local *lp = is->lp;
2216 if(!(is->pppcfg & SC_COMP_AC)) {
2238 /* skb is now ready for xmit */
2240 isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
2246 static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is)
2256 is->reset = r;
2261 static void isdn_ppp_ccp_reset_free(struct ippp_struct *is)
2266 is->reset);
2268 if(is->reset->rs[id]) {
2269 isdn_ppp_ccp_reset_free_state(is, (unsigned char)id);
2272 kfree(is->reset);
2273 is->reset = NULL;
2277 static void isdn_ppp_ccp_reset_free_state(struct ippp_struct *is,
2282 if(is->reset->rs[id]) {
2284 rs = is->reset->rs[id];
2288 is->reset->rs[id] = NULL;
2291 printk(KERN_WARNING "ippp_ccp: id %d is not allocated\n", id);
2295 /* The timer callback function which is called when a ResetReq has timed out,
2309 /* Hmm, there is no Ack really expected. We can clean
2313 isdn_ppp_ccp_reset_free_state(rs->is, rs->id);
2319 isdn_ppp_ccp_xmit_reset(rs->is, PPP_CCP, CCP_RESETREQ, rs->id,
2331 static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_struct *is,
2335 if(is->reset->rs[id]) {
2344 rs->is = is;
2349 is->reset->rs[id] = rs;
2355 /* A decompressor wants a reset with a set of parameters - do what is
2357 static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
2371 if(is->reset->rs[rp->id]) {
2372 /* There is already a transaction in existence
2375 rs = is->reset->rs[rp->id];
2386 /* Ok, this is a new transaction */
2389 rs = isdn_ppp_ccp_reset_alloc_state(is, rp->id);
2402 isdn_ppp_ccp_xmit_reset(is, PPP_CCP,
2416 and increase ids only when an Ack is received for a
2418 if(is->reset->rs[is->reset->lastid]) {
2419 /* There is already a transaction in existence
2422 rs = is->reset->rs[is->reset->lastid];
2434 " %d to be started\n", is->reset->lastid);
2435 rs = isdn_ppp_ccp_reset_alloc_state(is,
2436 is->reset->lastid);
2448 isdn_ppp_ccp_xmit_reset(is, PPP_CCP, CCP_RESETREQ,
2460 static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
2463 struct ippp_ccp_reset_state *rs = is->reset->rs[id];
2479 isdn_ppp_ccp_reset_free_state(is, id);
2485 is->reset->lastid++;
2493 * proto is updated to protocol field of uncompressed packet.
2500 static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struct *is,struct ippp_struct *master,
2513 stat = is->link_decomp_stat;
2514 ipc = is->link_decompressor;
2515 ri = is;
2537 skb_out = dev_alloc_skb(is->mru + PPP_HDRLEN);
2584 struct ippp_struct *is,struct ippp_struct *master,int type)
2602 compressor = is->compressor;
2603 stat = is->comp_stat;
2646 struct ippp_struct *is;
2659 is = ippp_table[lp->ppp_slot];
2660 isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
2671 mis = is;
2675 if(is->debug & 0x10)
2680 is->compflags &= ~SC_LINK_COMP_ON;
2684 if(is->debug & 0x10)
2689 is->compflags &= ~(SC_LINK_DECOMP_ON|SC_LINK_COMP_ON);
2693 if(is->debug & 0x10)
2700 if (!is->decompressor)
2702 is->compflags |= SC_LINK_DECOMP_ON;
2722 /* TODO: This is not easy to decide here */
2726 isdn_ppp_ccp_reset_ack_rcvd(is, skb->data[1]);
2727 if(is->link_decompressor && is->link_decomp_stat)
2728 is->link_decompressor->
2729 reset(is->link_decomp_stat,
2735 is->compflags &= ~SC_LINK_DECOMP_DISCARD;
2759 if(is->link_compressor && is->link_comp_stat)
2760 is->link_compressor->
2761 reset(is->link_comp_stat,
2772 isdn_ppp_ccp_xmit_reset(is, proto, CCP_RESETACK,
2784 isdn_ppp_ccp_xmit_reset(is, proto, CCP_RESETACK,
2800 /* I believe the CCP handling as-is is done wrong. Compressed frames
2813 * - accept compressed frames as soon as decompression is negotiated
2822 struct ippp_struct *mis,*is;
2833 is = ippp_table[slot];
2836 if(!(is->pppcfg & SC_COMP_AC) && data[0] == 0xff && data[1] == 0x03) {
2847 isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
2858 mis = is;
2859 if (mis != is)
2864 if(is->debug & 0x10)
2867 is->compflags &= ~SC_DECOMP_ON;
2869 is->compflags &= ~SC_LINK_DECOMP_ON;
2873 if(is->debug & 0x10)
2876 is->compflags &= ~(SC_DECOMP_ON|SC_COMP_ON);
2878 is->compflags &= ~(SC_LINK_DECOMP_ON|SC_LINK_COMP_ON);
2882 if(is->debug & 0x10)
2885 if (!is->compressor)
2887 is->compflags |= SC_COMP_ON;
2889 if (!is->compressor)
2891 is->compflags |= SC_LINK_COMP_ON;
2896 if(is->debug & 0x10)
2901 if(is->compressor && is->comp_stat)
2902 is->compressor->reset(is->comp_stat, 0, 0,
2904 is->compflags &= ~SC_COMP_DISCARD;
2907 if(is->link_compressor && is->link_comp_stat)
2908 is->link_compressor->reset(is->link_comp_stat,
2910 is->compflags &= ~SC_LINK_COMP_DISCARD;
2943 static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_data *data)
2950 if(is->debug & 0x10)
2951 printk(KERN_DEBUG "[%d] Set %s type %d\n",is->unit,
2954 /* If is has no valid reset state vector, we cannot allocate a
2958 if(!(data->flags & IPPP_COMP_FLAG_XMIT) && !is->reset) {
2968 ret = ipc->init(stat,data,is->unit,0);
2983 if(is->link_comp_stat)
2984 is->link_compressor->free(is->link_comp_stat);
2985 is->link_comp_stat = stat;
2986 is->link_compressor = ipc;
2989 if(is->comp_stat)
2990 is->compressor->free(is->comp_stat);
2991 is->comp_stat = stat;
2992 is->compressor = ipc;
2997 if(is->link_decomp_stat)
2998 is->link_decompressor->free(is->link_decomp_stat);
2999 is->link_decomp_stat = stat;
3000 is->link_decompressor = ipc;
3003 if(is->decomp_stat)
3004 is->decompressor->free(is->decomp_stat);
3005 is->decomp_stat = stat;
3006 is->decompressor = ipc;