From: Anoob Joseph <anoobj@marvell.com>
To: Chengwen Feng <fengchengwen@huawei.com>,
Kevin Laatz <kevin.laatz@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
"Jerin Jacob" <jerinj@marvell.com>,
Thomas Monjalon <thomas@monjalon.net>
Cc: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
"Vidya Sagar Velumuri" <vvelumuri@marvell.com>, <dev@dpdk.org>
Subject: [PATCH v3 5/7] dma/odm: add stats
Date: Fri, 19 Apr 2024 12:13:17 +0530 [thread overview]
Message-ID: <20240419064319.149-6-anoobj@marvell.com> (raw)
In-Reply-To: <20240419064319.149-1-anoobj@marvell.com>
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Add DMA dev stats.
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
drivers/dma/odm/odm_dmadev.c | 63 ++++++++++++++++++++++++++++++++++--
1 file changed, 61 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/odm/odm_dmadev.c b/drivers/dma/odm/odm_dmadev.c
index 8c705978fe..13b2588246 100644
--- a/drivers/dma/odm/odm_dmadev.c
+++ b/drivers/dma/odm/odm_dmadev.c
@@ -87,14 +87,73 @@ odm_dmadev_close(struct rte_dma_dev *dev)
return 0;
}
+static int
+odm_stats_get(const struct rte_dma_dev *dev, uint16_t vchan, struct rte_dma_stats *rte_stats,
+ uint32_t size)
+{
+ struct odm_dev *odm = dev->fp_obj->dev_private;
+
+ if (size < sizeof(rte_stats))
+ return -EINVAL;
+ if (rte_stats == NULL)
+ return -EINVAL;
+
+ if (vchan != RTE_DMA_ALL_VCHAN) {
+ struct rte_dma_stats *stats = (struct rte_dma_stats *)&odm->vq[vchan].stats;
+
+ *rte_stats = *stats;
+ } else {
+ int i;
+
+ for (i = 0; i < odm->num_qs; i++) {
+ struct rte_dma_stats *stats = (struct rte_dma_stats *)&odm->vq[i].stats;
+
+ rte_stats->submitted += stats->submitted;
+ rte_stats->completed += stats->completed;
+ rte_stats->errors += stats->errors;
+ }
+ }
+
+ return 0;
+}
+
+static void
+odm_vq_stats_reset(struct vq_stats *vq_stats)
+{
+ vq_stats->completed_offset += vq_stats->completed;
+ vq_stats->completed = 0;
+ vq_stats->errors = 0;
+ vq_stats->submitted = 0;
+}
+
+static int
+odm_stats_reset(struct rte_dma_dev *dev, uint16_t vchan)
+{
+ struct odm_dev *odm = dev->fp_obj->dev_private;
+ struct vq_stats *vq_stats;
+ int i;
+
+ if (vchan != RTE_DMA_ALL_VCHAN) {
+ vq_stats = &odm->vq[vchan].stats;
+ odm_vq_stats_reset(vq_stats);
+ } else {
+ for (i = 0; i < odm->num_qs; i++) {
+ vq_stats = &odm->vq[i].stats;
+ odm_vq_stats_reset(vq_stats);
+ }
+ }
+
+ return 0;
+}
+
static const struct rte_dma_dev_ops odm_dmadev_ops = {
.dev_close = odm_dmadev_close,
.dev_configure = odm_dmadev_configure,
.dev_info_get = odm_dmadev_info_get,
.dev_start = odm_dmadev_start,
.dev_stop = odm_dmadev_stop,
- .stats_get = NULL,
- .stats_reset = NULL,
+ .stats_get = odm_stats_get,
+ .stats_reset = odm_stats_reset,
.vchan_setup = odm_dmadev_vchan_setup,
};
--
2.25.1
next prev parent reply other threads:[~2024-04-19 6:44 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 15:31 [PATCH 0/8] Add ODM DMA device Anoob Joseph
2024-04-15 15:31 ` [PATCH 1/8] usertools/devbind: add " Anoob Joseph
2024-04-15 15:31 ` [PATCH 2/8] dma/odm: add framework for " Anoob Joseph
2024-04-15 15:31 ` [PATCH 3/8] dma/odm: add hardware defines Anoob Joseph
2024-04-15 15:31 ` [PATCH 4/8] dma/odm: add dev init and fini Anoob Joseph
2024-04-15 15:31 ` [PATCH 5/8] dma/odm: add device ops Anoob Joseph
2024-04-15 15:31 ` [PATCH 6/8] dma/odm: add stats Anoob Joseph
2024-04-15 15:31 ` [PATCH 7/8] dma/odm: add copy and copy sg ops Anoob Joseph
2024-04-15 15:31 ` [PATCH 8/8] dma/odm: add remaining ops Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 0/7] Add ODM DMA device Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 1/7] dma/odm: add framework for " Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 2/7] dma/odm: add hardware defines Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 3/7] dma/odm: add dev init and fini Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 4/7] dma/odm: add device ops Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 5/7] dma/odm: add stats Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 6/7] dma/odm: add copy and copy sg ops Anoob Joseph
2024-04-17 7:27 ` [PATCH v2 7/7] dma/odm: add remaining ops Anoob Joseph
2024-04-19 6:43 ` [PATCH v3 0/7] Add ODM DMA device Anoob Joseph
2024-04-19 6:43 ` [PATCH v3 1/7] dma/odm: add framework for " Anoob Joseph
2024-05-24 13:26 ` Jerin Jacob
2024-04-19 6:43 ` [PATCH v3 2/7] dma/odm: add hardware defines Anoob Joseph
2024-05-24 13:29 ` Jerin Jacob
2024-04-19 6:43 ` [PATCH v3 3/7] dma/odm: add dev init and fini Anoob Joseph
2024-04-19 6:43 ` [PATCH v3 4/7] dma/odm: add device ops Anoob Joseph
2024-05-24 13:37 ` Jerin Jacob
2024-04-19 6:43 ` Anoob Joseph [this message]
2024-04-19 6:43 ` [PATCH v3 6/7] dma/odm: add copy and copy sg ops Anoob Joseph
2024-04-19 6:43 ` [PATCH v3 7/7] dma/odm: add remaining ops Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 0/7] Add ODM DMA device Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 1/7] dma/odm: add framework for " Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 2/7] dma/odm: add hardware defines Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 3/7] dma/odm: add dev init and fini Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 4/7] dma/odm: add device ops Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 5/7] dma/odm: add stats Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 6/7] dma/odm: add copy and copy sg ops Anoob Joseph
2024-05-27 15:16 ` [PATCH v4 7/7] dma/odm: add remaining ops Anoob Joseph
2024-05-28 8:12 ` [PATCH v4 0/7] Add ODM DMA device Jerin Jacob
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=20240419064319.149-6-anoobj@marvell.com \
--to=anoobj@marvell.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=gmuthukrishn@marvell.com \
--cc=jerinj@marvell.com \
--cc=kevin.laatz@intel.com \
--cc=thomas@monjalon.net \
--cc=vvelumuri@marvell.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.