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 9F5534564F; Fri, 19 Jul 2024 12:04:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A22D42EAE; Fri, 19 Jul 2024 12:02:36 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012026.outbound.protection.outlook.com [52.101.66.26]) by mails.dpdk.org (Postfix) with ESMTP id 229EE42ED7 for ; Fri, 19 Jul 2024 12:02:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dWgjTtQwvJNJS6Q/N1a6iKafKBnY/VZRJivizw4XYF4pDc1zUfejC7Hm6fnt/N3GBO9Brj71sxxD23C+bxcWYOPq14Xjr3nCBbE57+rtWdhQGd/rTHs5sqvCNxoZ0ss50wAwFmWtcInK3M1IFx/Cir9FUgnbND7dQoJ6e0q/e9onqHm4EIOi2CZMakqCoKCccN+c4GIWdIMuuuHtBkyK5aOSgEevPGfnQCrL11fdm6jcHT4nmpH4SYOyXOKZCSZmBXWwittOl9hWa9Cg+rOcVwq+vRsPhkzmNk/cEJWdgrMCsS51OTwLXpKxNy9mx35jLFG+xkr3OaUj0p2nmmT5Ag== 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=+XcO3OP/E+p7Ng/w3JYVj2muZmSHafPtv85pEYQ0dJE=; b=drIf79Z8jdU7xuIiIS/Sxx4QW7MsskIH0LcKTsOqeTkyVIY1zB+KgJm5mxzo+yXAdI7kyDMaDuMYz8oe1Y1t62WHNh5Xu3OlmFl5gHmv3DpVIb2zVruj4uNwP6cAgy+OGC5Sa1NSctNY+GfwmCEPS2JNh+QCLLpS+J+ucAptG4VjZfsBOoUFOVKPqoqiHE9BuLcxCIGZQplwTzt4LQlSnrJNevQyN1MRsUE1qZ8T4FMrBACRuLgY1cUWkLWCf1pXOw3fMfr0lA4UMr5wbFTPqZp0zVydHLJ0xDq1fejyzRYO3rE2J181Be4PeBODohvS6HrP2bALWg/OvTG0HX72JQ== 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=+XcO3OP/E+p7Ng/w3JYVj2muZmSHafPtv85pEYQ0dJE=; b=R1EZglgm2HzDmj8jY1vOLWx/ayx1SYPbTXkesQGKLxvYz21/5+P0mzjHDt54Dqy9LrozPoXUYL7j85QJVU7jgBuGzrR0uQsKxDHKwpSlaTA1q1LSpSXleWkY7sE2wUwG2x7ifUvfwi9qQOeQmzR5bTjrkHq4pkeABXUEL6vMMwY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by DB9PR04MB8345.eurprd04.prod.outlook.com (2603:10a6:10:246::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.19; Fri, 19 Jul 2024 10:02:20 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%6]) with mapi id 15.20.7784.016; Fri, 19 Jul 2024 10:02:20 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [PATCH 23/30] dma/dpaa: block dequeue Date: Fri, 19 Jul 2024 15:31:19 +0530 Message-Id: <20240719100126.1150373-23-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240719100126.1150373-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0184.apcprd01.prod.exchangelabs.com (2603:1096:4:189::9) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|DB9PR04MB8345:EE_ X-MS-Office365-Filtering-Correlation-Id: 835497b4-63a8-45ca-7433-08dca7d9e11b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?gMKCTQDt5Tp8iMZw49mIpBhdJ/3RGF7lc3915GlLBluPA1bo1qSkitvnsq7d?= =?us-ascii?Q?v5x768TX4ZS3EcWz1fHNX7NFrNdGuBfL8EDMXSpRi+qpVn6KvlXjsn91z/Nn?= =?us-ascii?Q?to9imbG80umT8kyEywLyRUB7L5rjMlDgZXfj9BHomOzgtUM4Nf2xiuQe2RIS?= =?us-ascii?Q?2xUrvlpnYgTiq/2LUQXAFEx8FatB/96YNtF2wk92YIwQX85Zjpf5zCAgMYRp?= =?us-ascii?Q?cENaPIs0USX919TaOJPJt2bgIeh050TmT5Wwbx/UL/aVAvN6NLY0m+B5BE18?= =?us-ascii?Q?pNDossQo+dzVQax0srcrv5uiS6MHUTTTsOACMVAKgEG2aDaI1sBDDeL+mxSt?= =?us-ascii?Q?MX87igxIo270hxAlbSLKj60XjbFtOI9Zpk6Ulu6uVS943TsSoD4p55TWB4k/?= =?us-ascii?Q?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Rzs48ZtUvpT?= =?us-ascii?Q?u+qzF4o6Yfp7d9vF7tZB51UTcnRgTI8Xt8cPa36r7rRcrE/JlVsAle4Kbnay?= =?us-ascii?Q?Mbq37p5q20IdoW2b5ZCq8My4B/8IKIdiRDcHQm5aQ/76sw275Q=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?MYbf4OTWkIoH7TMzISu8D5hEFRsDetOIETEcJoAc1CSfGZ/0h/Q1ldUmcB2+?= =?us-ascii?Q?3i+t+Sf5MWvUQHTRygQprXx8GPGE4Z+yPSsaOjub1ENvl2enuM6u4jEV5BHr?= =?us-ascii?Q?hjJRDmEA8Y4INNO9sSjVNQSzjaTH5Mf6oF8z4oqqGdpsg2sOCYzsoBlziPNR?= =?us-ascii?Q?a3QxiO8DKiY2+kr4qW1PtoHQnE4BcQcTBLtRYZsU1cl6+RR6AMjYy/M768JC?= =?us-ascii?Q?4+wMtLdj66nIui5oTAn4NLFY1+eNMgtc3EiGq0cHv8qAKXIHfUccWjTHfRi0?= =?us-ascii?Q?cyr5FRLokL0eihCtgCxLnu3sY8hVZ7SY7f4Ep+r4TFU4X6RtDVedx/YG61qV?= =?us-ascii?Q?xHFbtJFYdffPAQlCd65rWIikLzDlj92/aO1Ux0U+7EiOQ0rWgJpBQvvjCoJj?= =?us-ascii?Q?sRO57hVJNYj67KPOSXd+VinLdVRC+Q6A0qGCp+PMkChGBZ97wqx/Pm0bFjb+?= =?us-ascii?Q?W1ot3U/H5pXVYNyblk4EiJmPB5z7U2bLzoGSYkPUjWEB7iW6k2eP9GLqp5GG?= =?us-ascii?Q?me0KZw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EFZU8DIgt/F/D0rnhkixJm+?= =?us-ascii?Q?H5c1aiSG82LzG75g0fE9DyJuaBtfzEY9riVYe3OtxrbAH4M33/D1/MIOH1h1?= =?us-ascii?Q?8s0oV6mpq5JWX9N7OXK2ct/cTJrjQkPhEJkVFuduipIOFUlX62K8R9vELKuW?= =?us-ascii?Q?zb+2xirB8UPT1A7scYdqXle8udWRYkpuMzYeas8K?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 835497b4-63a8-45ca-7433-08dca7d9e11b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 10:02:20.8157 (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: 6QzW0EQTajSKU85zZ1UvoQutotAZSSMnP4+578lFXlUdazhcTAuyZePkpALQdIyP X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8345 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: Jun Yang Perform block dequeue to identify which queue of this block is completed. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 252 ++++++++++++++++------------------- 1 file changed, 116 insertions(+), 136 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 75e92a1b0c..32d8a5b2be 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -442,86 +442,6 @@ fsl_qdma_data_validation(struct fsl_qdma_desc *desc[], } } -static int -fsl_qdma_queue_drain(struct fsl_qdma_queue *fsl_queue) -{ - uint32_t reg; - int count = 0, ret; - uint8_t *block = fsl_queue->block_vir; - uint16_t *dq_complete, drain_num = 0; - struct fsl_qdma_desc *desc[FSL_QDMA_SG_MAX_ENTRY]; - - while (1) { - if (rte_ring_free_count(fsl_queue->complete_pool) < - (FSL_QDMA_SG_MAX_ENTRY * 2)) - break; - reg = qdma_readl_be(block + FSL_QDMA_BSQSR); - if (reg & FSL_QDMA_BSQSR_QE_BE) - break; - - qdma_writel_be(FSL_QDMA_BSQMR_DI, block + FSL_QDMA_BSQMR); - ret = rte_ring_dequeue(fsl_queue->complete_burst, - (void **)&dq_complete); - if (ret) - DPAA_QDMA_ERR("DQ desc number failed!\n"); - - ret = rte_ring_dequeue_bulk(fsl_queue->complete_desc, - (void **)desc, *dq_complete, NULL); - if (ret != (*dq_complete)) { - DPAA_QDMA_ERR("DQ %d descs failed!(%d)\n", - *dq_complete, ret); - } - - fsl_qdma_data_validation(desc, *dq_complete, fsl_queue); - - ret = rte_ring_enqueue_bulk(fsl_queue->complete_pool, - (void **)desc, (*dq_complete), NULL); - if (ret != (*dq_complete)) { - DPAA_QDMA_ERR("EQ %d descs to return queue failed!(%d)\n", - *dq_complete, ret); - } - - drain_num += *dq_complete; - fsl_queue->complete_start = - (fsl_queue->complete_start + (*dq_complete)) & - (fsl_queue->pending_max - 1); - fsl_queue->stats.completed++; - - count++; - } - - return drain_num; -} - -static int -fsl_qdma_queue_transfer_complete(struct fsl_qdma_queue *fsl_queue, - const uint16_t nb_cpls, uint16_t *last_idx, - enum rte_dma_status_code *status) -{ - int ret; - uint16_t dq_num = 0, i; - struct fsl_qdma_desc *desc_complete[nb_cpls]; - - ret = fsl_qdma_queue_drain(fsl_queue); - if (ret < 0) { - DPAA_QDMA_ERR("Drain TX%d/Q%d failed!(%d)", - fsl_queue->block_id, fsl_queue->queue_id, - ret); - } - - dq_num = rte_ring_dequeue_burst(fsl_queue->complete_pool, - (void **)desc_complete, nb_cpls, NULL); - for (i = 0; i < dq_num; i++) - last_idx[i] = desc_complete[i]->flag; - - if (status) { - for (i = 0; i < dq_num; i++) - status[i] = RTE_DMA_STATUS_SUCCESSFUL; - } - - return dq_num; -} - static int fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) { @@ -682,13 +602,90 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, return 0; } +static uint16_t +dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, + uint8_t block_id) +{ + struct fsl_qdma_status_queue *stat_queue; + struct fsl_qdma_queue *cmd_queue; + struct fsl_qdma_comp_cmd_desc *cq; + uint16_t start, count = 0; + uint8_t qid = 0; + uint32_t reg; + int ret; + uint8_t *block; + uint16_t *dq_complete; + struct fsl_qdma_desc *desc[FSL_QDMA_SG_MAX_ENTRY]; + + stat_queue = &fsl_qdma->stat_queues[block_id]; + cq = stat_queue->cq; + start = stat_queue->complete; + + block = fsl_qdma->block_base + + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, block_id); + + do { + reg = qdma_readl_be(block + FSL_QDMA_BSQSR); + if (reg & FSL_QDMA_BSQSR_QE_BE) + break; + + qdma_writel_be(FSL_QDMA_BSQMR_DI, block + FSL_QDMA_BSQMR); + ret = qdma_ccdf_get_queue(&cq[start], &qid); + if (ret == true) { + cmd_queue = &fsl_qdma->cmd_queues[block_id][qid]; + cmd_queue->stats.completed++; + + ret = rte_ring_dequeue(cmd_queue->complete_burst, + (void **)&dq_complete); + if (ret) + DPAA_QDMA_ERR("DQ desc number failed!\n"); + + ret = rte_ring_dequeue_bulk(cmd_queue->complete_desc, + (void **)desc, *dq_complete, NULL); + if (ret != (*dq_complete)) { + DPAA_QDMA_ERR("DQ %d descs failed!(%d)\n", + *dq_complete, ret); + } + + fsl_qdma_data_validation(desc, *dq_complete, cmd_queue); + + ret = rte_ring_enqueue_bulk(cmd_queue->complete_pool, + (void **)desc, (*dq_complete), NULL); + if (ret != (*dq_complete)) { + DPAA_QDMA_ERR("Failed desc eq %d!=%d to %s\n", + ret, *dq_complete, + cmd_queue->complete_pool->name); + } + + cmd_queue->complete_start = + (cmd_queue->complete_start + (*dq_complete)) & + (cmd_queue->pending_max - 1); + cmd_queue->stats.completed++; + + start++; + if (unlikely(start == stat_queue->n_cq)) + start = 0; + count++; + } else { + DPAA_QDMA_ERR("Block%d not empty but dq-queue failed!", + block_id); + break; + } + } while (1); + stat_queue->complete = start; + + return count; +} + static int fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) { - int overflow = 0, drain; - uint32_t reg, check_num, drain_num; + int overflow = 0; + uint32_t reg; + uint16_t blk_drain, check_num, drain_num; uint8_t *block = fsl_queue->block_vir; const struct rte_dma_stats *st = &fsl_queue->stats; + struct fsl_qdma_engine *fsl_qdma = fsl_queue->engine; check_num = 0; overflow_check: @@ -711,11 +708,12 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) drain_num = 0; drain_again: - drain = fsl_qdma_queue_drain(fsl_queue); - if (drain <= 0) { + blk_drain = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + if (!blk_drain) { drain_num++; if (drain_num > 100) { - DPAA_QDMA_ERR("TC%d/Q%d failed drain, %"PRIu64" bd in HW.", + DPAA_QDMA_ERR("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", fsl_queue->block_id, fsl_queue->queue_id, st->submitted - st->completed); return -ENOSPC; @@ -724,7 +722,7 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) } check_num++; if (check_num > 10) { - DPAA_QDMA_ERR("TC%d/Q%d failed drain, %"PRIu64" bd in HW.", + DPAA_QDMA_ERR("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", fsl_queue->block_id, fsl_queue->queue_id, st->submitted - st->completed); return -ENOSPC; @@ -1059,39 +1057,6 @@ dpaa_qdma_copy_sg(void *dev_private, return ret; } -static uint16_t -dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, - uint8_t block_id) -{ - struct fsl_qdma_status_queue *stat_queue; - struct fsl_qdma_queue *cmd_queue; - struct fsl_qdma_comp_cmd_desc *cq; - uint16_t start, count = 0; - uint8_t qid; - int ret; - - stat_queue = &fsl_qdma->stat_queues[block_id]; - cq = stat_queue->cq; - start = stat_queue->complete; - - do { - ret = qdma_ccdf_get_queue(&cq[start], &qid); - if (ret == true) { - cmd_queue = &fsl_qdma->cmd_queues[block_id][qid]; - cmd_queue->stats.completed++; - start++; - if (unlikely(start == stat_queue->n_cq)) - start = 0; - count++; - } else { - break; - } - } while (1); - stat_queue->complete = start; - - return count; -} - static int dpaa_qdma_err_handle(struct fsl_qdma_err_reg *reg) { @@ -1164,22 +1129,32 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, enum rte_dma_status_code *st) { struct fsl_qdma_engine *fsl_qdma = dev_private; - int ret, err; + int err; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; void *status = fsl_qdma->status_base; + struct fsl_qdma_desc *desc_complete[nb_cpls]; + uint16_t i, dq_num; if (unlikely(fsl_qdma->is_slient)) { DPAA_QDMA_WARN("Can't dq in silent mode\n"); return 0; } - if (fsl_qdma->block_queues[fsl_queue->block_id] > 1) { - ret = dpaa_qdma_block_dequeue(fsl_qdma, - fsl_queue->block_id); - } else { - ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, last_idx, st); + dq_num = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + DPAA_QDMA_DP_DEBUG("%s: block dq(%d)\n", + __func__, dq_num); + + dq_num = rte_ring_dequeue_burst(fsl_queue->complete_pool, + (void **)desc_complete, nb_cpls, NULL); + for (i = 0; i < dq_num; i++) + last_idx[i] = desc_complete[i]->flag; + + if (st) { + for (i = 0; i < dq_num; i++) + st[i] = RTE_DMA_STATUS_SUCCESSFUL; } + if (s_hw_err_check) { err = dpaa_qdma_err_handle(status + FSL_QDMA_ERR_REG_STATUS_OFFSET); @@ -1187,7 +1162,7 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, fsl_queue->stats.errors++; } - return ret; + return dq_num; } static uint16_t @@ -1196,9 +1171,11 @@ dpaa_qdma_dequeue(void *dev_private, uint16_t *last_idx, bool *has_error) { struct fsl_qdma_engine *fsl_qdma = dev_private; - int ret, err; + int err; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; void *status = fsl_qdma->status_base; + struct fsl_qdma_desc *desc_complete[nb_cpls]; + uint16_t i, dq_num; if (unlikely(fsl_qdma->is_slient)) { DPAA_QDMA_WARN("Can't dq in silent mode\n"); @@ -1207,13 +1184,16 @@ dpaa_qdma_dequeue(void *dev_private, } *has_error = false; - if (fsl_qdma->block_queues[fsl_queue->block_id] > 1) { - ret = dpaa_qdma_block_dequeue(fsl_qdma, - fsl_queue->block_id); - } else { - ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, last_idx, NULL); - } + dq_num = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + DPAA_QDMA_DP_DEBUG("%s: block dq(%d)\n", + __func__, dq_num); + + dq_num = rte_ring_dequeue_burst(fsl_queue->complete_pool, + (void **)desc_complete, nb_cpls, NULL); + for (i = 0; i < dq_num; i++) + last_idx[i] = desc_complete[i]->flag; + if (s_hw_err_check) { err = dpaa_qdma_err_handle(status + FSL_QDMA_ERR_REG_STATUS_OFFSET); @@ -1224,7 +1204,7 @@ dpaa_qdma_dequeue(void *dev_private, } } - return ret; + return dq_num; } static int -- 2.25.1