diff mbox series

[RFC,18/29] net/qdma: add Tx queue reclaim routine

Message ID 20220706075219.517046-19-aman.kumar@vvdntech.in (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers show
Series cover letter for net/qdma PMD | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Aman Kumar July 6, 2022, 7:52 a.m. UTC
define function for dev->tx_done_cleanup for
net_qdma PMD.

Signed-off-by: Aman Kumar <aman.kumar@vvdntech.in>
---
 drivers/net/qdma/qdma_devops.c |  8 --------
 drivers/net/qdma/qdma_rxtx.c   | 28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/qdma/qdma_devops.c b/drivers/net/qdma/qdma_devops.c
index 10d7d67b87..12391790f0 100644
--- a/drivers/net/qdma/qdma_devops.c
+++ b/drivers/net/qdma/qdma_devops.c
@@ -1717,14 +1717,6 @@  qdma_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 	qinfo->nb_desc = txq->nb_tx_desc - 1;
 }
 
-int qdma_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)
-{
-	(void)tx_queue;
-	(void)free_cnt;
-
-	return 0;
-}
-
 static struct eth_dev_ops qdma_eth_dev_ops = {
 	.dev_configure            = qdma_dev_configure,
 	.dev_infos_get            = qdma_dev_infos_get,
diff --git a/drivers/net/qdma/qdma_rxtx.c b/drivers/net/qdma/qdma_rxtx.c
index 1605c9973c..6842203ada 100644
--- a/drivers/net/qdma/qdma_rxtx.c
+++ b/drivers/net/qdma/qdma_rxtx.c
@@ -531,6 +531,34 @@  qdma_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
 	return RTE_ETH_RX_DESC_AVAIL;
 }
 
+/**
+ * DPDK callback to request the driver to free mbufs
+ * currently cached by the driver.
+ *
+ * @param tx_queue
+ *   Pointer to Tx queue specific data structure.
+ * @param free_cnt
+ *   Maximum number of packets to free. Use 0 to indicate all possible packets
+ *   should be freed. Note that a packet may be using multiple mbufs.
+ *
+ * @return
+ *   Failure: < 0
+ *   Success: >= 0
+ *     0-n: Number of packets freed. More packets may still remain in ring that
+ *     are in use.
+ */
+int
+qdma_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)
+{
+	struct qdma_tx_queue *txq = tx_queue;
+
+	if ((uint16_t)free_cnt >= (txq->nb_tx_desc - 1))
+		return -EINVAL;
+
+	/* Free transmitted mbufs back to pool */
+	return reclaim_tx_mbuf(txq, txq->wb_status->cidx, free_cnt);
+}
+
 /* Transmit API for Streaming mode */
 uint16_t qdma_xmit_pkts_st(struct qdma_tx_queue *txq, struct rte_mbuf **tx_pkts,
 			uint16_t nb_pkts)