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 8D38BA0C4B; Tue, 9 Nov 2021 05:40:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 540AD41143; Tue, 9 Nov 2021 05:39:52 +0100 (CET) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40081.outbound.protection.outlook.com [40.107.4.81]) by mails.dpdk.org (Postfix) with ESMTP id B1E3A4111D for ; Tue, 9 Nov 2021 05:39:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h0iPP0ZyYUs25p2/SY/UMeLBf+ui1/11hjnijm6Jo9VV6rf8QHadfbCIc5y1CKXSqHggBZOxdmYJpfOyOfNblPsOj8BCIUABr/Rw9FUamTxKzsOdjdFVlYwPgmCRz1kKtvcjlhqhaPIZJzie0VtsrC+DNES8qA1N0Kh05z8sgxyQiD0D5XuTDmed8pJBep8LgZXKM4749Jekc+iRNLd181G8lp7JC6El0jrC7C7uTUY7CnpgyoX/IVtxaD4PrZmZSwDPmQMa64Um5Qbt3q+ND+G7kRPBZ8YiWpRJsOPqW+7g7hIwYb3YyPzc4sqC7cwgOP5gyvEHFHEgh2KMY/nAew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7qmAqj9RSk0ONRz4ZwUPmrogx2yMaXy4CY1dBk6Pr7o=; b=Kl9N88XHS0REtnmzFtCxlIiBo1mNJUyHogt68uHtjaJTAoyXtoIf9741/gC1xPzTlzealM3f3Mlr3DvJ58qGYVAS5s3NDGhZmctTMgbBz4WTxt2sf6jXSxtDe1IjPU5vCqkGHBv0EHF3E7VGNkkbay1qG1BqLGHQMWZ0pq19kHDDulgcLNWWEDMW0kMhiO4zfr62iwlc30wbNCNkw1W9JKNzpp8sMxx0hHGiCPZw2TPmSNdL8hOE7JQ7wyNaUOWzHbmFb0o1zs7SVTltmOTa8DJgrUPtqdziv/N35YESJFacXjia7Zg6L7cOUuEIrdGtDMnha31tmIRCA/DZZssK2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7qmAqj9RSk0ONRz4ZwUPmrogx2yMaXy4CY1dBk6Pr7o=; b=U0aDeU6UBYYaFfIE5dyIgJZjHucEql8N03k4z0SM6AC+2yC5t1kd9uDr+oNVtSVfDv0gfYuK9AZke716I5Mj6edM07GhtazLxZ4Osdma+ShJvzCFQe+LSEyX4SV8U1+5XZIjto8NAO5oROm3m5utFZoHTw7z8GZdSVdDMmAFT9g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB6960.eurprd04.prod.outlook.com (2603:10a6:803:12d::10) by VI1PR04MB5630.eurprd04.prod.outlook.com (2603:10a6:803:e6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Tue, 9 Nov 2021 04:39:48 +0000 Received: from VI1PR04MB6960.eurprd04.prod.outlook.com ([fe80::11d9:6f32:90e:80c1]) by VI1PR04MB6960.eurprd04.prod.outlook.com ([fe80::11d9:6f32:90e:80c1%7]) with mapi id 15.20.4669.016; Tue, 9 Nov 2021 04:39:48 +0000 From: Gagandeep Singh To: dev@dpdk.org Cc: nipun.gupta@nxp.com, thomas@monjalon.net, Gagandeep Singh Date: Tue, 9 Nov 2021 10:09:10 +0530 Message-Id: <20211109043910.4016824-6-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109043910.4016824-1-g.singh@nxp.com> References: <20211108090704.3585175-2-g.singh@nxp.com> <20211109043910.4016824-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2P153CA0002.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::16) To VI1PR04MB6960.eurprd04.prod.outlook.com (2603:10a6:803:12d::10) MIME-Version: 1.0 Received: from lsv03457.swis.in-blr01.nxp.com (14.142.151.118) by SI2P153CA0002.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.5 via Frontend Transport; Tue, 9 Nov 2021 04:39:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ba02083-93d9-4b75-2849-08d9a33af64b X-MS-TrafficTypeDiagnostic: VI1PR04MB5630: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mjwoAYJi+rRasdg8BgV9ssF3MOfVxDxgiIck3ROE9iqLFF2GBu9s2RDN3e36X2ia2YZ2UUtoA1pRHC2/Gm/0UOLChIrzJGLXfZ2xD5qH0wQeUGjY2r60FkqTglqF/1aA5If9QibLftIpJzcwp1EDmHh3gLriqYBie16flCABjmWgMJKq53lVrIax6UC1C/7cHoLRSDSwXjryLZy4S4M3FgYGFlkzGk4v79jb5s2WCX65zGZr027Fy/N6Nd3agihKA0Xu/3GE2h5h5vLp5Uzpb9U2RwiQa/ImU0MzsYeFLLLtgri5adZIvdQ+RRbfUS4zw6kN2TpeWXhchskh2j0gGXR0B3SJB56n0FOtW6IHpJBNFea+4IfaeH3BgCNI0d5gLVrtW2srSvx3eUGsMIhzC2iHQEgJQ14u5JV7bGMKoAtc4mcnvPJpOxmtf8ZrIYKXgdQQEcOkEiEv0SuGSsRJQLdJiQGft8UE95wVMJXZO4XCCwgY8Kuke/I1/HAa51vOaYJvRY8bDCVFIM+NlAasLfsSbzpxMZk9IzXBXZ83BmpCPxZZ19zi0Q85w8dO06f8wi1b8tSFl6G7Mja0p5pU/fYSS2fyUSf4Y+Iuajv68FFjOMESOn80zReFXSe+2wH7WPqqr354CHCPmmA0I7CfEIwoJp/Wz2ryLoHh7BH/EffIcuDFPt5hxietOGCGxCVm3Rc4ScMdOQpzqsjm1KGnDWplsEAVHR4+F/7jW6X5iBQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB6960.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(55236004)(1006002)(6666004)(66946007)(26005)(52116002)(7696005)(186003)(316002)(508600001)(1076003)(66556008)(2616005)(5660300002)(66476007)(8936002)(86362001)(956004)(4326008)(6916009)(2906002)(38350700002)(8676002)(36756003)(6486002)(83380400001)(38100700002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zUU/qiRrkGBrvh/aS0bHYh1aPkG2Fz8VeD7u5fXTOGJ+Lkau3gEeb9cJw93Z?= =?us-ascii?Q?0UBCIYU10IRXBwZQ17dtagN8RYphgGC/1+oV6oVPdT+K+oH2jn0dz+jQP3V/?= =?us-ascii?Q?lRkdLh7sKTK5J572wfTb12zCDoXZwFMQn/OLArCZ3lJsbW+gCGx50a9Hf9WY?= =?us-ascii?Q?1+jOSFTq8f+KuZ+TSBy0IXUgxtq48pMXEsrVTNfoxksyBJPVVLrKNQhfJ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NmHfqx6WHEjxouDeijbRbgbWkEufvxS?= =?us-ascii?Q?M2eMiRV6+GjVYnKkyG+wzVzc58PdwZin1wc6hFAx6aNC+Yw7W+pmDhGeFxyo?= =?us-ascii?Q?5sVi6RBmvaeXmgTIx28VzWCjPgX2XTuA5DygRd7zHQ8pNmwvAr0c3F/itVaF?= =?us-ascii?Q?OksC6d0zlw7TyhLiaHymeAZPPeQCvW1aImIYM07Na2ncYbXSDsWNCjH29F0A?= =?us-ascii?Q?BZmAo8vnTdIYhwPH3rT5qi4ARqi60cL+8iH7QWPu6vV3BKVGiySuL8t4dt7Z?= =?us-ascii?Q?8OSLn/Gy16ga8HiuVU98CRAtHHLjAkEkUrjJ0V/LeQyhmJ00wOoy1Klmm+tG?= =?us-ascii?Q?gkkiiRUieFCUandnb1etUZAAnurm+spl8KNi+0a/MYW0A1p2JLZvX4DliW8i?= =?us-ascii?Q?GMMX8ciA5/J45juwgVQKw1b9fnkGpup6H0ZV20aDggmnkA+mXUEoYQOlHqPF?= =?us-ascii?Q?mLdhGl0G931w6A2t4VM=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ba02083-93d9-4b75-2849-08d9a33af64b X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB6960.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2021 04:39:48.7626 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ovxLciUiQrxBGUgYuHoJZ21vFOuIq7C2PsGfV16mARwhxXH/NnJ23Ku5Yy+g1Jpt X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5630 Subject: [dpdk-dev] [PATCH v4 5/5] dma/dpaa: support statistics 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 Sender: "dev" This patch support DMA read and reset statistics operations Signed-off-by: Gagandeep Singh --- doc/guides/dmadevs/dpaa.rst | 1 + drivers/dma/dpaa/dpaa_qdma.c | 51 +++++++++++++++++++++++++++++++++++- drivers/dma/dpaa/dpaa_qdma.h | 1 + 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/doc/guides/dmadevs/dpaa.rst b/doc/guides/dmadevs/dpaa.rst index 4fbd8a25fb..7d51c8c4cd 100644 --- a/doc/guides/dmadevs/dpaa.rst +++ b/doc/guides/dmadevs/dpaa.rst @@ -57,6 +57,7 @@ The DPAA DMA implements following features in the dmadev API: - Supports DMA silent mode. - Supports issuing DMA of data within memory without hogging CPU while performing DMA operation. +- support statistics Platform Requirement ~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index ebe6211f08..cb272c700f 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -319,7 +319,7 @@ static struct fsl_qdma_queue queue_temp->count = 0; queue_temp->pending = 0; queue_temp->virt_head = queue_temp->cq; - + queue_temp->stats = (struct rte_dma_stats){0}; } } return queue_head; @@ -619,6 +619,9 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, reg = qdma_readl_be(block + FSL_QDMA_BCQMR(fsl_queue->id)); reg |= FSL_QDMA_BCQMR_EI_BE; qdma_writel_be(reg, block + FSL_QDMA_BCQMR(fsl_queue->id)); + fsl_queue->stats.submitted++; + } else { + fsl_queue->pending++; } return fsl_comp->index; } @@ -754,6 +757,7 @@ dpaa_qdma_submit(void *dev_private, uint16_t vchan) reg |= FSL_QDMA_BCQMR_EI_BE; qdma_writel_be(reg, block + FSL_QDMA_BCQMR(fsl_queue->id)); fsl_queue->pending--; + fsl_queue->stats.submitted++; } return 0; @@ -793,6 +797,9 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, void *block; int intr; void *status = fsl_qdma->status_base; + struct fsl_qdma_chan *fsl_chan = + &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; intr = qdma_readl_be(status + FSL_QDMA_DEDR); if (intr) { @@ -812,6 +819,7 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, qdma_writel(0xffffffff, status + FSL_QDMA_DEDR); intr = qdma_readl(status + FSL_QDMA_DEDR); + fsl_queue->stats.errors++; } block = fsl_qdma->block_base + @@ -819,6 +827,7 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, last_idx, st); + fsl_queue->stats.completed += intr; return intr; } @@ -834,6 +843,9 @@ dpaa_qdma_dequeue(void *dev_private, void *block; int intr; void *status = fsl_qdma->status_base; + struct fsl_qdma_chan *fsl_chan = + &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; intr = qdma_readl_be(status + FSL_QDMA_DEDR); if (intr) { @@ -854,6 +866,7 @@ dpaa_qdma_dequeue(void *dev_private, status + FSL_QDMA_DEDR); intr = qdma_readl(status + FSL_QDMA_DEDR); *has_error = true; + fsl_queue->stats.errors++; } block = fsl_qdma->block_base + @@ -861,16 +874,52 @@ dpaa_qdma_dequeue(void *dev_private, intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, last_idx, NULL); + fsl_queue->stats.completed += intr; return intr; } +static int +dpaa_qdma_stats_get(const struct rte_dma_dev *dmadev, uint16_t vchan, + struct rte_dma_stats *rte_stats, uint32_t size) +{ + struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; + struct fsl_qdma_chan *fsl_chan = + &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + struct rte_dma_stats *stats = &fsl_queue->stats; + + if (size < sizeof(rte_stats)) + return -EINVAL; + if (rte_stats == NULL) + return -EINVAL; + + *rte_stats = *stats; + + return 0; +} + +static int +dpaa_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan) +{ + struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; + struct fsl_qdma_chan *fsl_chan = + &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + + fsl_queue->stats = (struct rte_dma_stats){0}; + + return 0; +} + static struct rte_dma_dev_ops dpaa_qdma_ops = { .dev_info_get = dpaa_info_get, .dev_configure = dpaa_qdma_configure, .dev_start = dpaa_qdma_start, .dev_close = dpaa_qdma_close, .vchan_setup = dpaa_qdma_queue_setup, + .stats_get = dpaa_qdma_stats_get, + .stats_reset = dpaa_qdma_stats_reset, }; static int diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 6d0ac58317..bf49b2d5d9 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -210,6 +210,7 @@ struct fsl_qdma_queue { u32 pending; struct fsl_qdma_format *cq; void *block_base; + struct rte_dma_stats stats; }; struct fsl_qdma_comp { -- 2.25.1