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 D62C8A0C4B; Mon, 8 Nov 2021 10:08:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E5B941137; Mon, 8 Nov 2021 10:07:45 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150052.outbound.protection.outlook.com [40.107.15.52]) by mails.dpdk.org (Postfix) with ESMTP id 0B4B04111F for ; Mon, 8 Nov 2021 10:07:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HpBHiIKPQ+BeoR14i/IClNyUK4gVnymw8hziidQgTg1uj8N42vKPJFappZKurAOKhGW9Tk/PuFn/WySGQY5OTuxn0as72rHMNY5oXjsag9EkkLhC6N0oR40asknlr0ljTglzBrXDvsXGS907xfkrQ01ZUc1rzVVRr7EkgEFF/Bcm6hfvVjEND8fXTgTcr8O2ueC8IwnY66H+NuqdZ7vTCNItvQXoA3pKDpgRzLbzlTCJ1Fmg/TPHgifc6nAnjprsAxPc1oJ3OytZ9Fsc2iKTU/3Px4dd2MlZyV8RC0MwSVwSHVJhv8SwMSPmB9ez5HUwl7IuM22iPB7MPKusvrP1aw== 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=0rk3AohZA5xlc6wX+jPEFz7AkwQ9bfus9BNchYWto/8=; b=UPBnd6ap5j7Um6rWg6UQP2fyrzkxyXDUDhuj5Vb8whiDE6qMUQb+0zsuRtBwV1WDuKNkCsM/It3mOhM2s5w1fjr+YM0ll4ztuLtzJtr3oGpfroYuKE1Fyv+rcqMMFarN3Jd/rWyVleEkUbUvjsLrxA4lM2MPIyRJdq68TPyOaGp+nyCX0fcBLlD7uWY1CUZjaV8cCtkQNs8L1Za360Df/Ywd6lMFuFRpZr2InHTtaHSVjWsyp2RCL2rzP1qP32LDbA19W4yswTPqT1m3MiJlbnXzEkohSsfh3QXUu8yZd6GlBPjrrHyuG+CtCos+RjDx0k5LxApNSathPEP+qIkf/g== 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=0rk3AohZA5xlc6wX+jPEFz7AkwQ9bfus9BNchYWto/8=; b=OHLty3Twn98LejfWVEpNPKl+ZFXKTWCSq6/sIfK+0Za7nBXalr1vaCQvCDCCdUzedPIf8pDa+8ItThN9+h/9agwYWOP2XabWEIuqWyQkcBggvG4tcakObsUk94iviPpmDtKL2Btdrmz+TsUDR5qesTmKToNTUBdpJSY1cfkDKao= 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 VE1PR04MB6495.eurprd04.prod.outlook.com (2603:10a6:803:11d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Mon, 8 Nov 2021 09:07:39 +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; Mon, 8 Nov 2021 09:07:39 +0000 From: Gagandeep Singh To: dev@dpdk.org Cc: nipun.gupta@nxp.com, thomas@monjalon.net, Gagandeep Singh Date: Mon, 8 Nov 2021 14:37:03 +0530 Message-Id: <20211108090704.3585175-7-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108090704.3585175-1-g.singh@nxp.com> References: <20211101085143.2472241-2-g.singh@nxp.com> <20211108090704.3585175-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0077.apcprd02.prod.outlook.com (2603:1096:4:90::17) 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 SG2PR02CA0077.apcprd02.prod.outlook.com (2603:1096:4:90::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Mon, 8 Nov 2021 09:07:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8fdde9a-89f6-40e3-94bc-08d9a2973693 X-MS-TrafficTypeDiagnostic: VE1PR04MB6495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:186; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DZJlY3s28KivR0hYQUijb9b1hhuaphRlULQ1x5D40fsSfqd+kNMtGFqX2s6wx3PlHftXVJazywQn7lw5i/caNURVWMUUyyac38I7dN/6KWGDXaaLM0r6kCk0UaVrvbealvEvPljZFKsT2reH80WxNXFNMokL9aD9KLv0kThEczXPb7atNgqjrOJ/FT0Nr9gjJggg77EkEN+EhRKCeSXYZpZ0UemBU/y4Q1yQOL89Q+a5vvj0vs6uMYCp2w7xn/f0Lv3K4aIUzSvxahRbJ0qW5Im2hMukBgENOs8nylXcCab5j4ouz30mkAeRPGxADIrBcYAq0jcD++/8Gr+iWpm2TikATE/D/WtZrbahL3Vhq7xltMerWQUIdji0rmrB9qHFmKxDa2LnNWVA+V9uEShRQkvgomyd5ll1Y7sI9mVqe3a7rAzpSCcd+id2Mp3ucfM9FgZUrxD7+fDRBm/tDo3xEWddkCMTTTCYQNt9grqmyqfc6jmL6usH/Qhfn6I7w16NxJcwczCPIHZfxXq1rQFhd0OlppEUiYJLkoGiKKlGGBDk8ChekRvLg3YXMJ4M6DnwKdkgU6b4hZWWkmomg13/1FWq+tvPGuee+5+SN6y9CzR1kl4j+lt9Xi4F36g3GF54nHdGUSUyGoqalmhjMUQifX4jwT1Rw90MhM2mRCUhsQ7E4ZmfB1Y+O4IDFHaITKL53bwddTZWb7TM0hM2HkrRHIhhrMtpRc5yp2xVS3ALTJw= 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)(1006002)(8936002)(66556008)(5660300002)(6666004)(36756003)(26005)(55236004)(508600001)(2906002)(66476007)(38350700002)(38100700002)(8676002)(83380400001)(6916009)(1076003)(52116002)(7696005)(316002)(4326008)(956004)(186003)(2616005)(66946007)(6486002)(86362001)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?JG7QikESD6hChsGHvMAq7HlqWeSRk8LkKo12MXU2MRipPwBJsGGuthy3zpoM?= =?us-ascii?Q?pBtFaSzMnCZt53bBy+TnH7z5xb7FwmEedPpFOTKEXuT/OFhNkYk0WKYTE39O?= =?us-ascii?Q?w53wCL0T3sxUoqFhLhVw5Z08IhI05hmxiGAZZMlJsVRQPEW2Driqg3ai0865?= =?us-ascii?Q?pQHcAFrRpM3wvKE7tDXnVL47TsuxMWKYqL0avq+VFyI5ZxeiomHfcJWyXdG1?= =?us-ascii?Q?fRxcx3DiQy4jVHb+gU6zMjK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us-ascii?Q?QVypVgDVdm8UvB3nqWrBI5LNI1XYlN7an6VxrPlApWyAjiVcOq5hgo5phdEo?= =?us-ascii?Q?2mq7q0M2Wz8ZzohwTRTzfYZ7ZkjTt/0We2Mmf5s9xz7orG9zoaee3+KO+qAK?= =?us-ascii?Q?7wIQ5lIs2OtH5b7DRzB/zRVP/swx0X21nCWmw8UjjcL0uLhyp2q1+/oeMjho?= =?us-ascii?Q?W0c661nRGrLDmWg/QZFN//sSpQpqRhwBmL2IFJp5LtGwWMimJ/6odxOPUXNk?= =?us-ascii?Q?ksRZRNjzz8hLBPwv430ydgz/4o4qeZ4jMILMTfGZ1vpwHP+cFmG2UxnKSCL0?= =?us-ascii?Q?fnJbTsujNmNQS627jArzwxl/NPr5yXlZKC+X/TX5GvUt5GaaB6fxtfoGzprc?= =?us-ascii?Q?hNzUlr5I3oSsXaPugF9+pSQG+kFhCih3U0fFeVW/AR3QVZobsSDTQ77dH5hl?= =?us-ascii?Q?YIqi/tAuYr4GnCUCcfE=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8fdde9a-89f6-40e3-94bc-08d9a2973693 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB6960.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 09:07:39.1547 (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: Qr4FVvD2TjeK1M2hy12cp8BzwvXDDKokvPMSZpJYbesxYJTX0K+7Sp2rp/+oAEb0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6495 Subject: [dpdk-dev] [PATCH v3 6/7] 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 --- drivers/dma/dpaa/dpaa_qdma.c | 51 +++++++++++++++++++++++++++++++++++- drivers/dma/dpaa/dpaa_qdma.h | 1 + 2 files changed, 51 insertions(+), 1 deletion(-) 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