From patchwork Mon Jul 22 11:58:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142603 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 4B59445681; Mon, 22 Jul 2024 14:02:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1B2540431; Mon, 22 Jul 2024 14:00:06 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013071.outbound.protection.outlook.com [52.101.67.71]) by mails.dpdk.org (Postfix) with ESMTP id 0FFEE402C5 for ; Mon, 22 Jul 2024 14:00:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LOR1ahDxb6yCUvkKLN361P1bgDZewuKlNl8DNMRfV7lKlD1/laxwfdHnWVlrhiVXMRjdVm1qNSGs1hnQMDpqrTZoAsGSOKamjoqmlFU6/OHlYoQUEukE4jcbOivr6bIRegxrcQU1uYbrqn9bEjeNQSbpbEgFTRbYTXRPdFDiDilrK66bhSfdL+WCdgW5QQoKULBpAWtmJyJ64bEwkoAoQ5/NIovSy+aPvPjihsk3A83HkrBE1t3q78NUpNlvcsXiy7KwOhMMlpd2e0P2M3yATTfSrh3quOBRKlHNBFUEEsfRvl6xqqYtwg7IVwAf3lmlhDDsg2dkyz4ZgDVo4mYEfQ== 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=CyIacJRP6zeJrrMmkQwX9RUwoPeer75zSeaT0riO7Vg=; b=h9aI/fQSpLX3jI6wI2iGJEQhdbnNdkLMfJD/Hw51UG0GCQQIHXhSkGRZYQ4Odrd1jM0uDXuzNdixWgpC1X/d/nehCIpJrixrKX3l1TWPAH86ChqLsz1B7aPd9p8g7sQMf0OTLZIGgeiXQayyweeQYD38j2mYokgmCT/bazyHi+ejl9kLCfAwa8bDrA/UyJm9uUj5fVOum7SyMmxPmzl/hrlho3QBtoCoBMm+CMw3zJ+/3WY56V7fIE4JQsa+tr22KVYDSPuYuAQn3b+T8TuC/UnE0sQIUX3PUIzMpXc6REayasVnfr4fxqsoN26Jaq75LtdIVqlL5Q21M/v+zLLXkw== 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=CyIacJRP6zeJrrMmkQwX9RUwoPeer75zSeaT0riO7Vg=; b=LnrQLX0E6++LwqHBS3vvcb6NHZmHm0uV/aY/oHSoonvl3faWCIAYS353UXdpgdGTHdxReOiCEpiG1WAU6hW3g4dnGfqut/iNzB+W8+wYr+iG7g8sAjwJmSS4GeXM1UEIj9lZIfjtDjsJDIIOr8WK8xmElydIkrHNCNGziNG2GtY= 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:55 +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:55 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 29/30] dma/dpaa: support max SG entry size Date: Mon, 22 Jul 2024 17:28:42 +0530 Message-Id: <20240722115843.1830105-30-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> 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: e7253c12-f91f-45b6-3280-08dcaa45cd27 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: vYgg0wo4QcLkW5+N8cFp8NpNm2Ej1oO/SbAgGNVOQIkiup6HcqIGsmB86vrsjKbWPUT/66gjx4fmxH0bf2M7pMLNv95MZcD1U9/OcwoSRSeiQy+E8TKGHXLmE/pYvrl05D+HSYFJF7rJ/byL2p/7xH9MTKd/4mJIs44N7d6p1oswqciqIvBDXm02IXvZBFB6ndmhZs5ar+GZ5X4gPd5Rj0ppU0lDH1+bDpeijcha46ihb93zpZBz271vgXxkKTvYWFrfMhku2jM7G2ZeJXxBYj1E08z3cMAGz7A0ZwBa+HoKSL02FQqYUkSOKHSn0ZyAHj94qzCG7aYaeFocbl9lnQXfQ2YWZRzUkwQjyBpaDL2lC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P: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: EFRmMZnVjUjVaX4rL/Z3qFRO3KOfKB4ns39gmWgFTMHP0fs7tjjvsTrBTVPF+EkSYFaLmZ8L8wKRIpUujcNsYautPTI76jzGQJALH+VxBR7h9HzVBaKwQ0u4qawATKSWQ56Sv5SaRf5uiffQFZik38F+RmprNlbgD3XAadLxUmbW6Os7Sbmfs9tLYT5nkA/CV5Dk9w6qxXrw6Af2D2Uj/snhEl5kvE8EOfkZfqkAcNTelDsXVDCSS6QCHbxjKS1OM5ikeVBd8OG/dEi82C1HuJ8iD0jyoHlej76+ld+RF3NjHNKJBgRSLufw1lPvXxvrIykTTcLyA+nJiYXeIO8oluRHY2YXr11k1iHAWPKyN3Z1nUNo0fDwQGKbeEhKrFZNN8FdC8j2A1/Ptj1ih3vX8/kv9TwqKo8+j8Y8XQxNSqGsPODnuOrpqyy8xKneB7ie+mNiK0BzhFcDfmr/+RoY4/ZFa0fkamVCNQeoYjz6bTNbagrVApY+fiNC7sFjn8HEkAfPhYpHxxCKrJU7FD64UW4Cc4pYo8yoS2MhxRUgUTocHkiTn1BEYsSmuhy0XWYEr6+GzOcZwZ5XDnk3d4YZjluEm+U8YrWPIan6ACNvxWz5AM27hrJiZdn4Zbdgw5rJi31XvTW/AZIoDl662AEvMUkSj/+Q9/h7rt2QVKv6fQm6vLWwN7oNL3/76RuMoy6/NeyiWysJUvhNxTc14HxrQSZyK2AWGZsO/5kioAU8Y+u+OgaEhYOehB3iY4wOibJpgjeQoB7WupogqC76LVFhqDeGKaRWUTanUo6ZIqV78B3XbNY6JGUIN1XTxlsLOi7JsoKqZ2DK1yd9tupFaR12DG9xrmsNaoYt04xV7YkDvneuEm3vyY88c8UHrBegcSSxQUaayqaSSbpC6CRm00dD083GWGfu0xJLIuh4Bppoh5kcZJ0IudfjCo9Fq38ntF3PJ3Vobr/ThyZ3uGT8hza+Kb0W1uQUUyU/OWkUXccO5NXOSHsUTcqkh5oguVLbuC+RuMnX8p6Pt+8d+zhwNI4eopOrEX9BZKGqg1SSjKXvI8iCJURphWhR8v8xRfRqb/k2FCtcHtFHFcUnKbOpzl2hpADJFTYlWJdsp8Db09mS3IrTkSCVp6hsx50W9ud25d6UM9PElmBtwflbPfadpqJ2KV9UlqapDxpUj+zhQercIqVEeVfzTND7YwRKhOBm+JMKbKy4ThbQrAd0ItAGn7Y2fifXxoMLPMgeOsNrWjgheTOzGlWuqMdvmj1hSfSxrp19Fp14JJZMEewWMJN47L+UGSk6kehsLkOAI8AyZLZji/n6Pbs/xsUIqWMSJg+5WfeyCIf/0umr8pSP37jFhcni0iUC8u1uc5ClRktsr+U4bY/Tbn9oKb/wUQU8KPSmsm4507NmpTdCc8epxAeYYY+yT6uedPZQMrYZzE52ntY56J74TMWHwMNGAV8JX8SEJU97qDYLX7yEweIdLgJ8pH9daEDPZBEdZyhpXbFcXzAemGzAWrOx4EJkV/QfGVA/FPi6RvqOK69vgez1hxy3HS5YsmTRsXS+spgV3O7WdX7RQIccKWU5HISm/ix88l0ecaTy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7253c12-f91f-45b6-3280-08dcaa45cd27 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:55.3010 (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: wuS/Xy9WAU9Lu5xgk1NlJ54Tc+w9NPwpExeFPNCMQHQwQxO254PkBCwI4u/EiJAe 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 SG transaction is not helpful for performance of large transaction size. Start single transaction for size > max SG entry size in SG copy. Default MAX SG entry size is 2000 bytes which is experiment data of mem to mem, user can change it according to experiment: export DPAA_QDMA_SG_MAX_ENTRY_SIZE=xxx Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 41 ++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 383142fc75..e3f2777b40 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -12,6 +12,8 @@ static int s_data_validation; static int s_hw_err_check; static int s_sg_enable = 1; +static uint32_t s_sg_max_entry_sz = 2000; + #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 static int s_pci_read = 1; #endif @@ -761,7 +763,7 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; struct fsl_qdma_cmpd_ft *ft; uint32_t total_len; - uint16_t start, idx, num, i; + uint16_t start, idx, num, i, next_idx; int ret; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 struct fsl_qdma_sdf *sdf; @@ -770,13 +772,31 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) eq_sg: total_len = 0; start = fsl_queue->pending_start; + if (fsl_queue->pending_desc[start].len > s_sg_max_entry_sz || + fsl_queue->pending_num == 1) { + ret = fsl_qdma_enqueue_desc_single(fsl_queue, + fsl_queue->pending_desc[start].dst, + fsl_queue->pending_desc[start].src, + fsl_queue->pending_desc[start].len); + if (!ret) { + fsl_queue->pending_start = + (start + 1) & (fsl_queue->pending_max - 1); + fsl_queue->pending_num--; + } + if (fsl_queue->pending_num > 0) + goto eq_sg; + + return ret; + } + + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; + 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; @@ -799,7 +819,16 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) ft->desc_dsge[i].length = fsl_queue->pending_desc[idx].len; ft->desc_dsge[i].final = 0; total_len += fsl_queue->pending_desc[idx].len; + if ((i + 1) != num) { + next_idx = (idx + 1) & (fsl_queue->pending_max - 1); + if (fsl_queue->pending_desc[next_idx].len > + s_sg_max_entry_sz) { + num = i + 1; + break; + } + } } + ft->desc_ssge[num - 1].final = 1; ft->desc_dsge[num - 1].final = 1; csgf_src->length = total_len; @@ -1297,6 +1326,10 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) if (penv) s_sg_enable = atoi(penv); + penv = getenv("DPAA_QDMA_SG_MAX_ENTRY_SIZE"); + if (penv) + s_sg_max_entry_sz = atoi(penv); + #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 penv = getenv("DPAA_QDMA_PCI_READ"); if (penv)