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 3B5634564F; Fri, 19 Jul 2024 12:05:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D737C42EA1; Fri, 19 Jul 2024 12:02:47 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010058.outbound.protection.outlook.com [52.101.69.58]) by mails.dpdk.org (Postfix) with ESMTP id 1877042F4D for ; Fri, 19 Jul 2024 12:02:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TER+j+NLC5ZZRgGm1D+yLnOddygsebPUWGFAcZ2ixicfagIPV1JcjJOddSlIRGO2JSz8BAYjcAL1ZyQ/j0d8iu2+cUjFrUjjCteGYFvyQSAaGWUAqubkInr7j0LJ6zXSUvNeGoSx6Q14s8g6G3WkXLD29bAu82hsUh0FVhqXP5gxrVQHdDdibWsTIdgIqKwxWS5ZnA5Y/rf2Xm1JrKL5W7I+Q94m6y7M4QKi6msgSfUSwHcxuQCRWKwI4hp/4y1YKaSUt4eWKAXMcHXUiAefHj0kCa5yhrkseja7f6Pkk9puLXza2rwuqBWLnOfgTDDrqkGH0jv2UFrerfUJIB1OxQ== 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=Q2OXoXgzuDwi0lGZ8GdrxmaBJt+exkBQvMVhKtrV9RU=; b=W/LW0wsKpXMdACaaRMZ7phlnrY0n/2MbMaR6OVLAsh9ppxG78Mf7C/MBKhDFUk3xjoJrwsRvCY42vFVhYxNjYoKTbqpkCYyadn4IHKMykrX3XZrIkNXvUVS3NFTCiF4nxbnwnF9c0SK2gjc7pkNajxjaLJR1T8Rygb7rkyuLc4vMruUfRkTj+5vI6MVeduLr1XnBsg5aissD2vsj4o7Aaznx2z9eYUmoePBIzkm7TFdXw/NTrdsAKqMEUSsUJsuJqe16nkDIbKd7xnKRQL6F4+R/YOYiI/aqbmiIYcZ/XQrYDppWGk/5IwiwbCoVmQfjuGitPHxzJtW+yHPOnPfpSg== 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=Q2OXoXgzuDwi0lGZ8GdrxmaBJt+exkBQvMVhKtrV9RU=; b=s1K2NWXSZXx5mooFgdueLZWzqDtQ9oBcO2hXMaErSBB0vDbqjMQy9v1nefsfAXufRoBM7p/+ziPQOXtokQ5jsiJrv+2sz5HI4AKICHQmwLfMjm29IEQzI+Zw02aG7JjKd+IfZKcjQKdMVu9CBLI8NYOZRUhENSOvbzayLQPp8JY= 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 AM0PR04MB7108.eurprd04.prod.outlook.com (2603:10a6:208:19e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Fri, 19 Jul 2024 10:02:29 +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:29 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [PATCH 28/30] dma/dpaa: support multiple SG copies Date: Fri, 19 Jul 2024 15:31:24 +0530 Message-Id: <20240719100126.1150373-28-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_|AM0PR04MB7108:EE_ X-MS-Office365-Filtering-Correlation-Id: 45277cad-baa5-4b19-4b0f-08dca7d9e65f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?k5b4Bww1QlDy7BAAPa18MkKdfK3mGJuTSSqUrG6XCDqE+V/eacQcsd1F/Ba+?= =?us-ascii?Q?iyOEbC+HhrbSmTJo+DLuFKg0547ZQkt3yck9lhwkRyQomQ9jZStAdWXuOR7Z?= =?us-ascii?Q?ZE05dqeEHug1dB+WVDaI5ljGOIB/RMQTMcCh7OSu02KsjerJtxopxrf9JypQ?= =?us-ascii?Q?t+qS/fZgyrd3t5DA2a3PF/bkAjJ8NEH/uHnWI1CvSVlsTH3ZOjOdQmmCp2JH?= =?us-ascii?Q?B67GKJciu5vNFRGjLrfVGUxaZXCxujirDexrSearTTY2uCj1mdz4QMPhxfR0?= =?us-ascii?Q?FLrOYJwHhAT93YlxUodfh68HP5ZkfIktzSOFEk42evVCqzi1gFijKOGRC0OC?= =?us-ascii?Q?9cYtXLGSZww8/iO6qQZKKiBohYCaiCOBwMxcUT2bN4asNg/zjM5PaylTZqhb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c6HYVgO/6iuTYhRkme1YDT2zM7CZ5s93GwZ5J?= =?us-ascii?Q?DmqKMJgbmTk9fMcC7XKbBeWLHzCx0DssGpkdaOha0XcgzMTGi1m6Lr4y/C7v?= =?us-ascii?Q?7uoqXPqF3gTMWIYVsgVDGJVaSD97mdF4jPgyGoCr+clWDeT4bQ=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)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BfzEI+Rkr8/oAG6Lk3HRee51c8Y4NtrjKGNc6NrJVpKe+QDUEWB0srdNgf/6?= =?us-ascii?Q?3WY15WbbwZibRy6RjeETTPxbbtgT3cikcIWrhtbpJeSmOMC1s6Lk9VO/ntr5?= =?us-ascii?Q?vdyFFIkILuoD1No3URlTodetE+YbNMy0J5KGJ93vZumceC6730yHQryHgBxL?= =?us-ascii?Q?w8L/xjZvOeM+4Uhu/hAWQQ6ZCTxeLkeox7FV1iO036ZerK7aA2XMlZaD4QmB?= =?us-ascii?Q?DYnIoXiJchypsD/rZn2dAb5fbLGpdPdnbnvekVXmSMzdKR5C7ZsRVwZ+UqXk?= =?us-ascii?Q?jJORE9X0e5lXlz/eHcFrQlGepG0jWbmxasJxInnxKcZqvOimR+XEv+XS0F+3?= =?us-ascii?Q?xlRWm1hG3BsJk42WsUVlVfEgGAQaQjtHqfLMOkwR5NgiwsBMVuTn5kuX8IRb?= =?us-ascii?Q?sC+b/V+Z6BH/6iG8m0hHRWEN8R66fIYUapdMmg3XoeA+uvI0SRtzEtzygpPY?= =?us-ascii?Q?dd1HZCemEKC8UeDfzuqLvI1tSuiZcPqhOOHV4sEKyVESXSRiBoZ9ebhGCuZQ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7puZvJ9eNRo8BpnMGolGR2xgkXj?= =?us-ascii?Q?rSC5qAT7xHdNCxfN7h7X1CUpx+dwOTt2TVJJ8be98PgdG++p1pGt8wqcE2XP?= =?us-ascii?Q?Q0vJ/a/cOzC5tO8ENrpqiWOHDvWkga37vAl3rMjy8UmpkgkmRmCRc59EEWU7?= =?us-ascii?Q?O/LjMHCfRGoKWNzhGrYhNvKs39aW9ARg9AEQLhBE?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45277cad-baa5-4b19-4b0f-08dca7d9e65f 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:29.8356 (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: S8FV+HNS/S8fY4q8bU+6HheD6m2mgo3y+BvwzqXk3ZF7pgpqXs62Dc6ut1kyXvKp X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7108 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 b059d9b7ea..d0df97447a 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_slient) 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_slient || 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_slient) { + 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_slient || 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_slient) { - 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 906d452d48..35791fec8e 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