Lines Matching defs:bcs

480 int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len)
484 switch (bcs->proto2) {
486 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len);
491 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len);
499 * append byte c to current skb of B channel structure *bcs, updating fcs
501 static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
503 bcs->rx_fcs = crc_ccitt_byte(bcs->rx_fcs, c);
504 if (bcs->rx_skb == NULL)
507 if (bcs->rx_skb->len >= bcs->rx_bufsize) {
508 dev_warn(bcs->cs->dev, "received oversized packet discarded\n");
509 bcs->hw.bas->giants++;
510 dev_kfree_skb_any(bcs->rx_skb);
511 bcs->rx_skb = NULL;
514 *__skb_put(bcs->rx_skb, 1) = c;
520 static inline void hdlc_flush(struct bc_state *bcs)
523 if (bcs->rx_skb != NULL)
524 skb_trim(bcs->rx_skb, 0);
526 gigaset_new_rx_skb(bcs);
529 bcs->rx_fcs = PPP_INITFCS;
535 static inline void hdlc_done(struct bc_state *bcs)
537 struct cardstate *cs = bcs->cs;
541 if (unlikely(bcs->ignore)) {
542 bcs->ignore--;
543 hdlc_flush(bcs);
546 procskb = bcs->rx_skb;
550 gigaset_isdn_rcv_err(bcs);
554 bcs->hw.bas->runts++;
556 gigaset_isdn_rcv_err(bcs);
557 } else if (bcs->rx_fcs != PPP_GOODFCS) {
559 bcs->hw.bas->fcserrs++;
561 gigaset_isdn_rcv_err(bcs);
568 bcs->hw.bas->goodbytes += len;
569 gigaset_skb_rcvd(bcs, procskb);
571 gigaset_new_rx_skb(bcs);
572 bcs->rx_fcs = PPP_INITFCS;
578 static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
580 if (unlikely(bcs->ignore)) {
581 bcs->ignore--;
582 hdlc_flush(bcs);
586 dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits);
587 bcs->hw.bas->alignerrs++;
588 gigaset_isdn_rcv_err(bcs);
589 __skb_trim(bcs->rx_skb, 0);
590 bcs->rx_fcs = PPP_INITFCS;
628 * bcs receiving B channel structure
631 struct bc_state *bcs)
633 struct bas_bc_state *ubc = bcs->hw.bas;
648 inputstate = bcs->inputstate;
694 hdlc_putbyte(inbyte & 0xff, bcs);
705 hdlc_flush(bcs);
711 hdlc_frag(bcs, inbits + lead1 - 7);
717 hdlc_done(bcs);
756 hdlc_frag(bcs, inbits);
760 hdlc_done(bcs);
765 hdlc_flush(bcs);
811 hdlc_putbyte(inbyte & 0xff, bcs);
821 bcs->inputstate = inputstate;
834 * bcs receiving B channel structure
837 struct bc_state *bcs)
843 if (unlikely(bcs->ignore)) {
844 bcs->ignore--;
847 skb = bcs->rx_skb;
849 skb = gigaset_new_rx_skb(bcs);
853 dobytes = bcs->rx_bufsize - skb->len;
864 bcs->hw.bas->goodbytes += skb->len;
865 gigaset_skb_rcvd(bcs, skb);
866 skb = gigaset_new_rx_skb(bcs);
869 dobytes = bcs->rx_bufsize;
875 struct bc_state *bcs)
877 switch (bcs->proto2) {
879 hdlc_unpack(src, count, bcs);
882 trans_receive(src, count, bcs);
977 * @bcs: B channel descriptor structure.
989 int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb)
994 spin_lock_irqsave(&bcs->cs->lock, flags);
995 if (!bcs->cs->connected) {
996 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1000 skb_queue_tail(&bcs->squeue, skb);
1002 __func__, skb_queue_len(&bcs->squeue));
1005 tasklet_schedule(&bcs->hw.bas->sent_tasklet);
1006 spin_unlock_irqrestore(&bcs->cs->lock, flags);