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 5957E45ADE; Tue, 8 Oct 2024 13:00:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7308040E78; Tue, 8 Oct 2024 12:58:53 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2063.outbound.protection.outlook.com [40.107.103.63]) by mails.dpdk.org (Postfix) with ESMTP id A07E640EE3 for ; Tue, 8 Oct 2024 12:58:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jKINRhTNvNeZNAeSO4Kvysr7t0VLuy9Z4uzfbZJR0P2npgGHWbMYtePaCgidf8WsXNsxwJ+rEl2F+aHYvOusakYshG3Vs6/lhlrDYPt4nwVLzcCI2Lh6vENiPhr1kh0+M8gN/f5tx6iHbB+njo8YbQtr0SCiOLzsmiKSJ5UhMB8zJT0vxCz5NThTsvaFsri0/CQTaPGsfJvJuNAsuSRsr6l0+YT8NRaSi5Jflpi89NN8ShUb06Thy7GaP4gJSdLQ9zqJISLOTj+KqK/1gfQSKFKTlsGsCQjWXrg4Qfa66i+ZnBo3JOtXKPhNtgQnP/peLSR4wixxtGgJnEvXJX0tGw== 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=XzFqr6VK8AL5RQQ8Ie3ogqlm8cwGz1ckAx/ncNm4H4Q=; b=VqvLqxSh4Ia6AAPr2A+G3mOTTF511Sgi8ikygGJDrlP2ZYUKFd8IK1LfQTjkovfh1P3YDSjZBdnhiMJNPl9UA0jiPGkHOkmlbHVU3xnPFp496h5cnBaakIVUNGDzabEyL6x8090jTzQR9T037YXo0bWE5MVzQqmBxXMiY6fTnY4Kf/Ck8/nIf3RUpkKf8Cp5pNprgg82vI3CJNzCUkAAhligjpkuImKZ3rUa18ut0Kx50M521avRlK13+cI2647jeqWkJGhaDq4ewj0eUNTpecx/lOsrzpUTxw8B0sWSk6AMMPNrWHnCcV/C7YerVsBcxeB4o36C9i6MZkzwzcKSew== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XzFqr6VK8AL5RQQ8Ie3ogqlm8cwGz1ckAx/ncNm4H4Q=; b=I8jukfpmFDMdrnwpcay6v/xU38RWKFtcah0bH3c+bonCikEjDmJ5IwnF1rE2LY+Hhmrw0KMw3WFHTnnGY5Sof1CmhafFLMeHtYCdLD6IugeLKr82skAYkRRLr2XJEeTe0jliHDTfti4KjjFuv2BpojWvi6IcTwipSwHtRmogN+1Yf2T55a0085dEj85ldWAaMoWusmEAgmkQIuQAWk/luUrrWd9ozzUDVao+VgNIyZ2TUntTUS56jzEPfY2BQIYwazSdSQ5q+eGSYf5gugPqBcMVWVQHXS7j4aRaBZ1c+Ch7CTEKu8uLmFNNZrCy6YencY4C5slAqC8mDxtuS0np4g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AM0PR04MB6932.eurprd04.prod.outlook.com (2603:10a6:208:182::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 10:58:49 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195%4]) with mapi id 15.20.8026.020; Tue, 8 Oct 2024 10:58:49 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v5 13/15] dma/dpaa: add Scatter Gather support Date: Tue, 8 Oct 2024 16:28:08 +0530 Message-Id: <20241008105810.1454133-14-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241008105810.1454133-1-g.singh@nxp.com> References: <20241008072306.1256445-2-g.singh@nxp.com> <20241008105810.1454133-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0123.apcprd03.prod.outlook.com (2603:1096:4:91::27) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AM0PR04MB6932:EE_ X-MS-Office365-Filtering-Correlation-Id: fc4204ca-f391-4065-07be-08dce7883038 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6lG6s9o2dqSueO5PG33nzkYXrUOyamxymroXf1d6fy+MvaT3/P0X2Lc87iV1?= =?us-ascii?Q?r5DEQfnWbjve5Toaz3oVq5OrWT29BrMPacUl5Gygje46OAUb2YMHegFdmMhX?= =?us-ascii?Q?lFIZwV3gwExArbnUN518vvZ/lXfRcNd/PTk1Jq7t+4zcerIu4mOZntqeMpVY?= =?us-ascii?Q?6yG56Bm3pJIkyqXdnRcNzW3ZNwHrCprpDeGEwi7ymfww8vZPxmTC15L5rh+H?= =?us-ascii?Q?4QoiYo6NX1tLTES2Wl+89R0nfa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ascii?Q?IhSZJEKxbtMgyzEJs4Nku3ALUPqpf6fK8DCgl1dkNbZQ1Eyvd/uusNwcDIUy?= =?us-ascii?Q?Mq9yzGQfkccujumQsIbfrw0EYuWMzg7yKP2QZR1WflNhqldj1i6dTo5+ypKi?= =?us-ascii?Q?ikL2w95wjn4a68EgtN7+Ein3vMmyw5jN+BA4W9m129aeSKLMfRiZ/24qLRwt?= =?us-ascii?Q?FqXdbpyZYA5iNLomNMsKL6PMhj3Q3ZqRIBoqpQVjU/OBpQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?AzzVcSBGs453snffIYHD4g3O3lG9rg4k5D8GhwgGybYF4qQE1gXdkgpIp32o?= =?us-ascii?Q?63FXvgzqVTZyEdJ3kXsOf3mmtsn5tZl4ZUIO/sI2t+XhuJJvyTozFrrlL3aZ?= =?us-ascii?Q?Y+a7bqsbhGr6ieMShWkqN58yqwaAggqUQix+UMoSdLGfvQg46injikpTFBC6?= =?us-ascii?Q?AuyO3GUGlFSOxhZrOvgHxvb8kCqdmK18SboY3hXVAm4oGzI0rabXUSW1X88V?= =?us-ascii?Q?aGGu6NgX04DWzOiAsxlTUBSaQqTXyLgZ3+Pygegeof+TS7JlT7/bEw/d9ve7?= =?us-ascii?Q?5BeIaHF3Ecry9wrCDySacKBXbe8NEpbvWsUS6AO1+uefKaPryjLyQL4LU08e?= =?us-ascii?Q?GbNCQpqbyrkOYMHnkZpm8w2tnQ1FFWPJVimmeRAvOxVSM5F1dHqEkWekYDB6?= =?us-ascii?Q?HlufoKULMlQzy1kOLluiaYUzLEQpA3e+C3XbQMQ4q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b2ZwiSDPKIUPDf7bkB1sBGpbnIkCVgBaC7p7vi?= =?us-ascii?Q?AiR8l9bzcEsXFAh1LkBdxNezK9e8Q8/ecCe3BByOlF3jH5s2+Af8u/FEu8Ri?= =?us-ascii?Q?msWMXbJNxzw30uIlDuPVT6D96l5ohpi3gYCJzH3Hhs/mGbPrWs10vRXeGFWl?= =?us-ascii?Q?v9Cr2CxHX2eOxEFA/GKnab18WVRea5SjYcuz+MEpSI1+IBbn0ehDFjQCk1FA?= =?us-ascii?Q?Hxis9bvPq+xbGOgFCp8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc4204ca-f391-4065-07be-08dce7883038 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 10:58:49.2349 (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: YfLW/jCThfbaFQJyd5ZoeF9tuCjDQ/sa0j5lqaOsFO0L+OYkDjZoWf9o/+AYA8E9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6932 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 Support copy_sg operation for scatter gather. Signed-off-by: Jun Yang Signed-off-by: Gagandeep Singh --- drivers/dma/dpaa/dpaa_qdma.c | 55 ++++++++++++++++++++++++++++++++++++ drivers/dma/dpaa/dpaa_qdma.h | 10 ++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index b2e96432fb..7c199b6dd0 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -1021,6 +1021,60 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, return ret; } +static int +dpaa_qdma_copy_sg(void *dev_private, + uint16_t vchan, + const struct rte_dma_sge *src, + const struct rte_dma_sge *dst, + uint16_t nb_src, uint16_t nb_dst, + uint64_t flags) +{ + int ret; + uint16_t i, start, idx; + struct fsl_qdma_engine *fsl_qdma = dev_private; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; + const uint16_t *idx_addr = NULL; + + if (unlikely(nb_src != nb_dst)) { + DPAA_QDMA_ERR("%s: nb_src(%d) != nb_dst(%d) on queue%d", + __func__, nb_src, nb_dst, vchan); + return -EINVAL; + } + + if ((fsl_queue->pending_num + nb_src) > FSL_QDMA_SG_MAX_ENTRY) { + DPAA_QDMA_ERR("Too many pending jobs on queue%d", + vchan); + return -ENOSPC; + } + start = fsl_queue->pending_start + fsl_queue->pending_num; + start = start & (fsl_queue->pending_max - 1); + idx = start; + + idx_addr = DPAA_QDMA_IDXADDR_FROM_SG_FLAG(flags); + + for (i = 0; i < nb_src; i++) { + if (unlikely(src[i].length != dst[i].length)) { + DPAA_QDMA_ERR("src.len(%d) != dst.len(%d)", + src[i].length, dst[i].length); + return -EINVAL; + } + idx = (start + i) & (fsl_queue->pending_max - 1); + fsl_queue->pending_desc[idx].src = src[i].addr; + fsl_queue->pending_desc[idx].dst = dst[i].addr; + fsl_queue->pending_desc[idx].len = dst[i].length; + fsl_queue->pending_desc[idx].flag = idx_addr[i]; + } + fsl_queue->pending_num += nb_src; + + if (!(flags & RTE_DMA_OP_FLAG_SUBMIT)) + return idx; + + ret = fsl_qdma_enqueue_desc(fsl_queue); + if (!ret) + return fsl_queue->pending_start; + + return ret; +} static uint16_t dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, @@ -1235,6 +1289,7 @@ dpaa_qdma_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv, dmadev->device = &dpaa_dev->device; dmadev->fp_obj->dev_private = dmadev->data->dev_private; dmadev->fp_obj->copy = dpaa_qdma_enqueue; + dmadev->fp_obj->copy_sg = dpaa_qdma_copy_sg; dmadev->fp_obj->submit = dpaa_qdma_submit; dmadev->fp_obj->completed = dpaa_qdma_dequeue; dmadev->fp_obj->completed_status = dpaa_qdma_dequeue_status; diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 171c093117..1e820d0207 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -24,8 +24,13 @@ #define QDMA_STATUS_REGION_OFFSET \ (QDMA_CTRL_REGION_OFFSET + QDMA_CTRL_REGION_SIZE) #define QDMA_STATUS_REGION_SIZE 0x10000 -#define DPAA_QDMA_COPY_IDX_OFFSET 8 + #define DPAA_QDMA_FLAGS_INDEX RTE_BIT64(63) +#define DPAA_QDMA_COPY_IDX_OFFSET 8 +#define DPAA_QDMA_SG_IDX_ADDR_ALIGN \ + RTE_BIT64(DPAA_QDMA_COPY_IDX_OFFSET) +#define DPAA_QDMA_SG_IDX_ADDR_MASK \ + (DPAA_QDMA_SG_IDX_ADDR_ALIGN - 1) #define FSL_QDMA_DMR 0x0 #define FSL_QDMA_DSR 0x4 @@ -194,6 +199,9 @@ struct fsl_qdma_cmpd_ft { uint64_t phy_df; } __rte_packed; +#define DPAA_QDMA_IDXADDR_FROM_SG_FLAG(flag) \ + ((void *)(uintptr_t)((flag) - ((flag) & DPAA_QDMA_SG_IDX_ADDR_MASK))) + #define DPAA_QDMA_IDX_FROM_FLAG(flag) \ ((flag) >> DPAA_QDMA_COPY_IDX_OFFSET) -- 2.25.1