From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BD9ADA00C4; Thu, 5 May 2022 09:31:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22EFF42842; Thu, 5 May 2022 09:31:18 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 3211D42821 for ; Thu, 5 May 2022 09:31:13 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 1021F2001F7; Thu, 5 May 2022 09:31:13 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id CDBD52001B8; Thu, 5 May 2022 09:31:12 +0200 (CEST) Received: from lsv03274.swis.in-blr01.nxp.com (lsv03274.swis.in-blr01.nxp.com [92.120.147.114]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id D3C0D180031B; Thu, 5 May 2022 15:31:11 +0800 (+08) 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 Subject: [PATCH v2 6/6] dma/dpaa2: support statistics Date: Thu, 5 May 2022 13:01:08 +0530 Message-Id: <20220505073108.17112-7-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220505073108.17112-1-nipun.gupta@nxp.com> References: <20220421123054.22442-1-nipun.gupta@nxp.com> <20220505073108.17112-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Nipun Gupta This patch support DMA read and reset statistics operations. Signed-off-by: Nipun Gupta --- drivers/dma/dpaa2/dpaa2_qdma.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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