From patchwork Mon Jul 22 16:39:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142648 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 C3BED45683; Mon, 22 Jul 2024 18:44:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82AC340E3B; Mon, 22 Jul 2024 18:41:20 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013004.outbound.protection.outlook.com [52.101.67.4]) by mails.dpdk.org (Postfix) with ESMTP id 23164410D4 for ; Mon, 22 Jul 2024 18:40:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vzBriC9NohFp3Ks+EZ1xG14Eso15PHy6+JhGMYODrLMLtSAE0JXFdnYZ/6rErV7fGQwd8vFI9vhV1nSV7gaTJZ0mVIoHvFHLLVt1C9TbYblN/M1Gj1EVCZDboEeGAklhrFjXZ8wcpsFMhuQG2cRELohd8oa6ZGg1J8uwCJ7YvPh8m0hCioB9VmLu3pm7grb5komdBPKhyfR8AkW6ahgrtC1mEJ2rbRefdCJRFJlWBXG91uAssJj0Kmk2x27UKq+xHTIUUJfSxbLgqNVOkzVa2fzDk/Wr/fZeBvGh7aI7phTDz1FsvGXoFUih9lwjYXOy6KhlShLvjMY7EqPrOCJAbw== 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=lXHOvnLuW4C2oSNbDPW3FD8IQ5cifimbaHjD4+7Mjtt6jzKAIZLjKYBoyqhkhZGKU/wENIpwpDBRHzwaWqoC338Alqrz4xqPAn2fzDNm5sMeE6B3NYn0jqEtfLskF4ZjF+K8wqpWXBphqbPuFa2RYpPMr5dEBfQYxy0crDXycaVgSzWVMCyRGVFjGKjCoRoMwXxPQT79Az4ba+8vAqtHI8vqPLe5OIXGhyyvq/vLlhslNFw2bvOViIrcNgH2fNsrY/feMZUSzPQJVnVNFYL3HG+iYe3cdA7eKoN8E2NCdzr3RRESyFlrZex+8OT65U4TVGR/ZlIFglPItXq/F6tkpg== 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=UcVLdnw4tHcdiYFDwiX3bymBwiKeXhW5UTGmy2ffssqOsjlHsYvR0c4JdpZ2FUSHz24WCoMQ4LtcaAg4SAbLLnctFaDsbVNb/z23VoMROoNAP2qInHLQ26MdBcNB4JiBI6wuhdPEEIf1qShk/zpKIOkdvIcf1TpPmlOkmHUrkDo= 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 VI1PR04MB6798.eurprd04.prod.outlook.com (2603:10a6:803:131::19) 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:37 +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:37 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v3 29/30] dma/dpaa: support max SG entry size Date: Mon, 22 Jul 2024 22:09:29 +0530 Message-Id: <20240722163930.2171568-30-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_|VI1PR04MB6798:EE_ X-MS-Office365-Filtering-Correlation-Id: 25e0e5c1-bf1d-406d-1691-08dcaa6d0425 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: q8Axi8FPbJZrvVKx9xdXzW6/RSJRHUuI0QWH+Y2vX1qPYhokgwiZSlilskoJn0/rHsmKxlzNFz9JPB6M9jOiJneVM13cRKr4axwayNnR2lgoEaEbIZYo8msWolzzXJxT2sHoRxd0Fi92UDehZRL2acV41KLnZys27n5FhpW1YqVjoBx1JGDNqtkRJY9coj536k35c5pdgGTqvludysjnF+c1i3Wi93kEHZbP0+wEMeXSTsMajmuh6ZGUWuybrjvs2AsYd+Z2u55d25VQUVkyNk+KJUEXN7PQPJbi91dTSUTJKNhIYG7vw0L/7hkT/iYHrdRblnhzMWB8tS97pJ8OlZlWbt75N5xtextyvhWbDfR0z9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.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fpMLizIKupTlvVdLMSBsSE1zjRuG08JbPvYq0cjEzYMYlpN6SUuwoUxklD7MqqtbhHr/0gMzImF5FRYCgCNs42z1Gr1D7RP7T9CmQjKH8VYdR/3vvxfe+k9LHtTDkB8DqHvzUT44zCca5kQbZPxzmP/2v7imB1Ud2sZQ5vDeD1yqeBHMFVd+Yc+V+OAWxdpWunmrP68WhA/314xEFuSxoRVOfiD0507ODg8XQU7RZl87Ar8Rgn7CxUtsMy/Cue9Ux82eQbEkaBe8jJ3zpXf60plxzphTfhNBpT9KVYZGU/1oqM4OGDPj57095RXyCrRdXVbUPwQiMF7nqUE9IBU8/wajUxFdLYL11k2NudyLiT3bR1Tck3SJY5QC9/LPdglD1L4PAmfQHP5D0rGaEE31YSF9yjoa02H16lHtg86Aw/325fLceYdB6OaLT8TVthiyLB21eJjEttxH8rdK3Ae9kN0NjJpoYCLedAFEJDlGBCyc60u9VJhrc9X4inuIzvDadyGsMA5hUa9COl7Y3CaMzuhJNgIRmO1r6gJDAnEyZJlhtBKQOXzZGa+CGYIDp00siJPMqZOw8JCW0mpki7m960gozCMrUJWVJmhGVX+jZaWzHC6HM21Wv6kRMjVQRoDW17c6z326JIfaerXRvBwZeop/VSOoXonUAh8AQ8Kd1Wyd9/JEc/rL6S3tFUq1y5vnK1nPtQ8JiddezHJWj6pmQqynl0K+ypWxHiizSa8xkTtBBmcJwT3DPFvBsWa9DzZOXjR0ikPG0VDYTue0GCQMGdkFby6gUlWU8vQzDExPxkA9vxE/E6bkVq2E6nJzOpESAZG17dh7Np3JVf3/DrRJD7Z4rrpm0+5OOBjLDE1dj8BbRGT1Zyd5TKj6zQBY38FNREr4DeRsQX0oE1zi0/kt7zgMjjcLMFv0rEIHNYjBLymLcmxnAs1g7M7PdLQGs8jyVIu9wLh6PXhMjf0CjzsmCcibom0S8uSkEdoj2dkRSwqI6HpBuHUAuJUPjhykl0tSslb9z4fKK6hbcCdBdDUkoZpzmBIdjUuxczDtUu7bHvxQqr6klC+fC8PNMOCmvLc5/rnnLjy3kmOiZhvC5RYHFs14kuWfH6zgr2NyAvdqv0Yz7bOUO13hdYWtZrML4EG+UM/DPgiZ62Iyc4FRsoa5yGqq0o/odnWeCKGD1dWmZrR+QdM6TLz1WXSBS85dseZACG2TpOJLJEdZhJGAoNMJznuv8nFepA3FJLAz9206Ah1sSh9aajh6ecN4nL/sgyu1vkyNMsSinqYGJzzrtSNieLNGlmlNJUioz5QVRHgElqeI+PUo8yGgEROiC8jqHjaA5efx5QtqN/AadiZCI/UMtIJuWrC7kGfOA1wNz9OjWGaiir8tdXddzfabPY6GGeP2BzxCq0ANbL8yS1XtjB5GMzbPo7iKLYJulUtwwG4SQD+TLNiXQpChDlB1mxb4j+uVdjq1El2BCnHhFiIwZ/YQAfkiy9cDFyveSAyybtEOPzQdFCbX4SIxeiSgKwA3T5N2T6ml2aInIQTPpzbFzz9oNVZ4ZZO3kIqfl7/9Srsd2L2Hc2Tgqv8RWuihowG9CkJo X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25e0e5c1-bf1d-406d-1691-08dcaa6d0425 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:37.8757 (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: bm3VlUGADatPAOw+Qdasw5dqQvOkGUo/nDAy2jx3Mo99MJCIOLUwZYDIK5LnN8DU X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6798 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)