From patchwork Mon Jul 22 16:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142634 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF7DD45683; Mon, 22 Jul 2024 18:41:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AC6640EAB; Mon, 22 Jul 2024 18:40:16 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013030.outbound.protection.outlook.com [52.101.67.30]) by mails.dpdk.org (Postfix) with ESMTP id 18D6F40E43 for ; Mon, 22 Jul 2024 18:40:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ByoNqZV/w8bY/5rKH0cITIuW4V0g3PD4d/Dv4KsT72EebiEoeGksH1Adc4FXmDyaRLHGxOO08qbus35azBBpFEGJz7im6L1mkl66qq81kOTW3gpk1eeu5py4tCKr7kO9bZVOemjZt9gnKXxYNqsFpQtUmqMlJ3xrRFBdvG0E2QMmLCZFaUXKxSr7naYXe0dB1yXk7BhJLfQSV8lFGYn9GOMgL4KtIa+YlHHoDcYLWjqxRvAOjUamQsERUP0ZMoztQpF8wWWnXfVJlA4MFQB10oSi+kfDAlhfAWxXjMWZp1ogyPX+ix6ngWhePehK7BVAxAXeaK0N/Ow+oZrN5uFbQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=LyPst23F4dEFabeUjgji3XsXEmmbpjjOKbMsaEAw1ng=; b=APZlLACh2P/GgdE9Q3PqvFjR8MHoNODvxcoTdJMZTyfUVBdtKJfhV4hhdWpTYvxj4apFDeNAT8Hblag/xVVYxmlzt9pSmDWpa48XegIxcczghOuVaoWIwoh1ccMsK5o8VRMyjrFpp1kwG4dFX45QdrSCnf6HPv10bS9pj5H14tDqZ+dWLItO+KSP9etmSoVLPP5f8I6nNNSjwAdMihNW4SpVXksSoNc0EPc3UK4W2jGBJAqPqBT8u26Vu6u67Pgg5Lvob41hnJhk5rJ5hLkOapN7tkv+PpFhSDsgxWLT50WMDUal/y6yVY+v3YmOTHwiB6MAuCNv5c1nb3mDhdJNrw== 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=LyPst23F4dEFabeUjgji3XsXEmmbpjjOKbMsaEAw1ng=; b=Wf05zbWXr1qL+4D1P6Rau1IzXYbm7pBXypueZL4gQaD/khFa5dEQ9+1KihLOgDoOb3xPekwoDkYsPDuyjKMx+z9fhNcv2ReDR6gbmlCrsZeTOxTEK05sbC8nWAZBjpk+cHKBdlPVHeF5xMZsKsH3E781kxRbvgoJZYcJhAT0xwQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by PA1PR04MB10652.eurprd04.prod.outlook.com (2603:10a6:102:491::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Mon, 22 Jul 2024 16:40:13 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 16:40:12 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Vanshika Shukla Subject: [v3 15/30] dma/dpaa: add burst capacity API Date: Mon, 22 Jul 2024 22:09:15 +0530 Message-Id: <20240722163930.2171568-16-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722163930.2171568-1-g.singh@nxp.com> References: <20240722115843.1830105-1-g.singh@nxp.com> <20240722163930.2171568-1-g.singh@nxp.com> X-ClientProxiedBy: SG3P274CA0014.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::26) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|PA1PR04MB10652:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a2bb43c-3e85-4115-6d0f-08dcaa6cf53a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: n5s5eMxAgcwFkclhP2KxpNlchj1uFSWfMUAs5qBVgUAIWuqj66njW6hvHL1sAOiZmlC6gUJwzQKd+LoTfCya9CiAXTl+BjVntfZ9nlxZdpz5YtfqUJYi5GzzGbylVwLB3URtan61S6lL6DUNBma/XrOKkyKDXZX30hM+6NKkPVsBS8pj/5n0kfsFRn4fwUOCghLHaI3aTg8/5MCdKmk30uOk1mUnoCczCnGRB0k86y1jaoS6Fe1LkD5sKHMyVhfnd/ZVAy2pDu6wqZWYooKu2sNqluWQzaSU0ypEZ35btLjYyfTxx02Y8H7FhUT6vmm+oZOjNuVVvhVgGwGhQTlRyzUsMJs3og4Xy5bo5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X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WdmoVrV2xZe8BxwT+ALFy233DB5Cyi1R6RdExrnaUHDK/FWvMx568lm8Y9OG9aeZbw/8s8bFc7eUigQHxP5JgO/pRkg9c00zdF3Ayl88kxR6tYPxWGGgzu9gNnvxhAZ5K/LWYQkp552WCq4qOoem738wudToYLeX9KH9cFCg/uO83IytyV4B28OlMIRz9k9a2BzQnD1ep6GR1aVH3gybNIYa+kg3nw84kR1xAevkGWtcNlmiCF7FNodFaN/pdpk5lARBBnne3MIqsXT8KZAOBU32t/TvcuDVzdDESgEBp9B2+xGA0a63Cj1NoroUB5ej9yzMZOZdXeAVaKtVctVtXzy7yC85GtIfWmfuI9DnkI4QxbJuM+CiPW0s0bTDcpAWOS/iwvagEWAeXqIT5QqqxyfeekzcPaVRDShExa/k2ZuCO7fgd6Wn+FAfBLADU0eWZf1te+Xht82Nq5wwKbFQ3JLJiSVgbm15T/4M1JJi2TUY64sI9Bnpts1SeHmHP0XJtgrJV8rUWoYvw3bixw9uDd17bkABLv0h3fskTjg5Wqsj1JwRkwkPk1Nc4Z0Ga8+vtw0sSdDTGi9qCw4bAiuTQkeCEIb4e1Uwu3KUvy59PfgZygMwWth9N2usr44MdkTb8vra32doyHBqL+O9F2gFiT/bqCK0TL3aLE4EQlhzC+OoQ6nV8welr3Td7FL9Ma6GyV8+eENz172+bbQX+72HU8xQUSZFUMFMlC4yHNBd5g57ftcpV2vvl9EkcBQuxh6DaM14kkG7FAAdiRT/8xFMqxvfltupJYettm8CMpXZcQs/4F7kh6KOgTPRfDzrY8AdgkyUFoOIomXRiB5ADSGZhrARCEwzA8w641rybxXjL+caS3kgE6KdUEkhwlcNntLiCyyGBPkuKxPWq5TrPj2AhqzNpWTqfgsmVDFLMbqJfW6uRbMpwbaacRQJ4Xco4Dxov2fJj5S7e3TCcqkoF50gbLbVdAkyr64G7S7BmJjKj7NNozUs8qUCdsFcb9EKJsHyQYbFCbUntMj7rVSACTKDyeRe2HtvmTZQotjfsn7K3l7MbgLbWeBmB3DJ3YZP+JARF0gS0zxbY3MFZbIHiAluVDsaiM1pbLvqtoSBUScvAXvvXpASde8CHWIdRg5ugU1nYutzt8G9wRmJteyGLVW3CbajE162WeNzvKq/AYgB/gxXrKLr1F/avDbeZ368vYXXo28GjhhyZqT+U7l6bsxRhmWTSnGtatR0g0Ue7YYUbmhr9jSU0yzWeNPSpZeH0b6o+JOcdSUdtK3XRqzGWKOuxh0FF2NVnW5vpuXIWeIdFsrjATpsjruSUAoJ+5s6K4tKVy/waiBR1gYHtbJKpDFS6/ZMPBEeOYCBF28Acwnmqv5p81NNBkpoTQbBV6qb8WMvP7z9XJIMbdZnyn5NBugjjuzOmfuVKrHxvrYbptbVOATxFdrEj9SYkHkOtgTraGT+MWzm7phelzC7D+r7RJKovH7O3Z7qZmjX3UWToXjt1U3Uwzg3kKXHw+8DchEObCWo/n/cQP4ZIGqSKseKEZR0XBlJSrVuE2Gx6fZwLnYiyH7da/weiSEzDTdYrm90MIX3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a2bb43c-3e85-4115-6d0f-08dcaa6cf53a X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 16:40:12.8894 (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: uhmRwpU90dtr7KO9Kg2f5JS3CfwspDox5WE+KPp3suTYsiiuRsqM4oxM/O02QVvV X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10652 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: Vanshika Shukla This patch improves the dpaa qdma driver and adds dpaa_qdma_burst_capacity API which returns the remaining space in the descriptor ring. Signed-off-by: Vanshika Shukla --- drivers/dma/dpaa/dpaa_qdma.c | 34 +++++++++++++++++++++++++--------- drivers/dma/dpaa/dpaa_qdma.h | 3 +-- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 0a91cf040a..bb6b54e583 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -423,7 +423,6 @@ fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) static int fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, void *block, int id, const uint16_t nb_cpls, - uint16_t *last_idx, enum rte_dma_status_code *status) { struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue; @@ -457,7 +456,6 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, if (fsl_status->virt_head == fsl_status->cq + fsl_status->n_cq) fsl_status->virt_head = fsl_status->cq; qdma_writel_be(reg, block + FSL_QDMA_BSQMR); - *last_idx = fsl_comp->index; if (status != NULL) status[count] = RTE_DMA_STATUS_SUCCESSFUL; @@ -607,7 +605,6 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16); qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(fsl_comp->virt_addr)); qdma_ccdf_set_ser(ccdf, qdma_ccdf_get_status(fsl_comp->virt_addr)); - fsl_comp->index = fsl_queue->virt_head - fsl_queue->cq; fsl_queue->virt_head++; if (fsl_queue->virt_head == fsl_queue->cq + fsl_queue->n_cq) @@ -623,7 +620,7 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, } else { fsl_queue->pending++; } - return fsl_comp->index; + return 0; } static int @@ -771,8 +768,10 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; struct fsl_qdma_chan *fsl_chan = &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - int ret; + struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + int ret, idx; + idx = (uint16_t)(fsl_queue->stats.submitted + fsl_queue->pending); void *fsl_comp = NULL; fsl_comp = fsl_qdma_prep_memcpy(fsl_chan, @@ -783,8 +782,10 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, return -1; } ret = fsl_qdma_enqueue_desc(fsl_chan, fsl_comp, flags); + if (ret < 0) + return ret; - return ret; + return idx; } static uint16_t @@ -826,8 +827,10 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, - last_idx, st); + st); fsl_queue->stats.completed += intr; + if (last_idx != NULL) + *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); return intr; } @@ -873,9 +876,10 @@ dpaa_qdma_dequeue(void *dev_private, FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, - last_idx, NULL); + NULL); fsl_queue->stats.completed += intr; - + if (last_idx != NULL) + *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); return intr; } @@ -912,6 +916,17 @@ dpaa_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan) return 0; } +static uint16_t +dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) +{ + const struct fsl_qdma_engine *fsl_qdma = 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; + + return fsl_queue->n_cq - fsl_queue->pending; +} + static struct rte_dma_dev_ops dpaa_qdma_ops = { .dev_info_get = dpaa_info_get, .dev_configure = dpaa_qdma_configure, @@ -1035,6 +1050,7 @@ dpaa_qdma_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv, dmadev->fp_obj->submit = dpaa_qdma_submit; dmadev->fp_obj->completed = dpaa_qdma_dequeue; dmadev->fp_obj->completed_status = dpaa_qdma_dequeue_status; + dmadev->fp_obj->burst_capacity = dpaa_qdma_burst_capacity; /* Invoke PMD device initialization function */ ret = dpaa_qdma_init(dmadev); diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 7e9e76e21a..2092fb39f5 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2024 NXP */ #ifndef _DPAA_QDMA_H_ @@ -176,7 +176,6 @@ struct fsl_qdma_comp { dma_addr_t bus_addr; dma_addr_t desc_bus_addr; void *virt_addr; - int index; void *desc_virt_addr; struct fsl_qdma_chan *qchan; dma_call_back call_back_func;