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 59C0045681; Mon, 22 Jul 2024 14:02:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72D4F40A75; Mon, 22 Jul 2024 13:59:57 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013043.outbound.protection.outlook.com [52.101.67.43]) by mails.dpdk.org (Postfix) with ESMTP id A2D16406FF for ; Mon, 22 Jul 2024 13:59:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MBeIJReaSjMgJS7X+LaJbCz853W3czfHDUmerIkh6JhTkzXoIMyCvgewqnHmvG0MAhGXD4wQUoLeXdlSod48w932raijOJajD96+1UMtnUet7uK11nqaeOHDbsMywiO9IqTeNyxY1RLClyMX0iztd/u2n/LS6xwEo7UhRXPWWgzmjcZXTbkFek5KK/rSbQ+gk62E49lpHZWJfbGFkEGmPGCegsau/rlyZi4H/k2w/kJab8KT0eWUvyMR4nfa2PjpBoyWuIQskmrhPYYrhrpDGeEC1JCvwk5z4m17BePdiudaTmD1i2UjOQBdkR4np0Jx8vgm+2+pKg85UMtai0EKzg== 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=M3FwTatwbHj/wkIh8g2ZxZbkWpHC+V/fkpYcUEth8ro=; b=hFMGCBOtXDMEiY3nd93WMYpgYRE6WbzSUcgJJlkWgJZcYyRRcjaki7PwKWQxYLf+egEbBLATQUvIFw9sb/bB2YdyE9FzUniYDpLY7A6ItJOblH5GOdH6VLZWD9aVEjLgAb86nn9q+30HIk5mwNIQJOw7JmQC92hhu08ih/sHTrcpPagab2tvwhGj7XRrwRVJVG5D0IfXsouZ8Fr1fylx+PBJaceHrB5pNZjl5f7dllv9snq+ycdZmDV7T8lEWCa59ZbqJUGKicJMx7BVv2seHuvZmmjh8v0GBDMsqWMo7eagGqCMEUsA4wZLIg/UiukrWC4GEXTjrzi6nre249cDhg== 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=M3FwTatwbHj/wkIh8g2ZxZbkWpHC+V/fkpYcUEth8ro=; b=H9w+jTo6MY90m908f8NQQ8LajOLWehmxbRnQLirl/oFy9CB/Owp+mPaCkZWDKGhQ8GQx11U9wK1XwuQE9QZJPR/GSZ6LDAUVSEzgEEfN5QC2VontaFXZhgGDVuVWi61ctcgSRgqzBMJOI1PFAu/lyNDw0/KBwd1ee0HZNrX7Kzs= 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:53 +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:53 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 28/30] dma/dpaa: support multiple SG copies Date: Mon, 22 Jul 2024 17:28:41 +0530 Message-Id: <20240722115843.1830105-29-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: 56bc6d2a-f859-417c-4ef7-08dcaa45cc11 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?rNw7tz9lbQR3Ofq6OANj1rHK5rIiaxa+PIFJ8SyyG0zKJXFlilDFTtsIIB7w?= =?us-ascii?Q?F9WTy92GlZJ54P9EfbrK7+rtIOjJNm8vXx7WNUf9s9YRlyWP4xI6pOXaiGcr?= =?us-ascii?Q?cb3IljD2BTT9+23gooRyk/WvkM7xMZtzw9Mnjnh+n9OEKCZVyjdTEufz+xKk?= =?us-ascii?Q?gfX5XxB7Bq0EP7ccm8V2VxvT/TPpShTY9fAaZfWoCOeiTpQE/DNeVuygzQuU?= =?us-ascii?Q?auqMhpSL4q77ao8B/OIYWLoEO+MJichAynumYBdK5oeIwn3pCwNVtn5SS84v?= =?us-ascii?Q?GaUfX1C0OuIkzf7pIaRxVawLd8lWtkc3QuvBEsWpdViZocdejNffZz1Dbc5K?= =?us-ascii?Q?KjZSbqYkeTct8/MaYcagMOuxhr8kvYwAQiymSrlAPzYgnx1IqSHumvMVI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qW/j8qfUt8BYJqtRGHSYeWcbQx?= =?us-ascii?Q?IwRXqfvbwCX7ASJjySAS+pnsT1S18v50MWwf195kFd5SwEadiDIIdRpYZ7wb?= =?us-ascii?Q?HO3pEcCip6jxs1RdKbmrM67GB/0V5OAqKx2jiIJ5k10bEdgCJg=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?8+KqeGBUGsWMzzK8KCse0dVwjaLOhQuDftEGcWVTIFj8CkCZRmm6Ts/xJcs0?= =?us-ascii?Q?iaIPVyTjPF0F8umq1T4c2UhhbeE9KAiOEoaALXU0IAy/QR4ixFZjsfFT1ya6?= =?us-ascii?Q?2ym3KDaw9e3OpqUwF+8ZI0AYmTmIVFgw76k9VsoVRbHY4v23FwukMt+QszJJ?= =?us-ascii?Q?WO5kINCzOtmCZRd8jUcny/CbzJRt9A/u76RKxAmfznlZ5WsJjCQ8RXEpdIDy?= =?us-ascii?Q?4e6/AucHcsQbz2umOQQYLLJrw5nYIVOAZqJLeDGfxqB3MkVFDK2ZnUAtwNcm?= =?us-ascii?Q?iMly2eAaTuQPM+rqXYyjArzeDC1FQBBQ+pGgKPOXIiPdQOOQb4/kUUndqeQ7?= =?us-ascii?Q?/WSyeIKiDBMiabExNYRWZZhGr5ksUYmwzeRmHV9f7fEHUBwIbZEMUfL441Ii?= =?us-ascii?Q?Wdp4rLwrsYvcdr1U6kBcntlvIgWILaC8SknAK5N7qEZWhnUZcKNvgdqO02i/?= =?us-ascii?Q?ocFOV1Guif+ybrzqWqNkgOkab7EI3EiXbcFauosfxzTrS9VznavCDzmIi0rP?= =?us-ascii?Q?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lbvYyhQWqq6NJGPzUGo5?= =?us-ascii?Q?zqwL8U1BnWwCymHE3d3DHtBla+mt8qJuYEZdYVq9BhxeF5HyVPAbnAO3gcXy?= =?us-ascii?Q?KXaqrWmUbZgDKPUzLNrY+lDJH1Sz3tEZDyMUqbBz/eDGhg7fR0dOKDsmSUPW?= =?us-ascii?Q?BTVym97/6kezLzOaEE2nXxspGEWVaw2YJ35m1y6O?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56bc6d2a-f859-417c-4ef7-08dcaa45cc11 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:53.5514 (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: gI2O0gMy/IUes6vOuUr+jAPsvspqLmkIe/9bYn7qM7dOz6YsQ+8yVtq8SPaIhPYn 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 Split burst copies to multiple SG copies if burst number exceeds max number of SG entries. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 180 +++++++++++++++++++---------------- drivers/dma/dpaa/dpaa_qdma.h | 2 +- 2 files changed, 98 insertions(+), 84 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 8f5b6c6ea5..383142fc75 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -584,17 +584,15 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, static int fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, - int is_burst) + uint16_t num) { struct fsl_qdma_engine *fsl_qdma = fsl_queue->engine; - uint16_t i, num = fsl_queue->pending_num, idx, start, dq; + uint16_t i, idx, start, dq; int ret, dq_cnt; if (fsl_qdma->is_silent) return 0; - num = is_burst ? fsl_queue->pending_num : 1; - fsl_queue->desc_in_hw[fsl_queue->ci] = num; eq_again: ret = rte_ring_enqueue(fsl_queue->complete_burst, @@ -634,6 +632,69 @@ fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, return 0; } +static int +fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) +{ + 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: + if (fsl_qdma->is_silent || unlikely(s_hw_err_check)) { + reg = qdma_readl_be(block + + FSL_QDMA_BCQSR(fsl_queue->queue_id)); + overflow = (reg & FSL_QDMA_BCQSR_QF_XOFF_BE) ? + 1 : 0; + } else { + overflow = (fsl_qdma_queue_bd_in_hw(fsl_queue) >= + QDMA_QUEUE_CR_WM) ? 1 : 0; + } + + if (likely(!overflow)) { + return 0; + } else if (fsl_qdma->is_silent) { + check_num++; + if (check_num >= 10000) { + DPAA_QDMA_WARN("Waiting for HW complete in silent mode"); + check_num = 0; + } + goto overflow_check; + } + + DPAA_QDMA_DP_DEBUG("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted, st->completed, QDMA_QUEUE_CR_WM); + drain_num = 0; + +drain_again: + blk_drain = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + if (!blk_drain) { + drain_num++; + if (drain_num >= 10000) { + DPAA_QDMA_WARN("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted - st->completed); + drain_num = 0; + } + goto drain_again; + } + check_num++; + if (check_num >= 1000) { + DPAA_QDMA_WARN("TC%d failed check, Q%d's %"PRIu64" bd in HW.", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted - st->completed); + check_num = 0; + } + goto overflow_check; + + return 0; +} + static int fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, dma_addr_t dst, dma_addr_t src, size_t len) @@ -646,6 +707,10 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, struct fsl_qdma_sdf *sdf; #endif + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; + ft = fsl_queue->ft[fsl_queue->ci]; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 @@ -677,7 +742,7 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, /* This entry is the last entry. */ csgf_dest->final = 1; - ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 0); + ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 1); if (ret) return ret; fsl_queue->ci = (fsl_queue->ci + 1) & (fsl_queue->n_cq - 1); @@ -689,81 +754,30 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, return 0; } -static int -fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) -{ - 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: - if (fsl_qdma->is_silent || unlikely(s_hw_err_check)) { - reg = qdma_readl_be(block + - FSL_QDMA_BCQSR(fsl_queue->queue_id)); - overflow = (reg & FSL_QDMA_BCQSR_QF_XOFF_BE) ? - 1 : 0; - } else { - overflow = (fsl_qdma_queue_bd_in_hw(fsl_queue) >= - QDMA_QUEUE_CR_WM) ? 1 : 0; - } - - if (likely(!overflow)) { - return 0; - } else if (fsl_qdma->is_silent) { - check_num++; - if (check_num < 1000) - goto overflow_check; - return -ENOSPC; - } - - DPAA_QDMA_DP_DEBUG("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", - fsl_queue->block_id, fsl_queue->queue_id, - st->submitted, st->completed, QDMA_QUEUE_CR_WM); - drain_num = 0; - -drain_again: - blk_drain = dpaa_qdma_block_dequeue(fsl_qdma, - fsl_queue->block_id); - if (!blk_drain) { - drain_num++; - if (drain_num > 1000) { - 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; - } - goto drain_again; - } - check_num++; - if (check_num > 1000) { - DPAA_QDMA_ERR("TC%d failed check, Q%d's %"PRIu64" bd in HW.", - fsl_queue->block_id, fsl_queue->queue_id, - st->submitted - st->completed); - return -ENOSPC; - } - goto overflow_check; - - return -ENOSPC; -} - static int fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) { - uint8_t *block = fsl_queue->block_vir, i; + uint8_t *block = fsl_queue->block_vir; struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; struct fsl_qdma_cmpd_ft *ft; - uint32_t total_len = 0; - uint8_t num = fsl_queue->pending_num; - uint16_t start = fsl_queue->pending_start, idx; + uint32_t total_len; + uint16_t start, idx, num, i; int ret; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 struct fsl_qdma_sdf *sdf; #endif +eq_sg: + total_len = 0; + start = fsl_queue->pending_start; + if (fsl_queue->pending_num > FSL_QDMA_SG_MAX_ENTRY) + num = FSL_QDMA_SG_MAX_ENTRY; + else + num = fsl_queue->pending_num; + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; + ft = fsl_queue->ft[fsl_queue->ci]; csgf_src = &ft->desc_sbuf; csgf_dest = &ft->desc_dbuf; @@ -808,7 +822,7 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) } } #endif - ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 1); + ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, num); if (ret) return ret; @@ -820,7 +834,9 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) fsl_queue->pending_start = (start + num) & (fsl_queue->pending_max - 1); - fsl_queue->pending_num = 0; + fsl_queue->pending_num -= num; + if (fsl_queue->pending_num > 0) + goto eq_sg; return 0; } @@ -831,10 +847,6 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) uint16_t start = fsl_queue->pending_start; int ret; - ret = fsl_qdma_enqueue_overflow(fsl_queue); - if (unlikely(ret)) - return ret; - if (fsl_queue->pending_num == 1) { ret = fsl_qdma_enqueue_desc_single(fsl_queue, fsl_queue->pending_desc[start].dst, @@ -871,17 +883,19 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) } static int -dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, - __rte_unused uint32_t info_sz) +dpaa_qdma_info_get(const struct rte_dma_dev *dev, + struct rte_dma_info *dev_info, __rte_unused uint32_t info_sz) { struct fsl_qdma_engine *fsl_qdma = dev->data->dev_private; dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | - RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY; + RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY | + RTE_DMA_CAPA_OPS_COPY_SG; dev_info->dev_capa |= RTE_DMA_CAPA_DPAAX_QDMA_FLAGS_INDEX; dev_info->max_vchans = fsl_qdma->n_queues; dev_info->max_desc = FSL_QDMA_MAX_DESC_NUM; dev_info->min_desc = QDMA_QUEUE_SIZE; + dev_info->max_sges = FSL_QDMA_SG_MAX_ENTRY; return 0; } @@ -985,9 +999,9 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, uint16_t idx; int ret; - if (pending >= FSL_QDMA_SG_MAX_ENTRY) { - DPAA_QDMA_ERR("Too many pending jobs on queue%d", - vchan); + if (pending >= fsl_queue->pending_max) { + DPAA_QDMA_ERR("Too many pending jobs(%d) on queue%d", + pending, vchan); return -ENOSPC; } idx = (start + pending) & (fsl_queue->pending_max - 1); @@ -1253,7 +1267,7 @@ dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) } static struct rte_dma_dev_ops dpaa_qdma_ops = { - .dev_info_get = dpaa_info_get, + .dev_info_get = dpaa_qdma_info_get, .dev_configure = dpaa_qdma_configure, .dev_start = dpaa_qdma_start, .dev_close = dpaa_qdma_close, diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 753ac6973d..146151ab8c 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -270,7 +270,7 @@ struct fsl_qdma_queue { struct fsl_qdma_desc *pending_desc; uint16_t pending_max; uint16_t pending_start; - uint8_t pending_num; + uint16_t pending_num; uint16_t complete_start; dma_addr_t bus_addr; void *engine; -- 2.25.1