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 1D2EA45681; Mon, 22 Jul 2024 14:01:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC4AC40668; Mon, 22 Jul 2024 13:59:50 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013044.outbound.protection.outlook.com [52.101.67.44]) by mails.dpdk.org (Postfix) with ESMTP id 2D98540668 for ; Mon, 22 Jul 2024 13:59:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qnSQzbDmQE/IB2+OGhYJ3Y1Y+xz4sfGyWUFmaKAX0Rq8Lp4IC0ncKZpsGuvJx2K7RsJxpyXoaIrBqZiMgtneDMkGjM+a0TdjRImbhS4VFFEoscNBvd+mXRakFlF89p+Uen37TCJoeOy0JR6R71K3hMmUzm301j+Jtof7RdWHjA3QwyxexPTgbfVKb/6CedMelZpFcF/HfmT8A3oRtVWTHaC25L/K1SBhr+HQNowaMWp88eoAgVs7mnhivx1kkjxv+vwfxQgblijsVoC+/8KJ3l3dOmrBEhl77B4g1Mi8oc1wKHrRE00wLcV28qlUGRmBl0TvUAlRMWQ+2N1yjUfrPg== 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=ZcaBT5JdVYlcj5qtIKVBbfnDEVA9hssFu9URcXFYI6U=; b=XcEel4ADss8RoygzKTwd8GdCpLlxTSLLpNlFj+YJgQkV1jQ+SoNQw5VGkXRFAtiJK5x2UpEo7B0PE6DWh+4uRD8UK7TGFWIBPpfe+NwSbAP2JP0SEubzXp0OCYOl7eKMoetrTH150HtOU+/mJr/SAkXDdOnXh2WSV5x92cQZXD3GghgyJ2ePB10ijdZM5rcIaMSXGuCJ8sBdKL+0RbPIHPkCQ3Qe5aWXZEMA4tbMIdEdHsCOYlPXa5xxN/0Q1696PzXKG49IfkxoqSB+lrgkfUPqYcOFvGox/Du24+hWKrm0v4342A0lEsWrrQH7Ff/Gp85fBTOaE6mhCaVlOP2h4g== 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=ZcaBT5JdVYlcj5qtIKVBbfnDEVA9hssFu9URcXFYI6U=; b=Rr8TXNpDRmCRHoU89rcpcsjBujz0V10LhF2pmXq2lcF755dgqaCSgcc2435tcFFD6b/iipUJrKh4Yit5len/4N8Ie3jphGOlXhM2+AOlojQ6xtgBqYeI0f0zeh287boDVEUqqF+o9YUNm072P33HVgPuwo2vf4DXmDF1DMHgRLg= 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 DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:44 +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 11:59:44 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 23/30] dma/dpaa: block dequeue Date: Mon, 22 Jul 2024 17:28:36 +0530 Message-Id: <20240722115843.1830105-24-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: 6baf1e1b-05a7-4150-2a78-08dcaa45c68f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ddNCHK/FowlsJZBHcdQ/uigWtCftTyqVu6aK+I2x618E+fC2vfBNZ3MoEkfI?= =?us-ascii?Q?8qHS1RmH2TxdLl+npFLJaJVPkY69dDuN/4kgy/9SR5k9ZqVQKpZg2ULA3hAM?= =?us-ascii?Q?9Kg6VqVUzu8nqNpBpGsNRDSbfGTcQVBFm+OKf6kCChx9LRoGkTJ94QYpudff?= =?us-ascii?Q?qQeEeINBci7r5JDmezq3bB0/GHG/BXmyL/LNJ/YoKqVpJ8ZkheNlLNgvK616?= =?us-ascii?Q?2hZFqeN9jUZoU8EJov2aHY/GhDlPVUWhKwWduyMUzknNpjpn1wwG4LWj4F8w?= =?us-ascii?Q?Y3h5Q5Dz+8YJCKX6wOKaXDwWhTS10qR39LcLYAu+K+T/Qsu2NQrZnuVLnf1a?= =?us-ascii?Q?qFSNfr7N5SM2unZliGD0PZNA+3jgMbws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?Q?NztP1ezSiNzmJbZ4o6Fp9g3mzgQXj8CpGvl0DyH7jbSy1g8+NnKeu3q1V1nj?= =?us-ascii?Q?DaETEdJB/63187c3yzx9ZF7A0VZfYYOzM3qdiCBX9LQdCJCldrc3I8IXltJW?= =?us-ascii?Q?ju6CTF/i0F9rrX2SjTH1/r5NbB05i20Euj6sIqc2+gxtBqwD8A=3D=3D?= 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)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?R69ML2BOE3qzOOgvO++VppWGtQRE15LbjfSppTx6C/LByGeIr3JxzP6MouOI?= =?us-ascii?Q?3/tVl94rJWwGjogkK9Fv22zFstHZU9MoPgZwnFARfEHdLizJhu1XPydTVY6o?= =?us-ascii?Q?V0LNujUhu3fQgcMflO0X4DaDNdv0y5fodgvn+vRyzzszQlTvNW7pzFHPd7dg?= =?us-ascii?Q?c6PbQiV6H4yxqgC8MvJAMIdJQA0+m2hq8X0D0NBAledhvswyCBVHCF/werFV?= =?us-ascii?Q?iDtLtG8fkHvdmCJYTqY1IUs8Tkh4zq7VNVD8oRzFjXbP9YYqNE0uOJ1Om7ZH?= =?us-ascii?Q?8x9gZ9J1r3kJnFQhSfrFb8NLm2vQJryrYzF3j5joz/Qgzf/ApsxxHOKOi3Rc?= =?us-ascii?Q?XFRtkevy5XVkSzEJKEjvnNvl5XCaMv5u5YVIlgXQ//aWCSYsY6CsacBri/W7?= =?us-ascii?Q?Bn8L2XDGY17l+OmBFkmkagdVQIa9sq671P3IGLqVlGEqxSI/2UJ/SoX9RAjH?= =?us-ascii?Q?3EPcBYlbRnXntIkpP663KC3Fw6w8zSnvP8B6t/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q?049vaFn1B0FaEePnfk+rRYVxdSKQ13FfHS+ZMsyswkSKEu5i2UWA7bO1tLfX?= =?us-ascii?Q?37bkwAV1mxaeQo//hucvMbx823tQjL+feWQYQEvv/9wN1UBknDm6UCKmbZlL?= =?us-ascii?Q?eny4rJOyrg8c8xALw0UP6/PU2kPAnx721OWLHSdLV34+X3HQHMPb6GZtZ9WK?= =?us-ascii?Q?z/qaVYSVt+qjIF5xUCStayBOWlr7GpdX69wFLpIB?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6baf1e1b-05a7-4150-2a78-08dcaa45c68f X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:44.2355 (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: UJa3OsCZHw8PWxiH80VDr68LFR6q845AznTTdeibpJsplSsQ76nWHC/GaN9dkOox X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 f1ad60d1f2..de5ecc7d0b 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 = NULL, 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 = NULL; + 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_silent)) { 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_silent)) { 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