• Home
  • Raw
  • Download

Lines Matching refs:txq

54 static void alx_free_txbuf(struct alx_tx_queue *txq, int entry)  in alx_free_txbuf()  argument
56 struct alx_buffer *txb = &txq->bufs[entry]; in alx_free_txbuf()
59 dma_unmap_single(txq->dev, in alx_free_txbuf()
150 return alx->qnapi[r_idx]->txq; in alx_tx_queue_mapping()
153 static struct netdev_queue *alx_get_tx_queue(const struct alx_tx_queue *txq) in alx_get_tx_queue() argument
155 return netdev_get_tx_queue(txq->netdev, txq->queue_idx); in alx_get_tx_queue()
158 static inline int alx_tpd_avail(struct alx_tx_queue *txq) in alx_tpd_avail() argument
160 if (txq->write_idx >= txq->read_idx) in alx_tpd_avail()
161 return txq->count + txq->read_idx - txq->write_idx - 1; in alx_tpd_avail()
162 return txq->read_idx - txq->write_idx - 1; in alx_tpd_avail()
165 static bool alx_clean_tx_irq(struct alx_tx_queue *txq) in alx_clean_tx_irq() argument
173 alx = netdev_priv(txq->netdev); in alx_clean_tx_irq()
174 tx_queue = alx_get_tx_queue(txq); in alx_clean_tx_irq()
176 sw_read_idx = txq->read_idx; in alx_clean_tx_irq()
177 hw_read_idx = alx_read_mem16(&alx->hw, txq->c_reg); in alx_clean_tx_irq()
183 skb = txq->bufs[sw_read_idx].skb; in alx_clean_tx_irq()
190 alx_free_txbuf(txq, sw_read_idx); in alx_clean_tx_irq()
192 if (++sw_read_idx == txq->count) in alx_clean_tx_irq()
195 txq->read_idx = sw_read_idx; in alx_clean_tx_irq()
201 alx_tpd_avail(txq) > txq->count / 4) in alx_clean_tx_irq()
306 if (np->txq) in alx_poll()
307 tx_complete = alx_clean_tx_irq(np->txq); in alx_poll()
460 if (np->txq) { in alx_init_ring_ptrs()
461 np->txq->read_idx = 0; in alx_init_ring_ptrs()
462 np->txq->write_idx = 0; in alx_init_ring_ptrs()
464 txring_header_reg[np->txq->queue_idx], in alx_init_ring_ptrs()
465 np->txq->tpd_dma); in alx_init_ring_ptrs()
489 static void alx_free_txring_buf(struct alx_tx_queue *txq) in alx_free_txring_buf() argument
493 if (!txq->bufs) in alx_free_txring_buf()
496 for (i = 0; i < txq->count; i++) in alx_free_txring_buf()
497 alx_free_txbuf(txq, i); in alx_free_txring_buf()
499 memset(txq->bufs, 0, txq->count * sizeof(struct alx_buffer)); in alx_free_txring_buf()
500 memset(txq->tpd, 0, txq->count * sizeof(struct alx_txd)); in alx_free_txring_buf()
501 txq->write_idx = 0; in alx_free_txring_buf()
502 txq->read_idx = 0; in alx_free_txring_buf()
504 netdev_tx_reset_queue(alx_get_tx_queue(txq)); in alx_free_txring_buf()
539 if (alx->qnapi[i] && alx->qnapi[i]->txq) in alx_free_buffers()
540 alx_free_txring_buf(alx->qnapi[i]->txq); in alx_free_buffers()
617 static int alx_alloc_tx_ring(struct alx_priv *alx, struct alx_tx_queue *txq, in alx_alloc_tx_ring() argument
620 txq->bufs = kcalloc(txq->count, sizeof(struct alx_buffer), GFP_KERNEL); in alx_alloc_tx_ring()
621 if (!txq->bufs) in alx_alloc_tx_ring()
624 txq->tpd = alx->descmem.virt + offset; in alx_alloc_tx_ring()
625 txq->tpd_dma = alx->descmem.dma + offset; in alx_alloc_tx_ring()
626 offset += sizeof(struct alx_txd) * txq->count; in alx_alloc_tx_ring()
674 offset = alx_alloc_tx_ring(alx, alx->qnapi[i]->txq, offset); in alx_alloc_rings()
697 if (alx->qnapi[i] && alx->qnapi[i]->txq) in alx_free_rings()
698 kfree(alx->qnapi[i]->txq->bufs); in alx_free_rings()
721 kfree(np->txq); in alx_free_napis()
743 struct alx_tx_queue *txq; in alx_alloc_napis() local
762 txq = kzalloc(sizeof(*txq), GFP_KERNEL); in alx_alloc_napis()
763 if (!txq) in alx_alloc_napis()
766 np->txq = txq; in alx_alloc_napis()
767 txq->p_reg = tx_pidx_reg[i]; in alx_alloc_napis()
768 txq->c_reg = tx_cidx_reg[i]; in alx_alloc_napis()
769 txq->queue_idx = i; in alx_alloc_napis()
770 txq->count = alx->tx_ringsz; in alx_alloc_napis()
771 txq->netdev = alx->dev; in alx_alloc_napis()
772 txq->dev = &alx->hw.pdev->dev; in alx_alloc_napis()
868 if (np->txq && np->rxq) in alx_request_msix()
870 np->txq->queue_idx); in alx_request_msix()
871 else if (np->txq) in alx_request_msix()
873 np->txq->queue_idx); in alx_request_msix()
1461 static int alx_map_tx_skb(struct alx_tx_queue *txq, struct sk_buff *skb) in alx_map_tx_skb() argument
1465 int maplen, f, first_idx = txq->write_idx; in alx_map_tx_skb()
1467 first_tpd = &txq->tpd[txq->write_idx]; in alx_map_tx_skb()
1471 if (++txq->write_idx == txq->count) in alx_map_tx_skb()
1472 txq->write_idx = 0; in alx_map_tx_skb()
1474 tpd = &txq->tpd[txq->write_idx]; in alx_map_tx_skb()
1481 dma = dma_map_single(txq->dev, skb->data, maplen, in alx_map_tx_skb()
1483 if (dma_mapping_error(txq->dev, dma)) in alx_map_tx_skb()
1486 dma_unmap_len_set(&txq->bufs[txq->write_idx], size, maplen); in alx_map_tx_skb()
1487 dma_unmap_addr_set(&txq->bufs[txq->write_idx], dma, dma); in alx_map_tx_skb()
1495 if (++txq->write_idx == txq->count) in alx_map_tx_skb()
1496 txq->write_idx = 0; in alx_map_tx_skb()
1497 tpd = &txq->tpd[txq->write_idx]; in alx_map_tx_skb()
1502 dma = skb_frag_dma_map(txq->dev, frag, 0, in alx_map_tx_skb()
1504 if (dma_mapping_error(txq->dev, dma)) in alx_map_tx_skb()
1506 dma_unmap_len_set(&txq->bufs[txq->write_idx], size, maplen); in alx_map_tx_skb()
1507 dma_unmap_addr_set(&txq->bufs[txq->write_idx], dma, dma); in alx_map_tx_skb()
1515 txq->bufs[txq->write_idx].skb = skb; in alx_map_tx_skb()
1517 if (++txq->write_idx == txq->count) in alx_map_tx_skb()
1518 txq->write_idx = 0; in alx_map_tx_skb()
1524 while (f != txq->write_idx) { in alx_map_tx_skb()
1525 alx_free_txbuf(txq, f); in alx_map_tx_skb()
1526 if (++f == txq->count) in alx_map_tx_skb()
1533 struct alx_tx_queue *txq) in alx_start_xmit_ring() argument
1539 alx = netdev_priv(txq->netdev); in alx_start_xmit_ring()
1541 if (alx_tpd_avail(txq) < alx_tpd_req(skb)) { in alx_start_xmit_ring()
1542 netif_tx_stop_queue(alx_get_tx_queue(txq)); in alx_start_xmit_ring()
1546 first = &txq->tpd[txq->write_idx]; in alx_start_xmit_ring()
1555 if (alx_map_tx_skb(txq, skb) < 0) in alx_start_xmit_ring()
1558 netdev_tx_sent_queue(alx_get_tx_queue(txq), skb->len); in alx_start_xmit_ring()
1562 alx_write_mem16(&alx->hw, txq->p_reg, txq->write_idx); in alx_start_xmit_ring()
1564 if (alx_tpd_avail(txq) < txq->count / 8) in alx_start_xmit_ring()
1565 netif_tx_stop_queue(alx_get_tx_queue(txq)); in alx_start_xmit_ring()