Lines Matching full:chain

59 		 "in tx chain");
270 * spider_net_free_chain - free descriptor chain
272 * @chain: address of chain
277 struct spider_net_descr_chain *chain) in spider_net_free_chain() argument
281 descr = chain->ring; in spider_net_free_chain()
286 } while (descr != chain->ring); in spider_net_free_chain()
288 dma_free_coherent(&card->pdev->dev, chain->num_desc * sizeof(struct spider_net_hw_descr), in spider_net_free_chain()
289 chain->hwring, chain->dma_addr); in spider_net_free_chain()
293 * spider_net_init_chain - alloc and link descriptor chain
295 * @chain: address of chain
304 struct spider_net_descr_chain *chain) in spider_net_init_chain() argument
312 alloc_size = chain->num_desc * sizeof(struct spider_net_hw_descr); in spider_net_init_chain()
314 chain->hwring = dma_alloc_coherent(&card->pdev->dev, alloc_size, in spider_net_init_chain()
315 &chain->dma_addr, GFP_KERNEL); in spider_net_init_chain()
316 if (!chain->hwring) in spider_net_init_chain()
320 descr = chain->ring; in spider_net_init_chain()
321 hwdescr = chain->hwring; in spider_net_init_chain()
322 buf = chain->dma_addr; in spider_net_init_chain()
323 for (i=0; i < chain->num_desc; i++, descr++, hwdescr++) { in spider_net_init_chain()
335 (descr-1)->next = chain->ring; in spider_net_init_chain()
336 chain->ring->prev = descr-1; in spider_net_init_chain()
338 spin_lock_init(&chain->lock); in spider_net_init_chain()
339 chain->head = chain->ring; in spider_net_init_chain()
340 chain->tail = chain->ring; in spider_net_init_chain()
345 * spider_net_free_rx_chain_contents - frees descr contents in rx chain
436 * spider_net_enable_rxchtails - sets RX dmac chain tail addresses
439 * spider_net_enable_rxchtails sets the RX DMAC chain tail addresses in the
446 /* assume chain is aligned correctly */ in spider_net_enable_rxchtails()
484 * refills descriptors in the rx chain: allocates skbs and iommu-maps them.
489 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_refill_rx_chain() local
497 if (!spin_trylock_irqsave(&chain->lock, flags)) in spider_net_refill_rx_chain()
500 while (spider_net_get_descr_status(chain->head->hwdescr) == in spider_net_refill_rx_chain()
502 if (spider_net_prepare_rx_descr(card, chain->head)) in spider_net_refill_rx_chain()
504 chain->head = chain->head->next; in spider_net_refill_rx_chain()
507 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_refill_rx_chain()
519 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_alloc_rx_skbs() local
520 struct spider_net_descr *start = chain->tail; in spider_net_alloc_rx_skbs()
523 /* Link up the hardware chain pointers */ in spider_net_alloc_rx_skbs()
529 /* Put at least one buffer into the chain. if this fails, in spider_net_alloc_rx_skbs()
533 if (spider_net_prepare_rx_descr(card, chain->head)) in spider_net_alloc_rx_skbs()
536 chain->head = chain->head->next; in spider_net_alloc_rx_skbs()
652 struct spider_net_descr_chain *chain = &card->tx_chain; in spider_net_prepare_tx_descr() local
668 spin_lock_irqsave(&chain->lock, flags); in spider_net_prepare_tx_descr()
670 if (descr->next == chain->tail->prev) { in spider_net_prepare_tx_descr()
671 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_prepare_tx_descr()
677 chain->head = descr->next; in spider_net_prepare_tx_descr()
687 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_prepare_tx_descr()
699 /* Chain the bus address, so that the DMA engine finds this descr. */ in spider_net_prepare_tx_descr()
767 struct spider_net_descr_chain *chain = &card->tx_chain; in spider_net_release_tx_chain() local
776 spin_lock_irqsave(&chain->lock, flags); in spider_net_release_tx_chain()
777 if (chain->tail == chain->head) { in spider_net_release_tx_chain()
778 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
781 descr = chain->tail; in spider_net_release_tx_chain()
793 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
815 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
820 chain->tail = descr->next; in spider_net_release_tx_chain()
825 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
844 * Writes the current tx chain head as start address
845 * of the tx descriptor chain and enables the transmission
991 struct spider_net_descr_chain *chain = &card->rx_chain; in show_rx_chain() local
992 struct spider_net_descr *start= chain->tail; in show_rx_chain()
1001 int off = start - chain->ring; in show_rx_chain()
1005 chain->num_desc); in show_rx_chain()
1006 dev_info(dev, "Chain tail located at descr=%d, status=0x%x\n", in show_rx_chain()
1016 off = descr - chain->ring; in show_rx_chain()
1019 if (descr == chain->head) in show_rx_chain()
1020 dev_info(dev, "Chain head is at %d, head status=0x%x\n", in show_rx_chain()
1032 dev_info(dev, "chain is cut at %d\n", off); in show_rx_chain()
1035 int from = (chain->num_desc + off - cnt) % chain->num_desc; in show_rx_chain()
1036 int to = (chain->num_desc + off - 1) % chain->num_desc; in show_rx_chain()
1058 cnt = descr - chain->ring; in show_rx_chain()
1085 * to "catch up" to where the hardware chain pointer is at.
1090 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_resync_head_ptr() local
1095 descr = chain->head; in spider_net_resync_head_ptr()
1101 spin_lock_irqsave(&chain->lock, flags); in spider_net_resync_head_ptr()
1103 descr = chain->head; in spider_net_resync_head_ptr()
1105 for (i=0; i<chain->num_desc; i++) { in spider_net_resync_head_ptr()
1110 chain->head = descr; in spider_net_resync_head_ptr()
1112 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_resync_head_ptr()
1117 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_resync_tail_ptr() local
1122 descr = chain->tail; in spider_net_resync_tail_ptr()
1125 for (i=0; i<chain->num_desc; i++) { in spider_net_resync_tail_ptr()
1131 chain->tail = descr; in spider_net_resync_tail_ptr()
1133 if ((i == chain->num_desc) || (i == 0)) in spider_net_resync_tail_ptr()
1153 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_decode_one_descr() local
1154 struct spider_net_descr *descr = chain->tail; in spider_net_decode_one_descr()
1167 chain->tail = descr->next; in spider_net_decode_one_descr()
1446 /* chain end. If a descriptor should be sent, kick off in spider_net_handle_error_irq()
1475 /* Could happen when rx chain is full */ in spider_net_handle_error_irq()
1493 /* chain end */ in spider_net_handle_error_irq()
1511 /* Could happen when rx chain is full */ in spider_net_handle_error_irq()
1774 /* set chain tail address for RX chains and in spider_net_enable_card()