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 345DB45ADF; Tue, 8 Oct 2024 09:27:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0CC440E19; Tue, 8 Oct 2024 09:23:54 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2088.outbound.protection.outlook.com [40.107.20.88]) by mails.dpdk.org (Postfix) with ESMTP id BC98B40DF5 for ; Tue, 8 Oct 2024 09:23:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cnVUAkorTOJ/2xroqmkUrEbP/2lEdSnvGMv9xVQ4LYgIAUlfeqOKloEA+cshTL1E632dxxOV5nVQXXeyBpxOJyoPk6SJxoA5D8jtVAy35/mMKLM7OT9prqLjR2MivTvcFtmyFZXh13HTMDSwkzPBJf+magrKM0U3hsJD3zcK0YSKFtaMX1TfPlYreyFaAY2T8qUe/lLQlwrtgPiOvOyr9ME7ki+LgbqrDJzRSHO8hjcou6G5TgDlkBv4ck4N9Vz5unj69wBmTqA2npU73HmKKXHH2nt8TmSA3sB9xvIZ3N1B/8FaPfyf217IY4Oxqct2F9wUZZbLxDro4RozQ8aqdg== 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=Chy6UPpZCbLfE/ng1HK/pnqZMhPasMPwjSr2K5OF79E=; b=Kitlq0KGlYKKlbkQ3YHG7euc041YQGyMdSuZhoJJFQTH9xpp80ydj/Ird5CCxvedGtD7KvIc/4FhZRGOvBTIxQ+h3PiPGf3g6XLq+WFDf5ikj3gYD7W/BRVfT6SY3+uepjS2u7qDdhgWTQ1+VyfyASa1bQRF+8wRzbtRHlVZmKLGTXz6GxmXAzupf1dxyJ3kykhlYTBm6YX/CQd5xZ2AgTqtsg3ukoD/sFc3yaXBTCndkJAHuCEf41QMzioBotr/ofXhTiEc3U7Nk1x8YfXP236WSsnWr5n4wdw0w8v7HS/2ED8o8+N2BnpOvmCb1hHXHwHIjFNtItkGt3TOKaZ9ZA== 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=Chy6UPpZCbLfE/ng1HK/pnqZMhPasMPwjSr2K5OF79E=; b=GQYgRZ9FPXWLQDLBjOWwGu101S9jI5/zXfSvsTZLA7+nGu6LNMOFq48IA2HgA0EnMK8dUn2SULWiuei2oHkreHCTFIAcpXOnGlL34NLGGcMwWRa4b36JVTQTywriFsXaRmZpnEA+MoyMnvaD161Pi4Tnrc5+ql2OFx11cO47adIBiNQwcuIQ/F2Eh0CHBj64OofS3uWXfZektu3hmk97VTKbD9Iffx+rYUZlA3pU5habhRyhruG3G5ZbfIJOogGs7QRmANGxt/U6pPPxheAm2AxfE/cqjy1VQ6pjPdy9KqlfGc2KvkzfY81rE0omNOEjiipWNmeXTl9xy4KVlYhR7w== 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 VI0PR04MB10829.eurprd04.prod.outlook.com (2603:10a6:800:26b::16) 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 07:23:50 +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 07:23:50 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v4 13/15] dma/dpaa: add Scatter Gather support Date: Tue, 8 Oct 2024 12:53:04 +0530 Message-Id: <20241008072306.1256445-14-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241008072306.1256445-1-g.singh@nxp.com> References: <20240722163930.2171568-2-g.singh@nxp.com> <20241008072306.1256445-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0221.apcprd06.prod.outlook.com (2603:1096:4:68::29) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|VI0PR04MB10829:EE_ X-MS-Office365-Filtering-Correlation-Id: ebeb3f17-3c1c-49d3-1892-08dce76a282c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?RxdBjpW6QgQz8ogqio3g9EenoSIEu2rDcwr6mzwbtPbMa0vTkwlFRU9P1xA/?= =?us-ascii?Q?MeL1x+AzQBVuspi+TkfJ21lWdj7Evjx7dAhYBjCOgxGcRXKt2AoALn5PJpV7?= =?us-ascii?Q?U0SibhOZ7/nJnxmTYdS1SFWDVVwsUmtbCHmGEOakeh2IZCc7cbg8O35uy0Ay?= =?us-ascii?Q?8V0+BHSXMAaH3lgdtCffilQuogEsdiGv5PF+Sz1jJMAywNh2K6DeH0Q7xWd1?= =?us-ascii?Q?9VOlrgvNVLOQ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ruj7T3?= =?us-ascii?Q?P56IpOJq5IFCKffDlgfvu7E51VlWXWDI4X5PgKMEXFljIFADGjlVJl8DpOnj?= =?us-ascii?Q?gA8myjB5KtHF0fPTBi0SkQkw+h15UVQFr9OqEEWXzSMckdcy5hi5lh17hf8s?= =?us-ascii?Q?RPycvqcLiPNKKmlzyQne9G8sTq2y4cPpBV2WhEf3UqN6FI6mOR/JkMhum+IN?= =?us-ascii?Q?prubag/QREEz8toQpZ+5tLwHlmKQ9ZB/W4alnxS9TVKkHQ=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)(366016)(376014)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?O7toqhiD0Hi9ltCXEPHs0cUVBaSCtNKKCH2DFLx1GV481Ik6DB/FhzCkp/k9?= =?us-ascii?Q?lmUYtRiN73xftsvjs53ASF3hEUk4l2jTQf31Q32Uhu7N1Yu2FT1byQdrZoh0?= =?us-ascii?Q?uuPyD7j+A7MKQFmbPlJ91xWe1EoSmKctJzdpznDoQuliKsBern8CDKAG57cj?= =?us-ascii?Q?qbjnMC5TRoiCnw2uUiqD2sX9ue5yyg7cRdJtMWz9p2/Ep5tIzL+Y3YQx/cmV?= =?us-ascii?Q?3eJMOiJDBiRLUTmdXhMpJCrphYxTA/h0+nIadj278MNzCbn8TDUKyuJ63TP3?= =?us-ascii?Q?vEV+/GQp/4kt+fK9rR8k5QwN26AljsCfzkNUNm+CUYlJJ/+oabFtJ4kfrddP?= =?us-ascii?Q?ek60SsFGZAIoklK/E5VLGkvmTo+3iX2yAf/gTtah2IMWfArheNXTd5FDbVx+?= =?us-ascii?Q?W2K/ttYiIIEDIuk4AA+++wOtuNdcjQQ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Fu8HKpnWJcIb8/fh13893/3RmalZq0QOAaO5agk1Z8KQ0LBdCGDG2GF?= =?us-ascii?Q?K7PSA+XBt+uwug3s4HS/T9G+BJXsgmxtorJD5VSR68ZTX6xVJ7XiulNyejJ9?= =?us-ascii?Q?RYZ4LNLkXQfcSOiAT6A9Av/WzOHmKw4oRVKfLbiGjgGpZlxL4MTWJ9Md8fnT?= =?us-ascii?Q?5ad7rgtt3TtbZ+ZsCnIdoGGLh1c8oIxcbqbrHXB9sDB5dXuqJc52+sTcJEZT?= =?us-ascii?Q?qV+sl7qTVXqXJ+A5Ack=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebeb3f17-3c1c-49d3-1892-08dce76a282c X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 07:23:50.8455 (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: RAiAkO++fNwHZ4rpMGTLJCzkMyuSX182oVb2KwHeFvHhibMKLsuCT2ZjIgg8Z/Up X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10829 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 6d8e9c8183..0aa3575fe9 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