Lines Matching refs:vc

550 	struct vc_map *vc;
555 vc = card->vcs[i];
556 if (!vc)
560 if (vc->rx_vcc)
561 vcc = vc->rx_vcc;
562 else if (vc->tx_vcc)
563 vcc = vc->tx_vcc;
568 printk("%s: Connection %d:\n", card->name, vc->index);
569 dump_tct(card, vc->index);
703 push_on_scq(struct idt77252_dev *card, struct vc_map *vc, struct sk_buff *skb)
705 struct scq_info *scq = vc->scq;
721 spin_lock_irqsave(&vc->lock, flags);
722 if (vc->estimator) {
723 struct atm_vcc *vcc = vc->tx_vcc;
726 vc->estimator->cells += (skb->len + 47) / 48;
729 u32 cps = vc->estimator->maxcps;
731 vc->estimator->cps = cps;
732 vc->estimator->avcps = cps << 5;
733 if (vc->lacr < vc->init_er) {
734 vc->lacr = vc->init_er;
735 writel(TCMDQ_LACR | (vc->lacr << 16) |
736 vc->index, SAR_REG_TCMDQ);
740 spin_unlock_irqrestore(&vc->lock, flags);
763 if (test_and_clear_bit(VCF_IDLE, &vc->flags)) {
764 writel(TCMDQ_START_LACR | (vc->lacr << 16) | vc->index,
779 card->name, vc->tx_vcc->vpi, vc->tx_vcc->vci);
791 drain_scq(struct idt77252_dev *card, struct vc_map *vc)
793 struct scq_info *scq = vc->scq;
821 if (push_on_scq(card, vc, skb)) {
822 skb_queue_head(&vc->scq->pending, skb);
830 queue_skb(struct idt77252_dev *card, struct vc_map *vc,
867 if (test_bit(VCF_RSV, &vc->flags))
868 vc = card->vcs[0];
873 if (test_bit(VCF_RSV, &vc->flags)) {
915 spin_lock_irqsave(&vc->scq->skblock, flags);
916 skb_queue_tail(&vc->scq->pending, skb);
918 while ((skb = skb_dequeue(&vc->scq->pending))) {
919 if (push_on_scq(card, vc, skb)) {
920 skb_queue_head(&vc->scq->pending, skb);
924 spin_unlock_irqrestore(&vc->scq->skblock, flags);
935 get_free_scd(struct idt77252_dev *card, struct vc_map *vc)
941 card->scd2vc[i] = vc;
942 vc->scd_index = i;
1016 struct vc_map *vc;
1046 printk("%s: SDU received for out-of-range vc %u.%u\n",
1052 vc = card->vcs[VPCI2VC(card, vpi, vci)];
1053 if (!vc || !test_bit(VCF_RX, &vc->flags)) {
1054 printk("%s: SDU received on non RX vc %u.%u\n",
1060 vcc = vc->rx_vcc;
1115 rpp = &vc->rcv.rx_pool;
1242 struct vc_map *vc;
1287 RPRINTK("%s: SDU received for out-of-range vc %u.%u\n",
1292 vc = card->vcs[VPCI2VC(card, vpi, vci)];
1293 if (!vc || !test_bit(VCF_RX, &vc->flags)) {
1294 RPRINTK("%s: SDU received on non RX vc %u.%u\n",
1299 vcc = vc->rx_vcc;
1302 RPRINTK("%s: raw cell for non AAL0 vc %u.%u\n",
1408 struct vc_map *vc;
1451 vc = card->vcs[conn & 0x1fff];
1452 if (!vc) {
1459 card->name, vc->index);
1461 set_bit(VCF_IDLE, &vc->flags);
1468 vc = card->vcs[conn & 0x1fff];
1469 if (!vc) {
1476 drain_scq(card, vc);
1494 vc = card->vcs[VPCI2VC(card, vpi, vci)];
1495 if (!vc) {
1502 drain_scq(card, vc);
1594 __fill_tst(struct idt77252_dev *card, struct vc_map *vc,
1604 if (card->soft_tst[e].vc == NULL)
1613 card->name, vc ? vc->index : -1, e);
1618 if (vc && (opc != TSTE_OPC_NULL))
1619 data = opc | vc->index;
1627 if ((cl >= avail) && (card->soft_tst[e].vc == NULL)) {
1628 if (vc)
1629 card->soft_tst[e].vc = vc;
1631 card->soft_tst[e].vc = (void *)-1;
1654 fill_tst(struct idt77252_dev *card, struct vc_map *vc, int n, unsigned int opc)
1661 res = __fill_tst(card, vc, n, opc);
1672 __clear_tst(struct idt77252_dev *card, struct vc_map *vc)
1680 if (card->soft_tst[e].vc == vc) {
1681 card->soft_tst[e].vc = NULL;
1697 clear_tst(struct idt77252_dev *card, struct vc_map *vc)
1704 res = __clear_tst(card, vc);
1715 change_tst(struct idt77252_dev *card, struct vc_map *vc,
1723 __clear_tst(card, vc);
1724 res = __fill_tst(card, vc, n, opc);
1736 set_tct(struct idt77252_dev *card, struct vc_map *vc)
1740 tct = (unsigned long) (card->tct_base + vc->index * SAR_SRAM_TCT_SIZE);
1742 switch (vc->class) {
1745 card->name, tct, vc->scq->scd);
1747 write_sram(card, tct + 0, TCT_CBR | vc->scq->scd);
1759 card->name, tct, vc->scq->scd);
1761 write_sram(card, tct + 0, TCT_UBR | vc->scq->scd);
1766 write_sram(card, tct + 5, vc->init_er);
1942 struct vc_map *vc = vcc->dev_data;
1945 if (vc == NULL) {
1951 if (!test_bit(VCF_TX, &vc->flags)) {
1978 err = queue_skb(card, vc, skb, oam);
2073 struct vc_map *vc = est->vc;
2074 struct idt77252_dev *card = vc->card;
2080 spin_lock_irqsave(&vc->lock, flags);
2081 if (!vc->estimator)
2095 if (lacr > vc->max_er)
2096 lacr = vc->max_er;
2098 if (lacr != vc->lacr) {
2099 vc->lacr = lacr;
2100 writel(TCMDQ_LACR|(vc->lacr << 16)|vc->index, SAR_REG_TCMDQ);
2107 spin_unlock_irqrestore(&vc->lock, flags);
2111 idt77252_init_est(struct vc_map *vc, int pcr)
2121 est->vc = vc;
2132 idt77252_init_cbr(struct idt77252_dev *card, struct vc_map *vc,
2148 if (test_bit(VCF_TX, &vc->flags))
2149 tst_used = vc->ntste;
2183 vc->ntste = tst_entries;
2186 if (test_bit(VCF_TX, &vc->flags)) {
2192 change_tst(card, vc, tst_entries, TSTE_OPC_CBR);
2197 fill_tst(card, vc, tst_entries, TSTE_OPC_CBR);
2202 idt77252_init_ubr(struct idt77252_dev *card, struct vc_map *vc,
2209 spin_lock_irqsave(&vc->lock, flags);
2210 if (vc->estimator) {
2211 est = vc->estimator;
2212 vc->estimator = NULL;
2214 spin_unlock_irqrestore(&vc->lock, flags);
2224 vc->estimator = idt77252_init_est(vc, tcr);
2226 vc->class = SCHED_UBR;
2227 vc->init_er = idt77252_rate_logindex(card, tcr);
2228 vc->lacr = vc->init_er;
2230 vc->max_er = vc->init_er;
2232 vc->max_er = 0xff;
2238 idt77252_init_tx(struct idt77252_dev *card, struct vc_map *vc,
2243 if (test_bit(VCF_TX, &vc->flags))
2248 vc->class = SCHED_CBR;
2252 vc->class = SCHED_UBR;
2261 vc->scq = alloc_scq(card, vc->class);
2262 if (!vc->scq) {
2267 vc->scq->scd = get_free_scd(card, vc);
2268 if (vc->scq->scd == 0) {
2270 free_scq(card, vc->scq);
2274 fill_scd(card, vc->scq, vc->class);
2276 if (set_tct(card, vc)) {
2280 card->scd2vc[vc->scd_index] = NULL;
2281 free_scq(card, vc->scq);
2285 switch (vc->class) {
2287 error = idt77252_init_cbr(card, vc, vcc, qos);
2289 card->scd2vc[vc->scd_index] = NULL;
2290 free_scq(card, vc->scq);
2294 clear_bit(VCF_IDLE, &vc->flags);
2295 writel(TCMDQ_START | vc->index, SAR_REG_TCMDQ);
2299 error = idt77252_init_ubr(card, vc, vcc, qos);
2301 card->scd2vc[vc->scd_index] = NULL;
2302 free_scq(card, vc->scq);
2306 set_bit(VCF_IDLE, &vc->flags);
2310 vc->tx_vcc = vcc;
2311 set_bit(VCF_TX, &vc->flags);
2316 idt77252_init_rx(struct idt77252_dev *card, struct vc_map *vc,
2323 if (test_bit(VCF_RX, &vc->flags))
2326 vc->rx_vcc = vcc;
2327 set_bit(VCF_RX, &vc->flags);
2332 flush_rx_pool(card, &vc->rcv.rx_pool);
2366 addr = card->rct_base + (vc->index << 2);
2384 struct vc_map *vc;
2425 printk("%s: can't alloc vc in open()\n", card->name);
2434 vc = card->vcs[index];
2436 vcc->dev_data = vc;
2438 IPRINTK("%s: idt77252_open: vc = %d (%d.%d) %s/%s (max RX SDU: %u)\n",
2439 card->name, vc->index, vcc->vpi, vcc->vci,
2446 test_bit(VCF_TX, &vc->flags))
2449 test_bit(VCF_RX, &vc->flags))
2460 error = idt77252_init_tx(card, vc, vcc, &vcc->qos);
2468 error = idt77252_init_rx(card, vc, vcc, &vcc->qos);
2486 struct vc_map *vc = vcc->dev_data;
2493 IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n",
2494 card->name, vc->index, vcc->vpi, vcc->vci);
2500 spin_lock_irqsave(&vc->lock, flags);
2501 clear_bit(VCF_RX, &vc->flags);
2502 vc->rx_vcc = NULL;
2503 spin_unlock_irqrestore(&vc->lock, flags);
2508 addr = card->rct_base + vc->index * SAR_SRAM_RCT_SIZE;
2515 if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
2519 recycle_rx_pool_skb(card, &vc->rcv.rx_pool);
2526 spin_lock_irqsave(&vc->lock, flags);
2527 clear_bit(VCF_TX, &vc->flags);
2528 clear_bit(VCF_IDLE, &vc->flags);
2529 clear_bit(VCF_RSV, &vc->flags);
2530 vc->tx_vcc = NULL;
2532 if (vc->estimator) {
2533 timer_shutdown(&vc->estimator->timer);
2534 kfree(vc->estimator);
2535 vc->estimator = NULL;
2537 spin_unlock_irqrestore(&vc->lock, flags);
2540 while (atomic_read(&vc->scq->used) > 0) {
2544 card->name, atomic_read(&vc->scq->used));
2549 writel(TCMDQ_HALT | vc->index, SAR_REG_TCMDQ);
2550 clear_scd(card, vc->scq, vc->class);
2552 if (vc->class == SCHED_CBR) {
2553 clear_tst(card, vc);
2554 card->tst_free += vc->ntste;
2555 vc->ntste = 0;
2558 card->scd2vc[vc->scd_index] = NULL;
2559 free_scq(card, vc->scq);
2570 struct vc_map *vc = vcc->dev_data;
2576 if (!test_bit(VCF_TX, &vc->flags)) {
2577 error = idt77252_init_tx(card, vc, vcc, qos);
2583 error = idt77252_init_cbr(card, vc, vcc, qos);
2589 error = idt77252_init_ubr(card, vc, vcc, qos);
2593 if (!test_bit(VCF_IDLE, &vc->flags)) {
2594 writel(TCMDQ_LACR | (vc->lacr << 16) |
2595 vc->index, SAR_REG_TCMDQ);
2608 !test_bit(VCF_RX, &vc->flags)) {
2609 error = idt77252_init_rx(card, vc, vcc, qos);
2664 struct vc_map *vc;
2667 vc = card->vcs[i];
2668 if (!vc)
2672 if (vc->tx_vcc)
2673 vcc = vc->tx_vcc;
2845 struct vc_map *vc;
2854 vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2855 if (!vc) {
2856 printk("%s: can't alloc vc\n", card->name);
2859 vc->index = index;
2860 card->vcs[index] = vc;
2862 flush_rx_pool(card, &vc->rcv.rx_pool);
2869 addr = card->rct_base + (vc->index << 2);
2888 struct vc_map *vc;
2895 vc = card->vcs[index];
2897 addr = card->rct_base + vc->index * SAR_SRAM_RCT_SIZE;
2905 if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
2910 recycle_rx_pool_skb(card, &vc->rcv.rx_pool);
2912 kfree(vc);
2920 struct vc_map *vc;
2922 vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2923 if (!vc) {
2924 printk("%s: can't alloc vc\n", card->name);
2927 card->vcs[0] = vc;
2928 vc->class = SCHED_UBR0;
2930 vc->scq = alloc_scq(card, vc->class);
2931 if (!vc->scq) {
2938 card->scd2vc[0] = vc;
2939 vc->scd_index = 0;
2940 vc->scq->scd = card->scd_base;
2942 fill_scd(card, vc->scq, vc->class);
2953 clear_bit(VCF_IDLE, &vc->flags);
2961 struct vc_map *vc = card->vcs[0];
2963 free_scq(card, vc->scq);
2964 kfree(vc);
3443 card->soft_tst[i].vc = NULL;