Lines Matching refs:scq

639 	struct scq_info *scq;  in alloc_scq()  local
641 scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); in alloc_scq()
642 if (!scq) in alloc_scq()
644 scq->base = dma_alloc_coherent(&card->pcidev->dev, SCQ_SIZE, in alloc_scq()
645 &scq->paddr, GFP_KERNEL); in alloc_scq()
646 if (scq->base == NULL) { in alloc_scq()
647 kfree(scq); in alloc_scq()
651 scq->next = scq->base; in alloc_scq()
652 scq->last = scq->base + (SCQ_ENTRIES - 1); in alloc_scq()
653 atomic_set(&scq->used, 0); in alloc_scq()
655 spin_lock_init(&scq->lock); in alloc_scq()
656 spin_lock_init(&scq->skblock); in alloc_scq()
658 skb_queue_head_init(&scq->transmit); in alloc_scq()
659 skb_queue_head_init(&scq->pending); in alloc_scq()
662 scq->base, scq->next, scq->last, (unsigned long long)scq->paddr); in alloc_scq()
664 return scq; in alloc_scq()
668 free_scq(struct idt77252_dev *card, struct scq_info *scq) in free_scq() argument
674 scq->base, scq->paddr); in free_scq()
676 while ((skb = skb_dequeue(&scq->transmit))) { in free_scq()
687 while ((skb = skb_dequeue(&scq->pending))) { in free_scq()
698 kfree(scq); in free_scq()
705 struct scq_info *scq = vc->scq; in push_on_scq() local
710 TXPRINTK("%s: SCQ: next 0x%p\n", card->name, scq->next); in push_on_scq()
712 atomic_inc(&scq->used); in push_on_scq()
713 entries = atomic_read(&scq->used); in push_on_scq()
715 atomic_dec(&scq->used); in push_on_scq()
719 skb_queue_tail(&scq->transmit, skb); in push_on_scq()
744 spin_lock_irqsave(&scq->lock, flags); in push_on_scq()
745 scq->next->word_1 = cpu_to_le32(tbd->word_1 | in push_on_scq()
747 scq->next->word_2 = cpu_to_le32(tbd->word_2); in push_on_scq()
748 scq->next->word_3 = cpu_to_le32(tbd->word_3); in push_on_scq()
749 scq->next->word_4 = cpu_to_le32(tbd->word_4); in push_on_scq()
751 if (scq->next == scq->last) in push_on_scq()
752 scq->next = scq->base; in push_on_scq()
754 scq->next++; in push_on_scq()
756 write_sram(card, scq->scd, in push_on_scq()
757 scq->paddr + in push_on_scq()
758 (u32)((unsigned long)scq->next - (unsigned long)scq->base)); in push_on_scq()
759 spin_unlock_irqrestore(&scq->lock, flags); in push_on_scq()
761 scq->trans_start = jiffies; in push_on_scq()
768 TXPRINTK("%d entries in SCQ used (push).\n", atomic_read(&scq->used)); in push_on_scq()
771 card->name, atomic_read(&scq->used), in push_on_scq()
772 read_sram(card, scq->scd + 1), scq->next); in push_on_scq()
777 if (time_after(jiffies, scq->trans_start + HZ)) { in push_on_scq()
783 scq->trans_start = jiffies; in push_on_scq()
793 struct scq_info *scq = vc->scq; in drain_scq() local
798 card->name, atomic_read(&scq->used), scq->next); in drain_scq()
800 skb = skb_dequeue(&scq->transmit); in drain_scq()
817 atomic_dec(&scq->used); in drain_scq()
819 spin_lock(&scq->skblock); in drain_scq()
820 while ((skb = skb_dequeue(&scq->pending))) { in drain_scq()
822 skb_queue_head(&vc->scq->pending, skb); in drain_scq()
826 spin_unlock(&scq->skblock); in drain_scq()
915 spin_lock_irqsave(&vc->scq->skblock, flags); in queue_skb()
916 skb_queue_tail(&vc->scq->pending, skb); in queue_skb()
918 while ((skb = skb_dequeue(&vc->scq->pending))) { in queue_skb()
920 skb_queue_head(&vc->scq->pending, skb); in queue_skb()
924 spin_unlock_irqrestore(&vc->scq->skblock, flags); in queue_skb()
950 fill_scd(struct idt77252_dev *card, struct scq_info *scq, int class) in fill_scd() argument
952 write_sram(card, scq->scd, scq->paddr); in fill_scd()
953 write_sram(card, scq->scd + 1, 0x00000000); in fill_scd()
954 write_sram(card, scq->scd + 2, 0xffffffff); in fill_scd()
955 write_sram(card, scq->scd + 3, 0x00000000); in fill_scd()
959 clear_scd(struct idt77252_dev *card, struct scq_info *scq, int class) in clear_scd() argument
1745 card->name, tct, vc->scq->scd); in set_tct()
1747 write_sram(card, tct + 0, TCT_CBR | vc->scq->scd); in set_tct()
1759 card->name, tct, vc->scq->scd); in set_tct()
1761 write_sram(card, tct + 0, TCT_UBR | vc->scq->scd); in set_tct()
2261 vc->scq = alloc_scq(card, vc->class); in idt77252_init_tx()
2262 if (!vc->scq) { in idt77252_init_tx()
2267 vc->scq->scd = get_free_scd(card, vc); in idt77252_init_tx()
2268 if (vc->scq->scd == 0) { in idt77252_init_tx()
2270 free_scq(card, vc->scq); in idt77252_init_tx()
2274 fill_scd(card, vc->scq, vc->class); in idt77252_init_tx()
2281 free_scq(card, vc->scq); in idt77252_init_tx()
2290 free_scq(card, vc->scq); in idt77252_init_tx()
2302 free_scq(card, vc->scq); in idt77252_init_tx()
2540 while (atomic_read(&vc->scq->used) > 0) { in idt77252_close()
2544 card->name, atomic_read(&vc->scq->used)); in idt77252_close()
2550 clear_scd(card, vc->scq, vc->class); in idt77252_close()
2559 free_scq(card, vc->scq); in idt77252_close()
2929 vc->scq = alloc_scq(card, vc->class); in open_card_ubr0()
2930 if (!vc->scq) { in open_card_ubr0()
2937 vc->scq->scd = card->scd_base; in open_card_ubr0()
2939 fill_scd(card, vc->scq, vc->class); in open_card_ubr0()