Lines Matching full:chain
58 "in tx chain");
269 * spider_net_free_chain - free descriptor chain
271 * @chain: address of chain
276 struct spider_net_descr_chain *chain) in spider_net_free_chain() argument
280 descr = chain->ring; in spider_net_free_chain()
285 } while (descr != chain->ring); in spider_net_free_chain()
287 dma_free_coherent(&card->pdev->dev, chain->num_desc * sizeof(struct spider_net_hw_descr), in spider_net_free_chain()
288 chain->hwring, chain->dma_addr); in spider_net_free_chain()
292 * spider_net_init_chain - alloc and link descriptor chain
294 * @chain: address of chain
303 struct spider_net_descr_chain *chain) in spider_net_init_chain() argument
311 alloc_size = chain->num_desc * sizeof(struct spider_net_hw_descr); in spider_net_init_chain()
313 chain->hwring = dma_alloc_coherent(&card->pdev->dev, alloc_size, in spider_net_init_chain()
314 &chain->dma_addr, GFP_KERNEL); in spider_net_init_chain()
315 if (!chain->hwring) in spider_net_init_chain()
319 descr = chain->ring; in spider_net_init_chain()
320 hwdescr = chain->hwring; in spider_net_init_chain()
321 buf = chain->dma_addr; in spider_net_init_chain()
322 for (i=0; i < chain->num_desc; i++, descr++, hwdescr++) { in spider_net_init_chain()
334 (descr-1)->next = chain->ring; in spider_net_init_chain()
335 chain->ring->prev = descr-1; in spider_net_init_chain()
337 spin_lock_init(&chain->lock); in spider_net_init_chain()
338 chain->head = chain->ring; in spider_net_init_chain()
339 chain->tail = chain->ring; in spider_net_init_chain()
344 * spider_net_free_rx_chain_contents - frees descr contents in rx chain
435 * spider_net_enable_rxchtails - sets RX dmac chain tail addresses
438 * spider_net_enable_rxchtails sets the RX DMAC chain tail addresses in the
445 /* assume chain is aligned correctly */ in spider_net_enable_rxchtails()
483 * refills descriptors in the rx chain: allocates skbs and iommu-maps them.
488 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_refill_rx_chain() local
496 if (!spin_trylock_irqsave(&chain->lock, flags)) in spider_net_refill_rx_chain()
499 while (spider_net_get_descr_status(chain->head->hwdescr) == in spider_net_refill_rx_chain()
501 if (spider_net_prepare_rx_descr(card, chain->head)) in spider_net_refill_rx_chain()
503 chain->head = chain->head->next; in spider_net_refill_rx_chain()
506 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_refill_rx_chain()
518 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_alloc_rx_skbs() local
519 struct spider_net_descr *start = chain->tail; in spider_net_alloc_rx_skbs()
522 /* Link up the hardware chain pointers */ in spider_net_alloc_rx_skbs()
528 /* Put at least one buffer into the chain. if this fails, in spider_net_alloc_rx_skbs()
532 if (spider_net_prepare_rx_descr(card, chain->head)) in spider_net_alloc_rx_skbs()
535 chain->head = chain->head->next; in spider_net_alloc_rx_skbs()
651 struct spider_net_descr_chain *chain = &card->tx_chain; in spider_net_prepare_tx_descr() local
667 spin_lock_irqsave(&chain->lock, flags); in spider_net_prepare_tx_descr()
669 if (descr->next == chain->tail->prev) { in spider_net_prepare_tx_descr()
670 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_prepare_tx_descr()
676 chain->head = descr->next; in spider_net_prepare_tx_descr()
686 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_prepare_tx_descr()
698 /* Chain the bus address, so that the DMA engine finds this descr. */ in spider_net_prepare_tx_descr()
766 struct spider_net_descr_chain *chain = &card->tx_chain; in spider_net_release_tx_chain() local
775 spin_lock_irqsave(&chain->lock, flags); in spider_net_release_tx_chain()
776 if (chain->tail == chain->head) { in spider_net_release_tx_chain()
777 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
780 descr = chain->tail; in spider_net_release_tx_chain()
792 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
814 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
819 chain->tail = descr->next; in spider_net_release_tx_chain()
824 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
843 * Writes the current tx chain head as start address
844 * of the tx descriptor chain and enables the transmission
990 struct spider_net_descr_chain *chain = &card->rx_chain; in show_rx_chain() local
991 struct spider_net_descr *start= chain->tail; in show_rx_chain()
1000 int off = start - chain->ring; in show_rx_chain()
1004 chain->num_desc); in show_rx_chain()
1005 dev_info(dev, "Chain tail located at descr=%d, status=0x%x\n", in show_rx_chain()
1015 off = descr - chain->ring; in show_rx_chain()
1018 if (descr == chain->head) in show_rx_chain()
1019 dev_info(dev, "Chain head is at %d, head status=0x%x\n", in show_rx_chain()
1031 dev_info(dev, "chain is cut at %d\n", off); in show_rx_chain()
1034 int from = (chain->num_desc + off - cnt) % chain->num_desc; in show_rx_chain()
1035 int to = (chain->num_desc + off - 1) % chain->num_desc; in show_rx_chain()
1057 cnt = descr - chain->ring; in show_rx_chain()
1084 * to "catch up" to where the hardware chain pointer is at.
1089 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_resync_head_ptr() local
1094 descr = chain->head; in spider_net_resync_head_ptr()
1100 spin_lock_irqsave(&chain->lock, flags); in spider_net_resync_head_ptr()
1102 descr = chain->head; in spider_net_resync_head_ptr()
1104 for (i=0; i<chain->num_desc; i++) { in spider_net_resync_head_ptr()
1109 chain->head = descr; in spider_net_resync_head_ptr()
1111 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_resync_head_ptr()
1116 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_resync_tail_ptr() local
1121 descr = chain->tail; in spider_net_resync_tail_ptr()
1124 for (i=0; i<chain->num_desc; i++) { in spider_net_resync_tail_ptr()
1130 chain->tail = descr; in spider_net_resync_tail_ptr()
1132 if ((i == chain->num_desc) || (i == 0)) in spider_net_resync_tail_ptr()
1152 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_decode_one_descr() local
1153 struct spider_net_descr *descr = chain->tail; in spider_net_decode_one_descr()
1166 chain->tail = descr->next; in spider_net_decode_one_descr()
1445 /* chain end. If a descriptor should be sent, kick off in spider_net_handle_error_irq()
1474 /* Could happen when rx chain is full */ in spider_net_handle_error_irq()
1492 /* chain end */ in spider_net_handle_error_irq()
1510 /* Could happen when rx chain is full */ in spider_net_handle_error_irq()
1773 /* set chain tail address for RX chains and in spider_net_enable_card()