DPDK patches and discussions
 help / color / mirror / Atom feed
From: nipun.gupta@nxp.com
To: dev@dpdk.org
Cc: thomas@monjalon.net, G.Singh@nxp.com, hemant.agrawal@nxp.com,
	gakhil@marvell.com, Nipun Gupta <nipun.gupta@nxp.com>
Subject: [PATCH v3 6/6] dma/dpaa2: support statistics
Date: Thu,  5 May 2022 14:35:22 +0530	[thread overview]
Message-ID: <20220505090522.9638-7-nipun.gupta@nxp.com> (raw)
In-Reply-To: <20220505090522.9638-1-nipun.gupta@nxp.com>

From: Nipun Gupta <nipun.gupta@nxp.com>

This patch support DMA read and reset statistics operations.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 doc/guides/dmadevs/dpaa2.rst   |  1 +
 drivers/dma/dpaa2/dpaa2_qdma.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/doc/guides/dmadevs/dpaa2.rst b/doc/guides/dmadevs/dpaa2.rst
index 0fad9fabe0..d2c26231e2 100644
--- a/doc/guides/dmadevs/dpaa2.rst
+++ b/doc/guides/dmadevs/dpaa2.rst
@@ -21,6 +21,7 @@ The DPAA2 QDMA implements following features in the dmadev API;
   performing DMA operation.
 - Supports configuring to optionally get status of the DMA translation on
   per DMA operation basis.
+- Supports statistics.
 
 Supported DPAA2 SoCs
 --------------------
diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c
index f1f92b5465..a93a60565d 100644
--- a/drivers/dma/dpaa2/dpaa2_qdma.c
+++ b/drivers/dma/dpaa2/dpaa2_qdma.c
@@ -1427,6 +1427,38 @@ dpaa2_qdma_close(__rte_unused struct rte_dma_dev *dev)
 	return 0;
 }
 
+static int
+dpaa2_qdma_stats_get(const struct rte_dma_dev *dmadev, uint16_t vchan,
+		    struct rte_dma_stats *rte_stats, uint32_t size)
+{
+	struct dpaa2_dpdmai_dev *dpdmai_dev = dmadev->data->dev_private;
+	struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev;
+	struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan];
+	struct rte_dma_stats *stats = &qdma_vq->stats;
+
+	RTE_SET_USED(size);
+
+	/* TODO - directly use stats */
+	stats->submitted = qdma_vq->num_enqueues;
+	stats->completed = qdma_vq->num_dequeues;
+	*rte_stats = *stats;
+
+	return 0;
+}
+
+static int
+dpaa2_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan)
+{
+	struct dpaa2_dpdmai_dev *dpdmai_dev = dmadev->data->dev_private;
+	struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev;
+	struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan];
+
+	qdma_vq->num_enqueues = 0;
+	qdma_vq->num_dequeues = 0;
+
+	return 0;
+}
+
 static uint16_t
 dpaa2_qdma_burst_capacity(const void *dev_private, uint16_t vchan)
 {
@@ -1444,6 +1476,8 @@ static struct rte_dma_dev_ops dpaa2_qdma_ops = {
 	.dev_stop         = dpaa2_qdma_stop,
 	.dev_close        = dpaa2_qdma_close,
 	.vchan_setup      = dpaa2_qdma_vchan_setup,
+	.stats_get        = dpaa2_qdma_stats_get,
+	.stats_reset      = dpaa2_qdma_stats_reset,
 };
 
 static int
-- 
2.17.1


  parent reply	other threads:[~2022-05-05  9:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 12:30 [PATCH 0/6] move DPAA2 QDMA driver freom raw to dma nipun.gupta
2022-04-21 12:30 ` [PATCH 1/6] raw/dpaa2_qdma: remove dpaa2 QDMA driver from raw nipun.gupta
2022-04-21 12:30 ` [PATCH 2/6] dma/dpaa2: introduce DPAA2 DMA driver skeleton nipun.gupta
2022-04-21 12:30 ` [PATCH 3/6] dma/dpaa2: support basic operations nipun.gupta
2022-04-21 12:30 ` [PATCH 4/6] dma/dpaa2: add PMD apis for additional configuration nipun.gupta
2022-04-21 12:30 ` [PATCH 5/6] dma/dpaa2: support DMA operations nipun.gupta
2022-04-21 12:30 ` [PATCH 6/6] dma/dpaa2: support statistics nipun.gupta
2022-05-05  7:31 ` [PATCH v2 0/6] move DPAA2 QDMA driver freom raw to dma nipun.gupta
2022-05-05  7:31   ` [PATCH v2 1/6] raw/dpaa2_qdma: remove dpaa2 QDMA driver from raw nipun.gupta
2022-05-05  7:31   ` [PATCH v2 2/6] dma/dpaa2: introduce DPAA2 DMA driver skeleton nipun.gupta
2022-05-05  7:31   ` [PATCH v2 3/6] dma/dpaa2: support basic operations nipun.gupta
2022-05-05  7:31   ` [PATCH v2 4/6] dma/dpaa2: add PMD apis for additional configuration nipun.gupta
2022-05-05  7:31   ` [PATCH v2 5/6] dma/dpaa2: support DMA operations nipun.gupta
2022-05-05  7:31   ` [PATCH v2 6/6] dma/dpaa2: support statistics nipun.gupta
2022-05-05  9:05 ` [PATCH v3 0/6] move DPAA2 QDMA driver freom raw to dma nipun.gupta
2022-05-05  9:05   ` [PATCH v3 1/6] raw/dpaa2_qdma: remove dpaa2 QDMA driver from raw nipun.gupta
2022-05-05  9:05   ` [PATCH v3 2/6] dma/dpaa2: introduce DPAA2 DMA driver skeleton nipun.gupta
2022-05-05  9:05   ` [PATCH v3 3/6] dma/dpaa2: support basic operations nipun.gupta
2022-05-05  9:05   ` [PATCH v3 4/6] dma/dpaa2: add PMD apis for additional configuration nipun.gupta
2022-05-05  9:05   ` [PATCH v3 5/6] dma/dpaa2: support DMA operations nipun.gupta
2022-05-05  9:05   ` nipun.gupta [this message]
2022-05-26  6:00   ` [PATCH v3 0/6] move DPAA2 QDMA driver freom raw to dma Hemant Agrawal
2022-05-31 15:29     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220505090522.9638-7-nipun.gupta@nxp.com \
    --to=nipun.gupta@nxp.com \
    --cc=G.Singh@nxp.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).