Lines Matching full:chain
58 "in tx chain");
268 * spider_net_free_chain - free descriptor chain
270 * @chain: address of chain
275 struct spider_net_descr_chain *chain) in spider_net_free_chain() argument
279 descr = chain->ring; in spider_net_free_chain()
284 } while (descr != chain->ring); in spider_net_free_chain()
286 dma_free_coherent(&card->pdev->dev, chain->num_desc * sizeof(struct spider_net_hw_descr), in spider_net_free_chain()
287 chain->hwring, chain->dma_addr); in spider_net_free_chain()
291 * spider_net_init_chain - alloc and link descriptor chain
293 * @chain: address of chain
302 struct spider_net_descr_chain *chain) in spider_net_init_chain() argument
310 alloc_size = chain->num_desc * sizeof(struct spider_net_hw_descr); in spider_net_init_chain()
312 chain->hwring = dma_alloc_coherent(&card->pdev->dev, alloc_size, in spider_net_init_chain()
313 &chain->dma_addr, GFP_KERNEL); in spider_net_init_chain()
314 if (!chain->hwring) in spider_net_init_chain()
318 descr = chain->ring; in spider_net_init_chain()
319 hwdescr = chain->hwring; in spider_net_init_chain()
320 buf = chain->dma_addr; in spider_net_init_chain()
321 for (i=0; i < chain->num_desc; i++, descr++, hwdescr++) { in spider_net_init_chain()
333 (descr-1)->next = chain->ring; in spider_net_init_chain()
334 chain->ring->prev = descr-1; in spider_net_init_chain()
336 spin_lock_init(&chain->lock); in spider_net_init_chain()
337 chain->head = chain->ring; in spider_net_init_chain()
338 chain->tail = chain->ring; in spider_net_init_chain()
343 * spider_net_free_rx_chain_contents - frees descr contents in rx chain
432 * spider_net_enable_rxchtails - sets RX dmac chain tail addresses
435 * spider_net_enable_rxchtails sets the RX DMAC chain tail addresses in the
442 /* assume chain is aligned correctly */ in spider_net_enable_rxchtails()
480 * refills descriptors in the rx chain: allocates skbs and iommu-maps them.
485 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_refill_rx_chain() local
492 if (!spin_trylock_irqsave(&chain->lock, flags)) in spider_net_refill_rx_chain()
495 while (spider_net_get_descr_status(chain->head->hwdescr) == in spider_net_refill_rx_chain()
497 if (spider_net_prepare_rx_descr(card, chain->head)) in spider_net_refill_rx_chain()
499 chain->head = chain->head->next; in spider_net_refill_rx_chain()
502 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_refill_rx_chain()
514 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_alloc_rx_skbs() local
515 struct spider_net_descr *start = chain->tail; in spider_net_alloc_rx_skbs()
518 /* Link up the hardware chain pointers */ in spider_net_alloc_rx_skbs()
524 /* Put at least one buffer into the chain. if this fails, in spider_net_alloc_rx_skbs()
527 if (spider_net_prepare_rx_descr(card, chain->head)) in spider_net_alloc_rx_skbs()
530 chain->head = chain->head->next; in spider_net_alloc_rx_skbs()
644 struct spider_net_descr_chain *chain = &card->tx_chain; in spider_net_prepare_tx_descr() local
659 spin_lock_irqsave(&chain->lock, flags); in spider_net_prepare_tx_descr()
661 if (descr->next == chain->tail->prev) { in spider_net_prepare_tx_descr()
662 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_prepare_tx_descr()
667 chain->head = descr->next; in spider_net_prepare_tx_descr()
677 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_prepare_tx_descr()
689 /* Chain the bus address, so that the DMA engine finds this descr. */ in spider_net_prepare_tx_descr()
756 struct spider_net_descr_chain *chain = &card->tx_chain; in spider_net_release_tx_chain() local
765 spin_lock_irqsave(&chain->lock, flags); in spider_net_release_tx_chain()
766 if (chain->tail == chain->head) { in spider_net_release_tx_chain()
767 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
770 descr = chain->tail; in spider_net_release_tx_chain()
782 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
803 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
808 chain->tail = descr->next; in spider_net_release_tx_chain()
813 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_release_tx_chain()
832 * Writes the current tx chain head as start address
833 * of the tx descriptor chain and enables the transmission
978 struct spider_net_descr_chain *chain = &card->rx_chain; in show_rx_chain() local
979 struct spider_net_descr *start= chain->tail; in show_rx_chain()
988 int off = start - chain->ring; in show_rx_chain()
992 chain->num_desc); in show_rx_chain()
993 dev_info(dev, "Chain tail located at descr=%d, status=0x%x\n", in show_rx_chain()
1003 off = descr - chain->ring; in show_rx_chain()
1006 if (descr == chain->head) in show_rx_chain()
1007 dev_info(dev, "Chain head is at %d, head status=0x%x\n", in show_rx_chain()
1019 dev_info(dev, "chain is cut at %d\n", off); in show_rx_chain()
1022 int from = (chain->num_desc + off - cnt) % chain->num_desc; in show_rx_chain()
1023 int to = (chain->num_desc + off - 1) % chain->num_desc; in show_rx_chain()
1045 cnt = descr - chain->ring; in show_rx_chain()
1071 * to "catch up" to where the hardware chain pointer is at.
1076 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_resync_head_ptr() local
1081 descr = chain->head; in spider_net_resync_head_ptr()
1087 spin_lock_irqsave(&chain->lock, flags); in spider_net_resync_head_ptr()
1089 descr = chain->head; in spider_net_resync_head_ptr()
1091 for (i=0; i<chain->num_desc; i++) { in spider_net_resync_head_ptr()
1096 chain->head = descr; in spider_net_resync_head_ptr()
1098 spin_unlock_irqrestore(&chain->lock, flags); in spider_net_resync_head_ptr()
1103 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_resync_tail_ptr() local
1108 descr = chain->tail; in spider_net_resync_tail_ptr()
1111 for (i=0; i<chain->num_desc; i++) { in spider_net_resync_tail_ptr()
1117 chain->tail = descr; in spider_net_resync_tail_ptr()
1119 if ((i == chain->num_desc) || (i == 0)) in spider_net_resync_tail_ptr()
1139 struct spider_net_descr_chain *chain = &card->rx_chain; in spider_net_decode_one_descr() local
1140 struct spider_net_descr *descr = chain->tail; in spider_net_decode_one_descr()
1153 chain->tail = descr->next; in spider_net_decode_one_descr()
1429 /* chain end. If a descriptor should be sent, kick off in spider_net_handle_error_irq()
1457 /* Could happen when rx chain is full */ in spider_net_handle_error_irq()
1475 /* chain end */ in spider_net_handle_error_irq()
1493 /* Could happen when rx chain is full */ in spider_net_handle_error_irq()
1755 /* set chain tail address for RX chains and in spider_net_enable_card()