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

Lines Matching refs:is

33 static int isdn_ppp_set_compressor(struct ippp_struct *is,struct isdn_ppp_comp_data *);
39 struct ippp_struct *is,struct ippp_struct *master,int type);
44 static void isdn_ppp_ccp_kickup(struct ippp_struct *is);
45 static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
48 static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is);
49 static void isdn_ppp_ccp_reset_free(struct ippp_struct *is);
50 static void isdn_ppp_ccp_reset_free_state(struct ippp_struct *is,
53 static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_struct *is,
55 static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
57 static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
109 struct ippp_struct *is;
133 is = ippp_table[lp->ppp_slot];
134 if ((is->state & IPPP_CONNECT))
136 else if (is->state & IPPP_ASSIGNED)
137 is->state = IPPP_OPEN; /* fallback to 'OPEN but not ASSIGNED' state */
139 if (is->debug & 0x1)
140 printk(KERN_DEBUG "isdn_ppp_free %d %lx %lx\n", lp->ppp_slot, (long) lp, (long) is->lp);
142 is->lp = NULL; /* link is down .. set lp to NULL */
143 lp->ppp_slot = -1; /* is this OK ?? */
151 * This function is allways called with holding dev->lock so
152 * no additional lock is needed
159 struct ippp_struct *is;
201 is = ippp_table[i];
202 is->lp = lp;
203 is->unit = unit;
204 is->state = IPPP_OPEN | IPPP_ASSIGNED; /* assigned to a netdevice but not connected */
242 struct ippp_struct *is;
249 is = ippp_table[slot];
250 if (is->state)
251 wake_up_interruptible(&is->wq);
252 is->state = IPPP_CLOSEWAIT;
279 struct ippp_struct *is;
288 is = file->private_data = ippp_table[slot];
291 slot, min, is->state);
294 is->link_compressor = is->compressor = NULL;
295 is->link_decompressor = is->decompressor = NULL;
296 is->link_comp_stat = is->comp_stat = NULL;
297 is->link_decomp_stat = is->decomp_stat = NULL;
298 is->compflags = 0;
300 is->reset = isdn_ppp_ccp_reset_alloc(is);
302 is->lp = NULL;
303 is->mp_seqno = 0; /* MP sequence number */
304 is->pppcfg = 0; /* ppp configuration */
305 is->mpppcfg = 0; /* mppp configuration */
306 is->last_link_seqno = -1; /* MP: maybe set to Bundle-MIN, when joining a bundle ?? */
307 is->unit = -1; /* set, when we have our interface */
308 is->mru = 1524; /* MRU, default 1524 */
309 is->maxcid = 16; /* VJ: maxcid */
310 is->tk = current;
311 init_waitqueue_head(&is->wq);
312 is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */
313 is->last = is->rq;
314 is->minor = min;
319 is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */
322 is->pass_filter = NULL;
323 is->active_filter = NULL;
325 is->state = IPPP_OPEN;
337 struct ippp_struct *is;
341 is = file->private_data;
343 if (!is) {
347 if (is->debug & 0x1)
348 printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", min, (long) is->lp);
350 if (is->lp) { /* a lp address says: this link is still up */
351 isdn_net_dev *p = is->lp->netdev;
357 is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */
360 * isdn_ppp_free() sets is->lp to NULL and lp->ppp_slot to -1
366 kfree(is->rq[i].buf);
367 is->rq[i].buf = NULL;
369 is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */
370 is->last = is->rq;
374 slhc_free(is->slcomp);
375 is->slcomp = NULL;
378 kfree(is->pass_filter);
379 is->pass_filter = NULL;
380 kfree(is->active_filter);
381 is->active_filter = NULL;
385 if(is->comp_stat)
386 is->compressor->free(is->comp_stat);
387 if(is->link_comp_stat)
388 is->link_compressor->free(is->link_comp_stat);
389 if(is->link_decomp_stat)
390 is->link_decompressor->free(is->link_decomp_stat);
391 if(is->decomp_stat)
392 is->decompressor->free(is->decomp_stat);
393 is->compressor = is->link_compressor = NULL;
394 is->decompressor = is->link_decompressor = NULL;
395 is->comp_stat = is->link_comp_stat = NULL;
396 is->decomp_stat = is->link_decomp_stat = NULL;
399 if(is->reset)
400 isdn_ppp_ccp_reset_free(is);
402 /* this slot is ready for new connections */
403 is->state = 0;
446 /* uprog.len is unsigned short, so no overflow here */
475 struct ippp_struct *is;
480 is = (struct ippp_struct *) 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) )))
514 if ((r = set_arg(argp, &is->mpppcfg, sizeof(is->mpppcfg) )))
520 is->mpppcfg = val;
523 if ((r = set_arg(argp, &is->pppcfg,sizeof(is->pppcfg) )))
530 if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) {
533 is->pppcfg = val; /* isdn_ppp_xmit test for SC_ENABLE_IP !!! */
538 is->pppcfg = val;
551 is->mru = val;
561 if (is->maxcid != val) {
565 if (is->debug & 0x1)
567 is->maxcid = val;
574 if (is->slcomp)
575 slhc_free(is->slcomp);
576 is->slcomp = sltmp;
581 if ((r = set_arg(argp, &is->debug, sizeof(is->debug) )))
587 is->debug = val;
607 return isdn_ppp_set_compressor(is, &data);
635 kfree(is->pass_filter);
636 is->pass_filter = code;
637 is->pass_len = len;
646 kfree(is->active_filter);
647 is->active_filter = code;
648 is->active_len = len;
664 struct ippp_struct *is;
666 is = file->private_data;
668 if (is->debug & 0x2)
673 poll_wait(file, &is->wq, wait);
675 if (!(is->state & IPPP_OPEN)) {
676 if(is->state == IPPP_CLOSEWAIT)
684 spin_lock_irqsave(&is->buflock, flags);
685 bl = is->last;
686 bf = is->first;
688 * if IPPP_NOBLOCK is set we return even if we have nothing to read
690 if (bf->next != bl || (is->state & IPPP_NOBLOCK)) {
691 is->state &= ~IPPP_NOBLOCK;
694 spin_unlock_irqrestore(&is->buflock, flags);
708 struct ippp_struct *is;
714 is = ippp_table[slot];
716 if (!(is->state & IPPP_CONNECT)) {
731 spin_lock_irqsave(&is->buflock, flags);
732 bf = is->first;
733 bl = is->last;
736 printk(KERN_WARNING "ippp: Queue is full; discarding first buffer\n");
739 is->first = bf;
744 is->last = bl->next;
745 spin_unlock_irqrestore(&is->buflock, flags);
746 wake_up_interruptible(&is->wq);
752 * reports, that there is data
758 struct ippp_struct *is;
763 is = file->private_data;
765 if (!(is->state & IPPP_OPEN))
771 spin_lock_irqsave(&is->buflock, flags);
772 b = is->first->next;
775 spin_unlock_irqrestore(&is->buflock, flags);
781 is->first = b;
783 spin_unlock_irqrestore(&is->buflock, flags);
799 struct ippp_struct *is;
803 is = file->private_data;
805 if (!(is->state & IPPP_CONNECT))
808 lp = is->lp;
850 if (is->debug & 0x40) {
852 isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
918 static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
933 if (is->pppcfg & SC_REJ_COMP_AC)
952 // protocol field is compressed
970 struct ippp_struct *is;
983 is = ippp_table[slot];
985 if (is->debug & 0x4) {
986 printk(KERN_DEBUG "ippp_receive: is:%08lx lp:%08lx slot:%d unit:%d len:%d\n",
987 (long)is,(long)lp,lp->ppp_slot,is->unit,(int) skb->len);
988 isdn_ppp_frame_log("receive", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
991 if (isdn_ppp_skip_ac(is, skb) < 0) {
1002 if (is->compflags & SC_LINK_DECOMP_ON) {
1003 skb = isdn_ppp_decompress(skb, is, NULL, &proto);
1008 if (!(is->mpppcfg & SC_REJ_MP_PROT)) { // we agreed to receive MPPP
1027 struct ippp_struct *is, *mis;
1037 is = ippp_table[slot];
1050 if (is->debug & 0x10) {
1052 isdn_ppp_frame_log("rpush", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
1055 skb = isdn_ppp_decompress(skb, is, mis, &proto);
1061 if (is->debug & 0x20)
1066 if (is->debug & 0x20)
1076 if (is->debug & 0x20)
1090 if (is->debug & 0x20)
1125 longer - the job is done already */
1139 * a four-byte PPP header on each packet (which is still present) */
1148 if (is->pass_filter
1149 && sk_run_filter(skb, is->pass_filter, is->pass_len) == 0) {
1150 if (is->debug & 0x2)
1155 if (!(is->active_filter
1156 && sk_run_filter(skb, is->active_filter,
1157 is->active_len) == 0)) {
1158 if (is->debug & 0x2)
1274 * after this line .. requeueing in the device queue is no longer allowed!!!
1375 compression is negotiated, that means, CCP is up */
1379 printk(KERN_DEBUG "isdn_ppp: CCP not yet up - sending as-is\n");
1462 struct ippp_struct *is = ippp_table[lp->ppp_slot];
1493 drop |= is->pass_filter
1494 && sk_run_filter(skb, is->pass_filter, is->pass_len) == 0;
1495 drop |= is->active_filter
1496 && sk_run_filter(skb, is->active_filter, is->active_len) == 0;
1504 /* this is _not_ rfc1990 header, but something we convert both short and long
1506 * byte 0 is flags as in rfc1990
1507 * bytes 1...4 is 24-bit seqence number converted to host byte order
1549 struct ippp_struct * is;
1557 is = ippp_table[lp->ppp_slot];
1563 is->mp_seqno = 0;
1573 is->last_link_seqno = 0;
1589 struct ippp_struct *is;
1610 is = ippp_table[slot];
1614 if (is->debug & 0x8)
1617 newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ,
1618 skb, is->last_link_seqno);
1621 /* if this packet seq # is less than last already processed one,
1636 is->last_link_seqno = minseq = newseq;
1655 /* if this new fragment is before the first one, then enqueue it now. */
1672 * indicates there is a continguous sequence present)
1675 * is an incomplete sequence below minseq, no new fragments would
1679 * - new fragment is inserted in the proper sequence ('newfrag' is
1681 * - we hit a gap in the sequence, so no reassembly/processing is
1684 * algorithm for this code is derived from code in the book
1730 /* if start is non-null and we have end fragment, then
1746 * reassembled the packet and sequence is contiguous
1748 * if sequence is contiguous, but we haven't reassembled yet,
1750 * if sequence is not contiguous, either clear everyting
1756 /* if we just reassembled and the next one is here,
1933 isdn_ppp_bundle(struct ippp_struct *is, int unit)
1950 nlp = is->lp;
2154 static void isdn_ppp_ccp_kickup(struct ippp_struct *is)
2156 isdn_ppp_fill_rq(NULL, 0, PPP_COMP, is->lp->ppp_slot);
2159 /* In-kernel handling of CCP Reset-Request and Reset-Ack is necessary,
2160 but absolutely nontrivial. The most abstruse problem we are facing is
2163 to the (de)compressor, but indeed is not covered by the current API to
2164 the (de)compressor. The API is a prototype version from PPP where only
2166 rather simple in their reset handling. Especially, their is only one
2171 the framework and the (de)compressor. Bad enough, LZS is different
2177 kernel because it is not just the same simple one as in (i)pppd but
2189 /* Send a CCP Reset-Request or Reset-Ack directly from the kernel. This is
2190 getting that lengthy because there is no simple "send-this-frame-out"
2194 static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
2202 isdn_net_local *lp = is->lp;
2215 if(!(is->pppcfg & SC_COMP_AC)) {
2237 /* skb is now ready for xmit */
2239 isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
2245 static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is)
2255 is->reset = r;
2260 static void isdn_ppp_ccp_reset_free(struct ippp_struct *is)
2265 is->reset);
2267 if(is->reset->rs[id]) {
2268 isdn_ppp_ccp_reset_free_state(is, (unsigned char)id);
2271 kfree(is->reset);
2272 is->reset = NULL;
2276 static void isdn_ppp_ccp_reset_free_state(struct ippp_struct *is,
2281 if(is->reset->rs[id]) {
2283 rs = is->reset->rs[id];
2287 is->reset->rs[id] = NULL;
2290 printk(KERN_WARNING "ippp_ccp: id %d is not allocated\n", id);
2294 /* The timer callback function which is called when a ResetReq has timed out,
2308 /* Hmm, there is no Ack really expected. We can clean
2312 isdn_ppp_ccp_reset_free_state(rs->is, rs->id);
2318 isdn_ppp_ccp_xmit_reset(rs->is, PPP_CCP, CCP_RESETREQ, rs->id,
2330 static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_struct *is,
2334 if(is->reset->rs[id]) {
2343 rs->is = is;
2348 is->reset->rs[id] = rs;
2354 /* A decompressor wants a reset with a set of parameters - do what is
2356 static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
2370 if(is->reset->rs[rp->id]) {
2371 /* There is already a transaction in existence
2374 rs = is->reset->rs[rp->id];
2385 /* Ok, this is a new transaction */
2388 rs = isdn_ppp_ccp_reset_alloc_state(is, rp->id);
2401 isdn_ppp_ccp_xmit_reset(is, PPP_CCP,
2415 and increase ids only when an Ack is received for a
2417 if(is->reset->rs[is->reset->lastid]) {
2418 /* There is already a transaction in existence
2421 rs = is->reset->rs[is->reset->lastid];
2433 " %d to be started\n", is->reset->lastid);
2434 rs = isdn_ppp_ccp_reset_alloc_state(is,
2435 is->reset->lastid);
2447 isdn_ppp_ccp_xmit_reset(is, PPP_CCP, CCP_RESETREQ,
2459 static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
2462 struct ippp_ccp_reset_state *rs = is->reset->rs[id];
2478 isdn_ppp_ccp_reset_free_state(is, id);
2484 is->reset->lastid++;
2492 * proto is updated to protocol field of uncompressed packet.
2499 static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struct *is,struct ippp_struct *master,
2512 stat = is->link_decomp_stat;
2513 ipc = is->link_decompressor;
2514 ri = is;
2536 skb_out = dev_alloc_skb(is->mru + PPP_HDRLEN);
2583 struct ippp_struct *is,struct ippp_struct *master,int type)
2601 compressor = is->compressor;
2602 stat = is->comp_stat;
2645 struct ippp_struct *is;
2658 is = ippp_table[lp->ppp_slot];
2659 isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
2670 mis = is;
2674 if(is->debug & 0x10)
2679 is->compflags &= ~SC_LINK_COMP_ON;
2683 if(is->debug & 0x10)
2688 is->compflags &= ~(SC_LINK_DECOMP_ON|SC_LINK_COMP_ON);
2692 if(is->debug & 0x10)
2699 if (!is->decompressor)
2701 is->compflags |= SC_LINK_DECOMP_ON;
2721 /* TODO: This is not easy to decide here */
2725 isdn_ppp_ccp_reset_ack_rcvd(is, skb->data[1]);
2726 if(is->link_decompressor && is->link_decomp_stat)
2727 is->link_decompressor->
2728 reset(is->link_decomp_stat,
2734 is->compflags &= ~SC_LINK_DECOMP_DISCARD;
2758 if(is->link_compressor && is->link_comp_stat)
2759 is->link_compressor->
2760 reset(is->link_comp_stat,
2771 isdn_ppp_ccp_xmit_reset(is, proto, CCP_RESETACK,
2783 isdn_ppp_ccp_xmit_reset(is, proto, CCP_RESETACK,
2799 /* I believe the CCP handling as-is is done wrong. Compressed frames
2812 * - accept compressed frames as soon as decompression is negotiated
2821 struct ippp_struct *mis,*is;
2832 is = ippp_table[slot];
2835 if(!(is->pppcfg & SC_COMP_AC) && data[0] == 0xff && data[1] == 0x03) {
2846 isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
2857 mis = is;
2858 if (mis != is)
2863 if(is->debug & 0x10)
2866 is->compflags &= ~SC_DECOMP_ON;
2868 is->compflags &= ~SC_LINK_DECOMP_ON;
2872 if(is->debug & 0x10)
2875 is->compflags &= ~(SC_DECOMP_ON|SC_COMP_ON);
2877 is->compflags &= ~(SC_LINK_DECOMP_ON|SC_LINK_COMP_ON);
2881 if(is->debug & 0x10)
2884 if (!is->compressor)
2886 is->compflags |= SC_COMP_ON;
2888 if (!is->compressor)
2890 is->compflags |= SC_LINK_COMP_ON;
2895 if(is->debug & 0x10)
2900 if(is->compressor && is->comp_stat)
2901 is->compressor->reset(is->comp_stat, 0, 0,
2903 is->compflags &= ~SC_COMP_DISCARD;
2906 if(is->link_compressor && is->link_comp_stat)
2907 is->link_compressor->reset(is->link_comp_stat,
2909 is->compflags &= ~SC_LINK_COMP_DISCARD;
2942 static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_data *data)
2949 if(is->debug & 0x10)
2950 printk(KERN_DEBUG "[%d] Set %s type %d\n",is->unit,
2953 /* If is has no valid reset state vector, we cannot allocate a
2957 if(!(data->flags & IPPP_COMP_FLAG_XMIT) && !is->reset) {
2967 ret = ipc->init(stat,data,is->unit,0);
2982 if(is->link_comp_stat)
2983 is->link_compressor->free(is->link_comp_stat);
2984 is->link_comp_stat = stat;
2985 is->link_compressor = ipc;
2988 if(is->comp_stat)
2989 is->compressor->free(is->comp_stat);
2990 is->comp_stat = stat;
2991 is->compressor = ipc;
2996 if(is->link_decomp_stat)
2997 is->link_decompressor->free(is->link_decomp_stat);
2998 is->link_decomp_stat = stat;
2999 is->link_decompressor = ipc;
3002 if(is->decomp_stat)
3003 is->decompressor->free(is->decomp_stat);
3004 is->decomp_stat = stat;
3005 is->decompressor = ipc;