From patchwork Mon Jul 22 16:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142642 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 9D91245683; Mon, 22 Jul 2024 18:43:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95EE6410DD; Mon, 22 Jul 2024 18:40:39 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011055.outbound.protection.outlook.com [52.101.70.55]) by mails.dpdk.org (Postfix) with ESMTP id 567E340E11 for ; Mon, 22 Jul 2024 18:40:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z7wKnpM2Gc/iQiL5G5IgmT08kHGwyE8YUxlxw+88aJCKloHe6t/wtZ/5SHb2qQGHB4Zzy48GFeepqafTZLgnUWkE/EQiI2klKsN5qAZpnvcV4mFNzWx3RYxjj2PLb00dKJ42n+JPzaPM2lKkaqB1vs9duTKC3fFrk3zl06WJ+rmqpJDsSu8AuWf9pmpEXzfWzbbL080nHHpTeGrkShSb3OGGjyRExoxbZuppNInrd9w9KB50yogrV0Bm28lVFS8g/xXa/OFQazPeRE548Mi1MbUVYtszfKFXEYSuQdetkCwZQg4x1B6hUNRM1tdaLk0uQ4zMBeBP6M3tWmWejootzQ== 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=OFq9u8ryZRxM03VyA6zqiCefIvCU+6E7eBDl1Kg6eAeE6feQhrman2BijI0w0naFkn2FrxyEzIcP1RcS0urMMxVf64kVNKhkmb5ijdhekBhNzFD+GOyCrcgp80NXnYanMOnMIzcla1GyAzoIuQHWn8ueQT5ySLShperjRsjlszwBY30gCLSqQYWFBzo0HxjgU8fSdWEE3DSm5ZBIJ9moMtX7wxd92KIwBP672+9QZ9ZbQ5zhxDC7vVo1pOSIdU70JuO3QrLSsYRU0LQ87BwJ5z7WzrdQ1Cm+6QVZPaNtjDAVux/Bsg10qH3LEMVgDoqCzss8KNoIv4tYpn3mObKhHQ== 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=mVxGuIr2214Vfko9KIhhyxIaNohQCW3ziT54BYy0DeZvnuuwntlR/md/bRTRJYEPWRf8WN8qjFNPfHL+bbpxuJXx5C/3sC6GB9CXxWGpvs8EzIBq/ZqrVsgZrtOUlIsGtda7q507OJ6nqMcKY0HjPmRR+qx+mQtJ4UK1caLpxGs= 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:27 +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:27 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v3 23/30] dma/dpaa: block dequeue Date: Mon, 22 Jul 2024 22:09:23 +0530 Message-Id: <20240722163930.2171568-24-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: 3d853611-38ac-4b04-3cf2-08dcaa6cfdc3 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: YXQvVWQHdKEX6DNGogTNjvUhYL/2gzXrIj+Gc/IBcSFjvnQ7p9Ou74gYswA1cisov0DYNrtUVD/+dZp3FV4Wr+k14XaYSyYhd7BlYpwOTm80C4aPokGEY0hBr7s2NkN+72RDjHjDAIA5ll6GfZpOwl5Qy18nXvdFdEQyiGpSW+JSqBRw8N3gvw/9789JpqOogPdVd+9tlq/8dnIBMz3Sa4/0TIIcT0iw506gpaH46d7zEmXXTwsWHbx1qQcKOFEc5APRyKtHIA3oE+uyXKzgkbBJFNiB4jigqARqj0ORKwlwxwc5RvUdfYAWP/EAZ31fdDJcEKhGJ/8xPr60ZVRklGDb0JPBlM0qdHYqRj0MVXDptiFp8wj6eqI67eX6hffQb8unnLU1K53ZEj5Zqrawq/Xzi2nIXe6iQfiFy7gp/BGPtTjSMm5leoTqAZhqrnFenIRjPdIrCgA0f0OxIdG+YHO5p/BiBjahTHnHukYxfDdSA206mGSAE7yxGkSAjUHhRa7ACpD7ocHMeEe1Qj2DMAD1J8ICTEkVr/b8jQKXP67HDZPv6Zbu2VtCeUce0nbKL9lI2YoDHEAK4pVBBsexFtDxc6zYG/sAKfvPOURdSRuhERLam/CQxrtrEG1RYxysUtkmfMXhjU7fvyNHt3WhdoIWMcEGX71zS6BpcVOenxTIviPv62wathgGA3fVkijgp4TigaQiS8pZIW3Sz+EAqvJ4T1BIV/dWXnzgNBgNrVTmPKqRdrCu1yAjuB/TuD71amLtb4P17o9U6bahyAVlXowLMJA5GPzOiToBN+m1NCt+nYoPKEK2DqXLgqViMNfbmNg9R7TQKScDnD/P5+TF6ySbqsnWOxSzvyKajQPRgqmhL72hTGYiYlUl5bDWXJfeB7Feh0jnAy3W8Bpiy9bp/QTEZPk1oEbLBtCm+0CnUjas6qlTGS7Z7YKPiILHvWzaeMmbziAq1F1+CxgGwHTxhrdZARlAg0EeGRnOuWesK+vsha5XQzkxWmEB7XHclYtxLeJsFFODZzMbQqgYa5RP49T466mb3g9KG640bIgQzCDs0mCOPik7sPKjnbK8SJlwztvNmiS0KTggAjUxnsB1W/XaD1rYYSMZnNuS+7h6vPqDFyk+WQSZFptQD/q3GZj3qMCAY7TeYWX8Twe8EqvhFA9v6UlfcM1HVYFHJtoLDKfID2WKchqcF5vHFtSYvDpmltKb/3+2jdPzCXlG3gVS+xIxnP+OLdkcVp8I1mYeklJg8mlnEhKjjzmprJcPtqcM6696JeZjv35VRj+Ur4P3/URyBDtjVd4FUqBPUnkbEdpojxhJDlJQT5eERnzmGfQQIxfDcnepmRh/KYICoaKG0uBepjXo3vAAHblQBXMzG9HJckavGeCL8+Ub3vWZG8mSkAnY60g5DL4fdTjErgDyfQ== 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: 9wKNCgDO6qjFoV2Qh6GtSfXLEmSUCmMltOTb406Flhaho/PrfmQt5CW2kbMStCuWde6PZ9m9TqKHpks0IkS+UjwwrYRHPjk33vSglUGfArWcDnKTTmCvSTtJ3j1WR+BRWyK9ZKl3DJf/9TaBEwUhO2j5ElKlSA4mVDQL7TPfRlOUqGsOoSFtt2lVcbT+tc4lfwacaJTBqp1fpYnlUCYUku76MEeoH4WoMxjHRqqRZTfL8FKKwZJuAbCj429EWQ8qq9i4JTtu1/ugTfLV6WuhqYR1IMBeLjN4MdmZeshNRN+xmFOxX20Cn/VD/g+QqtGDp1agZZ0W/37HhWa2xUGc36VdIFmCDcda3xtcYfvwwLXpa9ga7USZvjZf+sQ8RGMgWKBOzg2/LwF7KRPX4Su8PyBMOSOq6JE9UMxwQSjnBfFa6zcx2V/PtwbJDYULGRlDp+BFEQniq1GNAvWIvkB6LzJTU2c3g3n8HB3E5ncBjJ41fny9JYbehDmwAqtzVvhReldKPkW3r9wRlP2wFeWXbWP7MfdsDB2/7JiVVo19SL7BhFDYAgTikUHETKTtZ1Js+ftU9kakEG/jTvyscoHMEYs8Qegp4YCqQPUs40t0Js+qk2o10x46c2dlPCl5jqVRkqvR6ZfnIu3xjd6lhh+G7iRUrltkXc7a/hj0vrmBDlNkmMeoseWCyBON1Ghisc0VuKmciJHzm6dQI87UYcWpN7Wi3rIP4y+qPZaY4LGJPwceaMfDm4mca68M9CCkHmlYGyUfVWDjjoXzWyFj8+7x8b4eTrFBcnAfG1kknyPos3Lcpz6O7GXhSDgUu3H5zhXWQYlRaMjHzBTMB3B5/Kmqo3HbaDIU1KeGRGdqMyYssmOFGYe0PjaT8l4Oba9UtnOdEUttRufduw8JacTV63S1rwYUiT6s/M8YKWsOlGVJBjqLGSPSuiysBbWGiGrsnybVDNCdfOwdqsqY95LrsixY0rF8tXQzHTsQEMXOkZOMlupElHPirEwszTwd5JyWueOPu1aQApEx+L/yB613D1l0+gPRB6x6hPRBNjSI6dsVvn+Y0P2HkFSNNzVVDTrc1/quk0kWLBh32Alw3GCCpVs7g6xmhxv1BE3q6m69VqX2RN/BrtSfXoX/OpKiGCoAefinbfslrMzu5cT+qWi/PG70K4Iu2TCAXcmP38Vfx7fPhmlTbZFAer7h8j+2tyx0vVAxrU8EUiZXu0FrY9Nl5rOXMmVjhayUV8p9OFFuLEB1gcVoPMi+4wZcEfLZI7ivwySAEki0hEnE6an0gY8CaWF3DfwYCM5H96s/D1j+oQ4+/eKtJMvDYQSKyc5ZeMpNEopLJzyvkUcIi2lWvVJrKUYnZSgKAvxfaq4AeoFn/XTmtY6WjxzADewHjBO9qbAbKpAqK0tGwyjGSdGK1wR7eBubBHA4CHGb/4gCQ0ZT7xePieLsPK69P1YZl5grUe4eEXnIKMKxCEdAi3n1BDPGd3lG0EZtsV9rqTJxzVIp13fDc0nGG0EnVMpvr5T7tuqWGqm0LoMfmwrDWJtkDZ0mPDP+EQuuvXOpAmkLM+Vdo+8A3Xi1sgafvq5NGtE2ddav6CUb X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d853611-38ac-4b04-3cf2-08dcaa6cfdc3 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:27.2025 (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: d0na6mZtLFBL0HAttgGAg4MVAHb9g2XfGtvumWaNN19wWW+g60Qgv4E7NnkD8CtY 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: 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