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 = pci_zalloc_consistent(card->pcidev, SCQ_SIZE, &scq->paddr); in alloc_scq()
645 if (scq->base == NULL) { in alloc_scq()
646 kfree(scq); in alloc_scq()
650 scq->next = scq->base; in alloc_scq()
651 scq->last = scq->base + (SCQ_ENTRIES - 1); in alloc_scq()
652 atomic_set(&scq->used, 0); in alloc_scq()
654 spin_lock_init(&scq->lock); in alloc_scq()
655 spin_lock_init(&scq->skblock); in alloc_scq()
657 skb_queue_head_init(&scq->transmit); in alloc_scq()
658 skb_queue_head_init(&scq->pending); in alloc_scq()
661 scq->base, scq->next, scq->last, (unsigned long long)scq->paddr); in alloc_scq()
663 return scq; in alloc_scq()
667 free_scq(struct idt77252_dev *card, struct scq_info *scq) in free_scq() argument
673 scq->base, scq->paddr); in free_scq()
675 while ((skb = skb_dequeue(&scq->transmit))) { in free_scq()
686 while ((skb = skb_dequeue(&scq->pending))) { in free_scq()
697 kfree(scq); in free_scq()
704 struct scq_info *scq = vc->scq; in push_on_scq() local
709 TXPRINTK("%s: SCQ: next 0x%p\n", card->name, scq->next); in push_on_scq()
711 atomic_inc(&scq->used); in push_on_scq()
712 entries = atomic_read(&scq->used); in push_on_scq()
714 atomic_dec(&scq->used); in push_on_scq()
718 skb_queue_tail(&scq->transmit, skb); in push_on_scq()
743 spin_lock_irqsave(&scq->lock, flags); in push_on_scq()
744 scq->next->word_1 = cpu_to_le32(tbd->word_1 | in push_on_scq()
746 scq->next->word_2 = cpu_to_le32(tbd->word_2); in push_on_scq()
747 scq->next->word_3 = cpu_to_le32(tbd->word_3); in push_on_scq()
748 scq->next->word_4 = cpu_to_le32(tbd->word_4); in push_on_scq()
750 if (scq->next == scq->last) in push_on_scq()
751 scq->next = scq->base; in push_on_scq()
753 scq->next++; in push_on_scq()
755 write_sram(card, scq->scd, in push_on_scq()
756 scq->paddr + in push_on_scq()
757 (u32)((unsigned long)scq->next - (unsigned long)scq->base)); in push_on_scq()
758 spin_unlock_irqrestore(&scq->lock, flags); in push_on_scq()
760 scq->trans_start = jiffies; in push_on_scq()
767 TXPRINTK("%d entries in SCQ used (push).\n", atomic_read(&scq->used)); in push_on_scq()
770 card->name, atomic_read(&scq->used), in push_on_scq()
771 read_sram(card, scq->scd + 1), scq->next); in push_on_scq()
776 if (time_after(jiffies, scq->trans_start + HZ)) { in push_on_scq()
782 scq->trans_start = jiffies; in push_on_scq()
792 struct scq_info *scq = vc->scq; in drain_scq() local
797 card->name, atomic_read(&scq->used), scq->next); in drain_scq()
799 skb = skb_dequeue(&scq->transmit); in drain_scq()
816 atomic_dec(&scq->used); in drain_scq()
818 spin_lock(&scq->skblock); in drain_scq()
819 while ((skb = skb_dequeue(&scq->pending))) { in drain_scq()
821 skb_queue_head(&vc->scq->pending, skb); in drain_scq()
825 spin_unlock(&scq->skblock); in drain_scq()
913 spin_lock_irqsave(&vc->scq->skblock, flags); in queue_skb()
914 skb_queue_tail(&vc->scq->pending, skb); in queue_skb()
916 while ((skb = skb_dequeue(&vc->scq->pending))) { in queue_skb()
918 skb_queue_head(&vc->scq->pending, skb); in queue_skb()
922 spin_unlock_irqrestore(&vc->scq->skblock, flags); in queue_skb()
948 fill_scd(struct idt77252_dev *card, struct scq_info *scq, int class) in fill_scd() argument
950 write_sram(card, scq->scd, scq->paddr); in fill_scd()
951 write_sram(card, scq->scd + 1, 0x00000000); in fill_scd()
952 write_sram(card, scq->scd + 2, 0xffffffff); in fill_scd()
953 write_sram(card, scq->scd + 3, 0x00000000); in fill_scd()
957 clear_scd(struct idt77252_dev *card, struct scq_info *scq, int class) in clear_scd() argument
1747 card->name, tct, vc->scq->scd); in set_tct()
1749 write_sram(card, tct + 0, TCT_CBR | vc->scq->scd); in set_tct()
1761 card->name, tct, vc->scq->scd); in set_tct()
1763 write_sram(card, tct + 0, TCT_UBR | vc->scq->scd); in set_tct()
2270 vc->scq = alloc_scq(card, vc->class); in idt77252_init_tx()
2271 if (!vc->scq) { in idt77252_init_tx()
2276 vc->scq->scd = get_free_scd(card, vc); in idt77252_init_tx()
2277 if (vc->scq->scd == 0) { in idt77252_init_tx()
2279 free_scq(card, vc->scq); in idt77252_init_tx()
2283 fill_scd(card, vc->scq, vc->class); in idt77252_init_tx()
2290 free_scq(card, vc->scq); in idt77252_init_tx()
2299 free_scq(card, vc->scq); in idt77252_init_tx()
2311 free_scq(card, vc->scq); in idt77252_init_tx()
2549 while (atomic_read(&vc->scq->used) > 0) { in idt77252_close()
2553 card->name, atomic_read(&vc->scq->used)); in idt77252_close()
2559 clear_scd(card, vc->scq, vc->class); in idt77252_close()
2568 free_scq(card, vc->scq); in idt77252_close()
2938 vc->scq = alloc_scq(card, vc->class); in open_card_ubr0()
2939 if (!vc->scq) { in open_card_ubr0()
2946 vc->scq->scd = card->scd_base; in open_card_ubr0()
2948 fill_scd(card, vc->scq, vc->class); in open_card_ubr0()