diff mbox series

[RFC,16/29] net/qdma: add start and stop apis

Message ID 20220706075219.517046-17-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
this patch implements definitions for dev_start
and dev_stop apis.

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

Patch

diff --git a/drivers/net/qdma/qdma_devops.c b/drivers/net/qdma/qdma_devops.c
index 5329bd3cd4..28de783207 100644
--- a/drivers/net/qdma/qdma_devops.c
+++ b/drivers/net/qdma/qdma_devops.c
@@ -865,8 +865,40 @@  void qdma_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t q_id)
  */
 int qdma_dev_start(struct rte_eth_dev *dev)
 {
-	(void)dev;
+	struct qdma_tx_queue *txq;
+	struct qdma_rx_queue *rxq;
+	uint32_t qid;
+	int err;
+
+	PMD_DRV_LOG(INFO, "qdma-dev-start: Starting\n");
+
+	/* prepare descriptor rings for operation */
+	for (qid = 0; qid < dev->data->nb_tx_queues; qid++) {
+		txq = (struct qdma_tx_queue *)dev->data->tx_queues[qid];
+
+		/* Deferred Queues should not start with dev_start */
+		if (!txq->tx_deferred_start) {
+			err = qdma_dev_tx_queue_start(dev, qid);
+			if (err != 0)
+				return err;
+		}
+	}
 
+	for (qid = 0; qid < dev->data->nb_rx_queues; qid++) {
+		rxq = (struct qdma_rx_queue *)dev->data->rx_queues[qid];
+
+		/* Deferred Queues should not start with dev_start */
+		if (!rxq->rx_deferred_start) {
+			err = qdma_dev_rx_queue_start(dev, qid);
+			if (err != 0)
+				return err;
+		}
+	}
+
+#if (MIN_TX_PIDX_UPDATE_THRESHOLD > 1)
+	rte_eal_alarm_set(QDMA_TXQ_PIDX_UPDATE_INTERVAL,
+			qdma_txq_pidx_update, (void *)dev);
+#endif
 	return 0;
 }
 
@@ -922,7 +954,24 @@  int qdma_dev_infos_get(struct rte_eth_dev *dev,
  */
 int qdma_dev_stop(struct rte_eth_dev *dev)
 {
-	(void)dev;
+	uint32_t qid;
+#ifdef RTE_LIBRTE_QDMA_DEBUG_DRIVER
+	struct qdma_pci_dev *qdma_dev = dev->data->dev_private;
+
+	PMD_DRV_LOG(INFO, "PF-%d(DEVFN) Stop H2C & C2H queues",
+			qdma_dev->func_id);
+#endif
+
+	/* reset driver's internal queue structures to default values */
+	for (qid = 0; qid < dev->data->nb_tx_queues; qid++)
+		qdma_dev_tx_queue_stop(dev, qid);
+	for (qid = 0; qid < dev->data->nb_rx_queues; qid++)
+		qdma_dev_rx_queue_stop(dev, qid);
+
+#if (MIN_TX_PIDX_UPDATE_THRESHOLD > 1)
+	/* Cancel pending PIDX updates */
+	rte_eal_alarm_cancel(qdma_txq_pidx_update, (void *)dev);
+#endif
 
 	return 0;
 }