Lines Matching refs:bch
39 struct bchannel *bch = container_of(ws, struct bchannel, workq); in bchannel_bh() local
43 if (test_and_clear_bit(FLG_RECVQUEUE, &bch->Flags)) { in bchannel_bh()
44 while ((skb = skb_dequeue(&bch->rqueue))) { in bchannel_bh()
45 bch->rcount--; in bchannel_bh()
46 if (likely(bch->ch.peer)) { in bchannel_bh()
47 err = bch->ch.recv(bch->ch.peer, skb); in bchannel_bh()
156 mISDN_ctrl_bchannel(struct bchannel *bch, struct mISDN_ctrl_req *cq) in mISDN_ctrl_bchannel() argument
167 memset(bch->fill, cq->p2 & 0xff, MISDN_BCH_FILL_SIZE); in mISDN_ctrl_bchannel()
168 test_and_set_bit(FLG_FILLEMPTY, &bch->Flags); in mISDN_ctrl_bchannel()
170 test_and_clear_bit(FLG_FILLEMPTY, &bch->Flags); in mISDN_ctrl_bchannel()
175 cq->p2 = bch->dropcnt; in mISDN_ctrl_bchannel()
177 test_and_set_bit(FLG_RX_OFF, &bch->Flags); in mISDN_ctrl_bchannel()
179 test_and_clear_bit(FLG_RX_OFF, &bch->Flags); in mISDN_ctrl_bchannel()
180 bch->dropcnt = 0; in mISDN_ctrl_bchannel()
184 bch->next_maxlen = cq->p2; in mISDN_ctrl_bchannel()
186 bch->next_minlen = cq->p1; in mISDN_ctrl_bchannel()
188 cq->p1 = bch->minlen; in mISDN_ctrl_bchannel()
189 cq->p2 = bch->maxlen; in mISDN_ctrl_bchannel()
249 recv_Bchannel(struct bchannel *bch, unsigned int id, bool force) in recv_Bchannel() argument
254 if (unlikely(!bch->rx_skb)) in recv_Bchannel()
256 if (unlikely(!bch->rx_skb->len)) { in recv_Bchannel()
260 dev_kfree_skb(bch->rx_skb); in recv_Bchannel()
261 bch->rx_skb = NULL; in recv_Bchannel()
263 if (test_bit(FLG_TRANSPARENT, &bch->Flags) && in recv_Bchannel()
264 (bch->rx_skb->len < bch->minlen) && !force) in recv_Bchannel()
266 hh = mISDN_HEAD_P(bch->rx_skb); in recv_Bchannel()
269 if (bch->rcount >= 64) { in recv_Bchannel()
272 bch->nr); in recv_Bchannel()
273 skb_queue_purge(&bch->rqueue); in recv_Bchannel()
275 bch->rcount++; in recv_Bchannel()
276 skb_queue_tail(&bch->rqueue, bch->rx_skb); in recv_Bchannel()
277 bch->rx_skb = NULL; in recv_Bchannel()
278 schedule_event(bch, FLG_RECVQUEUE); in recv_Bchannel()
292 recv_Bchannel_skb(struct bchannel *bch, struct sk_buff *skb) in recv_Bchannel_skb() argument
294 if (bch->rcount >= 64) { in recv_Bchannel_skb()
296 "flushing!\n", bch); in recv_Bchannel_skb()
297 skb_queue_purge(&bch->rqueue); in recv_Bchannel_skb()
298 bch->rcount = 0; in recv_Bchannel_skb()
300 bch->rcount++; in recv_Bchannel_skb()
301 skb_queue_tail(&bch->rqueue, skb); in recv_Bchannel_skb()
302 schedule_event(bch, FLG_RECVQUEUE); in recv_Bchannel_skb()
338 confirm_Bsend(struct bchannel *bch) in confirm_Bsend() argument
342 if (bch->rcount >= 64) { in confirm_Bsend()
344 "flushing!\n", bch); in confirm_Bsend()
345 skb_queue_purge(&bch->rqueue); in confirm_Bsend()
346 bch->rcount = 0; in confirm_Bsend()
348 skb = _alloc_mISDN_skb(PH_DATA_CNF, mISDN_HEAD_ID(bch->tx_skb), in confirm_Bsend()
352 mISDN_HEAD_ID(bch->tx_skb)); in confirm_Bsend()
355 bch->rcount++; in confirm_Bsend()
356 skb_queue_tail(&bch->rqueue, skb); in confirm_Bsend()
357 schedule_event(bch, FLG_RECVQUEUE); in confirm_Bsend()
361 get_next_bframe(struct bchannel *bch) in get_next_bframe() argument
363 bch->tx_idx = 0; in get_next_bframe()
364 if (test_bit(FLG_TX_NEXT, &bch->Flags)) { in get_next_bframe()
365 bch->tx_skb = bch->next_skb; in get_next_bframe()
366 if (bch->tx_skb) { in get_next_bframe()
367 bch->next_skb = NULL; in get_next_bframe()
368 test_and_clear_bit(FLG_TX_NEXT, &bch->Flags); in get_next_bframe()
370 confirm_Bsend(bch); in get_next_bframe()
373 test_and_clear_bit(FLG_TX_NEXT, &bch->Flags); in get_next_bframe()
377 bch->tx_skb = NULL; in get_next_bframe()
378 test_and_clear_bit(FLG_TX_BUSY, &bch->Flags); in get_next_bframe()
470 bchannel_get_rxbuf(struct bchannel *bch, int reqlen) in bchannel_get_rxbuf() argument
474 if (bch->rx_skb) { in bchannel_get_rxbuf()
475 len = skb_tailroom(bch->rx_skb); in bchannel_get_rxbuf()
478 bch->nr, reqlen, len); in bchannel_get_rxbuf()
479 if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in bchannel_get_rxbuf()
481 recv_Bchannel(bch, 0, true); in bchannel_get_rxbuf()
491 if (unlikely(bch->maxlen != bch->next_maxlen)) in bchannel_get_rxbuf()
492 bch->maxlen = bch->next_maxlen; in bchannel_get_rxbuf()
493 if (unlikely(bch->minlen != bch->next_minlen)) in bchannel_get_rxbuf()
494 bch->minlen = bch->next_minlen; in bchannel_get_rxbuf()
495 if (unlikely(reqlen > bch->maxlen)) in bchannel_get_rxbuf()
497 if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in bchannel_get_rxbuf()
498 if (reqlen >= bch->minlen) { in bchannel_get_rxbuf()
501 len = 2 * bch->minlen; in bchannel_get_rxbuf()
502 if (len > bch->maxlen) in bchannel_get_rxbuf()
503 len = bch->maxlen; in bchannel_get_rxbuf()
507 len = bch->maxlen; in bchannel_get_rxbuf()
509 bch->rx_skb = mI_alloc_skb(len, GFP_ATOMIC); in bchannel_get_rxbuf()
510 if (!bch->rx_skb) { in bchannel_get_rxbuf()
511 pr_warn("B%d receive no memory for %d bytes\n", bch->nr, len); in bchannel_get_rxbuf()