Lines Matching refs:bcs

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