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

Lines Matching defs:bcs

501 int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len)
505 switch (bcs->proto2) {
507 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len);
512 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len);
520 * append byte c to current skb of B channel structure *bcs, updating fcs
522 static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
524 bcs->fcs = crc_ccitt_byte(bcs->fcs, c);
525 if (unlikely(bcs->skb == NULL)) {
529 if (unlikely(bcs->skb->len == SBUFSIZE)) {
530 dev_warn(bcs->cs->dev, "received oversized packet discarded\n");
531 bcs->hw.bas->giants++;
532 dev_kfree_skb_any(bcs->skb);
533 bcs->skb = NULL;
536 *__skb_put(bcs->skb, 1) = c;
542 static inline void hdlc_flush(struct bc_state *bcs)
545 if (likely(bcs->skb != NULL))
546 skb_trim(bcs->skb, 0);
547 else if (!bcs->ignore) {
548 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
549 skb_reserve(bcs->skb, HW_HDR_LEN);
551 dev_err(bcs->cs->dev, "could not allocate skb\n");
555 bcs->fcs = PPP_INITFCS;
561 static inline void hdlc_done(struct bc_state *bcs)
565 if (unlikely(bcs->ignore)) {
566 bcs->ignore--;
567 hdlc_flush(bcs);
571 if ((procskb = bcs->skb) == NULL) {
574 gigaset_rcv_error(NULL, bcs->cs, bcs);
576 dev_notice(bcs->cs->dev, "received short frame (%d octets)\n",
578 bcs->hw.bas->runts++;
579 gigaset_rcv_error(procskb, bcs->cs, bcs);
580 } else if (bcs->fcs != PPP_GOODFCS) {
581 dev_notice(bcs->cs->dev, "frame check error (0x%04x)\n",
582 bcs->fcs);
583 bcs->hw.bas->fcserrs++;
584 gigaset_rcv_error(procskb, bcs->cs, bcs);
592 bcs->hw.bas->goodbytes += procskb->len;
593 gigaset_rcv_skb(procskb, bcs->cs, bcs);
596 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
597 skb_reserve(bcs->skb, HW_HDR_LEN);
599 dev_err(bcs->cs->dev, "could not allocate skb\n");
600 bcs->fcs = PPP_INITFCS;
606 static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
608 if (unlikely(bcs->ignore)) {
609 bcs->ignore--;
610 hdlc_flush(bcs);
614 dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits);
615 bcs->hw.bas->alignerrs++;
616 gigaset_rcv_error(bcs->skb, bcs->cs, bcs);
618 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
619 skb_reserve(bcs->skb, HW_HDR_LEN);
621 dev_err(bcs->cs->dev, "could not allocate skb\n");
622 bcs->fcs = PPP_INITFCS;
660 * bcs receiving B channel structure
663 struct bc_state *bcs)
665 struct bas_bc_state *ubc = bcs->hw.bas;
677 inputstate = bcs->inputstate;
721 hdlc_putbyte(inbyte & 0xff, bcs);
732 hdlc_flush(bcs);
737 hdlc_frag(bcs, inbits + lead1 - 7);
743 hdlc_done(bcs);
779 hdlc_frag(bcs, inbits);
783 hdlc_done(bcs);
788 hdlc_flush(bcs);
830 hdlc_putbyte(inbyte & 0xff, bcs);
840 bcs->inputstate = inputstate;
853 * bcs receiving B channel structure
856 struct bc_state *bcs)
862 if (unlikely(bcs->ignore)) {
863 bcs->ignore--;
864 hdlc_flush(bcs);
867 if (unlikely((skb = bcs->skb) == NULL)) {
868 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
870 dev_err(bcs->cs->dev, "could not allocate skb\n");
875 bcs->hw.bas->goodbytes += skb->len;
885 gigaset_rcv_skb(skb, bcs->cs, bcs);
886 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
888 dev_err(bcs->cs->dev,
892 skb_reserve(bcs->skb, HW_HDR_LEN);
898 void gigaset_isoc_receive(unsigned char *src, unsigned count, struct bc_state *bcs)
900 switch (bcs->proto2) {
902 hdlc_unpack(src, count, bcs);
905 trans_receive(src, count, bcs);
991 int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb)
996 spin_lock_irqsave(&bcs->cs->lock, flags);
997 if (!bcs->cs->connected) {
998 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1002 skb_queue_tail(&bcs->squeue, skb);
1004 __func__, skb_queue_len(&bcs->squeue));
1007 tasklet_schedule(&bcs->hw.bas->sent_tasklet);
1008 spin_unlock_irqrestore(&bcs->cs->lock, flags);