Lines Matching refs:bcs
207 hfcpci_sched_event(struct BCState *bcs, int event) in hfcpci_sched_event() argument
209 bcs->event |= 1 << event; in hfcpci_sched_event()
210 queue_task(&bcs->tqueue, &tq_immediate); in hfcpci_sched_event()
221 if (cs->bcs[0].mode && (cs->bcs[0].channel == channel)) in Sel_BCS()
222 return (&cs->bcs[0]); in Sel_BCS()
223 else if (cs->bcs[1].mode && (cs->bcs[1].channel == channel)) in Sel_BCS()
224 return (&cs->bcs[1]); in Sel_BCS()
287 hfcpci_empty_fifo(struct BCState *bcs, bzfifo_type * bz, u_char * bdata, int count) in hfcpci_empty_fifo() argument
291 struct IsdnCardState *cs = bcs->cs; in hfcpci_empty_fifo()
310 bcs->err_inv++; in hfcpci_empty_fifo()
418 hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata) in hfcpci_empty_fifo_trans() argument
459 skb_queue_tail(&bcs->rqueue, skb); in hfcpci_empty_fifo_trans()
461 hfcpci_sched_event(bcs, B_RCVBUFREADY); in hfcpci_empty_fifo_trans()
472 main_rec_hfcpci(struct BCState *bcs) in main_rec_hfcpci() argument
475 struct IsdnCardState *cs = bcs->cs; in main_rec_hfcpci()
485 if ((bcs->channel) && (!cs->hw.hfcpci.bswapped)) { in main_rec_hfcpci()
498 debugl1(cs, "rec_data %d blocked", bcs->channel); in main_rec_hfcpci()
506 bcs->channel, bz->f1, bz->f2); in main_rec_hfcpci()
515 bcs->channel, zp->z1, zp->z2, rcnt); in main_rec_hfcpci()
516 if ((skb = hfcpci_empty_fifo(bcs, bz, bdata, rcnt))) { in main_rec_hfcpci()
518 skb_queue_tail(&bcs->rqueue, skb); in main_rec_hfcpci()
520 hfcpci_sched_event(bcs, B_RCVBUFREADY); in main_rec_hfcpci()
534 } else if (bcs->mode == L1_MODE_TRANS) in main_rec_hfcpci()
535 receive = hfcpci_empty_fifo_trans(bcs, bz, bdata); in main_rec_hfcpci()
624 hfcpci_fill_fifo(struct BCState *bcs) in hfcpci_fill_fifo() argument
626 struct IsdnCardState *cs = bcs->cs; in hfcpci_fill_fifo()
635 if (!bcs->tx_skb) in hfcpci_fill_fifo()
637 if (bcs->tx_skb->len <= 0) in hfcpci_fill_fifo()
643 if ((bcs->channel) && (!cs->hw.hfcpci.bswapped)) { in hfcpci_fill_fifo()
651 if (bcs->mode == L1_MODE_TRANS) { in hfcpci_fill_fifo()
656 bcs->channel, *z1t, *z2t); in hfcpci_fill_fifo()
662 while ((fcnt < 2 * HFCPCI_BTRANS_THRESHOLD) && (bcs->tx_skb)) { in hfcpci_fill_fifo()
663 if (bcs->tx_skb->len < B_FIFO_SIZE - fcnt) { in hfcpci_fill_fifo()
665 count = bcs->tx_skb->len; in hfcpci_fill_fifo()
670 src = bcs->tx_skb->data; /* source pointer */ in hfcpci_fill_fifo()
683 bcs->tx_cnt -= bcs->tx_skb->len; in hfcpci_fill_fifo()
684 fcnt += bcs->tx_skb->len; in hfcpci_fill_fifo()
688 bcs->channel, bcs->tx_skb->len); in hfcpci_fill_fifo()
690 if (bcs->st->lli.l1writewakeup && in hfcpci_fill_fifo()
691 (PACKET_NOACK != bcs->tx_skb->pkt_type)) in hfcpci_fill_fifo()
692 bcs->st->lli.l1writewakeup(bcs->st, bcs->tx_skb->len); in hfcpci_fill_fifo()
694 dev_kfree_skb_any(bcs->tx_skb); in hfcpci_fill_fifo()
696 bcs->tx_skb = skb_dequeue(&bcs->squeue); /* fetch next data */ in hfcpci_fill_fifo()
699 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in hfcpci_fill_fifo()
705 bcs->channel, bz->f1, bz->f2, in hfcpci_fill_fifo()
724 bcs->channel, bcs->tx_skb->len, in hfcpci_fill_fifo()
727 if (count < bcs->tx_skb->len) { in hfcpci_fill_fifo()
733 count = bcs->tx_skb->len; /* get frame len */ in hfcpci_fill_fifo()
739 src = bcs->tx_skb->data; /* source pointer */ in hfcpci_fill_fifo()
752 bcs->tx_cnt -= bcs->tx_skb->len; in hfcpci_fill_fifo()
753 if (bcs->st->lli.l1writewakeup && in hfcpci_fill_fifo()
754 (PACKET_NOACK != bcs->tx_skb->pkt_type)) in hfcpci_fill_fifo()
755 bcs->st->lli.l1writewakeup(bcs->st, bcs->tx_skb->len); in hfcpci_fill_fifo()
762 dev_kfree_skb_any(bcs->tx_skb); in hfcpci_fill_fifo()
763 bcs->tx_skb = NULL; in hfcpci_fill_fifo()
764 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in hfcpci_fill_fifo()
979 struct BCState *bcs; in hfcpci_interrupt() local
1034 if (!(bcs = Sel_BCS(cs, cs->hw.hfcpci.bswapped ? 1 : 0))) { in hfcpci_interrupt()
1038 main_rec_hfcpci(bcs); in hfcpci_interrupt()
1043 else if (!(bcs = Sel_BCS(cs, 1))) { in hfcpci_interrupt()
1047 main_rec_hfcpci(bcs); in hfcpci_interrupt()
1050 if (!(bcs = Sel_BCS(cs, cs->hw.hfcpci.bswapped ? 1 : 0))) { in hfcpci_interrupt()
1054 if (bcs->tx_skb) { in hfcpci_interrupt()
1056 hfcpci_fill_fifo(bcs); in hfcpci_interrupt()
1059 debugl1(cs, "fill_data %d blocked", bcs->channel); in hfcpci_interrupt()
1061 if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) { in hfcpci_interrupt()
1063 hfcpci_fill_fifo(bcs); in hfcpci_interrupt()
1066 debugl1(cs, "fill_data %d blocked", bcs->channel); in hfcpci_interrupt()
1068 hfcpci_sched_event(bcs, B_XMTBUFREADY); in hfcpci_interrupt()
1074 if (!(bcs = Sel_BCS(cs, 1))) { in hfcpci_interrupt()
1078 if (bcs->tx_skb) { in hfcpci_interrupt()
1080 hfcpci_fill_fifo(bcs); in hfcpci_interrupt()
1083 debugl1(cs, "fill_data %d blocked", bcs->channel); in hfcpci_interrupt()
1085 if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) { in hfcpci_interrupt()
1087 hfcpci_fill_fifo(bcs); in hfcpci_interrupt()
1090 debugl1(cs, "fill_data %d blocked", bcs->channel); in hfcpci_interrupt()
1092 hfcpci_sched_event(bcs, B_XMTBUFREADY); in hfcpci_interrupt()
1295 hfcpci_send_data(struct BCState *bcs) in hfcpci_send_data() argument
1297 struct IsdnCardState *cs = bcs->cs; in hfcpci_send_data()
1300 hfcpci_fill_fifo(bcs); in hfcpci_send_data()
1303 debugl1(cs, "send_data %d blocked", bcs->channel); in hfcpci_send_data()
1310 mode_hfcpci(struct BCState *bcs, int mode, int bc) in mode_hfcpci() argument
1312 struct IsdnCardState *cs = bcs->cs; in mode_hfcpci()
1318 mode, bc, bcs->channel); in mode_hfcpci()
1319 bcs->mode = mode; in mode_hfcpci()
1320 bcs->channel = bc; in mode_hfcpci()
1444 if (st->l1.bcs->tx_skb) { in hfcpci_l2l1()
1445 skb_queue_tail(&st->l1.bcs->squeue, skb); in hfcpci_l2l1()
1448 st->l1.bcs->tx_skb = skb; in hfcpci_l2l1()
1450 */ st->l1.bcs->cs->BC_Send_Data(st->l1.bcs); in hfcpci_l2l1()
1455 if (st->l1.bcs->tx_skb) { in hfcpci_l2l1()
1462 */ st->l1.bcs->tx_skb = skb; in hfcpci_l2l1()
1463 st->l1.bcs->cs->BC_Send_Data(st->l1.bcs); in hfcpci_l2l1()
1467 if (!st->l1.bcs->tx_skb) { in hfcpci_l2l1()
1474 test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); in hfcpci_l2l1()
1475 mode_hfcpci(st->l1.bcs, st->l1.mode, st->l1.bc); in hfcpci_l2l1()
1482 test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); in hfcpci_l2l1()
1483 test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); in hfcpci_l2l1()
1484 mode_hfcpci(st->l1.bcs, 0, st->l1.bc); in hfcpci_l2l1()
1494 close_hfcpci(struct BCState *bcs) in close_hfcpci() argument
1496 mode_hfcpci(bcs, 0, bcs->channel); in close_hfcpci()
1497 if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) { in close_hfcpci()
1498 skb_queue_purge(&bcs->rqueue); in close_hfcpci()
1499 skb_queue_purge(&bcs->squeue); in close_hfcpci()
1500 if (bcs->tx_skb) { in close_hfcpci()
1501 dev_kfree_skb_any(bcs->tx_skb); in close_hfcpci()
1502 bcs->tx_skb = NULL; in close_hfcpci()
1503 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in close_hfcpci()
1512 open_hfcpcistate(struct IsdnCardState *cs, struct BCState *bcs) in open_hfcpcistate() argument
1514 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { in open_hfcpcistate()
1515 skb_queue_head_init(&bcs->rqueue); in open_hfcpcistate()
1516 skb_queue_head_init(&bcs->squeue); in open_hfcpcistate()
1518 bcs->tx_skb = NULL; in open_hfcpcistate()
1519 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in open_hfcpcistate()
1520 bcs->event = 0; in open_hfcpcistate()
1521 bcs->tx_cnt = 0; in open_hfcpcistate()
1529 setstack_2b(struct PStack *st, struct BCState *bcs) in setstack_2b() argument
1531 bcs->channel = st->l1.bc; in setstack_2b()
1532 if (open_hfcpcistate(st->l1.hardware, bcs)) in setstack_2b()
1534 st->l1.bcs = bcs; in setstack_2b()
1537 bcs->st = st; in setstack_2b()
1635 cs->bcs[0].BC_SetStack = setstack_2b; in inithfcpci()
1636 cs->bcs[1].BC_SetStack = setstack_2b; in inithfcpci()
1637 cs->bcs[0].BC_Close = close_hfcpci; in inithfcpci()
1638 cs->bcs[1].BC_Close = close_hfcpci; in inithfcpci()
1639 mode_hfcpci(cs->bcs, 0, 0); in inithfcpci()
1640 mode_hfcpci(cs->bcs + 1, 0, 1); in inithfcpci()