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 1E9BE45B36; Mon, 14 Oct 2024 11:38:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68FAE40A89; Mon, 14 Oct 2024 11:37:31 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by mails.dpdk.org (Postfix) with ESMTP id ECACE40672 for ; Mon, 14 Oct 2024 11:37:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T3E4UseWPTs+UzN7NKAOLV8poPDAAl3B5ojJew/C37HIBWLSOGDLu602zjIEJMS+vYHRT8hLyUx55IyWz3XVRyXc6plHQBk9Eb05jtgYcPOdJ33KyEWWHzbIzdKBLPRFpLtN0QgXFF/zcRrTCnLtC7N3h0A0PHCodJeA8fOWwlJAR8VaYUEiQo6VpnHZK3FcsO6HFPWHYrIE/Xj/gM4pNBwajNf7l4xnAUx45mSplfKu+oRygHBa9ifJq5VQ8IuPjUx8qvrs6Oc5xwsr+Bj6AKorKogswp8iHJJhg2AjybKP3m4osYB/rgLKJ7Ubof5N8QtGyo6tq5tQZqGKs9pfWw== 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=gVsp+nSRvDCVYN0jW7dGhoYXwb4CV9BzDdOwvcwJRz4PJsDNvZQ42GTCGcxaM1iKcMDM19xVDT0EgWZdISDanXE/39JqM+HiGMKXiEZ4tyBk5RaiyCqTjtJ1elDCu3CMBnaVd77za4GNiMQezSH6Yvfo2wIMO8s+Frv+ORmlBEfz+FKikrhw6isFFkD2bREyDxSFbTxDY52uqoXo4wsCkKvZbZiW9P7exO7coxqpezRGgIyEHs3I0k29k+QIC2mxEB8yG/mwkXml8tWKc2OjLsYV626eiRes/OfCiJcqqGjZmPFxGqxx8UcWhWRWugzvu/p7+KU3GwtQ8+GAnuZ9ow== 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=djNYyWmbcAaU44ErRvlB03RznsHlIMsycB0ltAkBcson4NVvM2pZPfPAE2kuxw/q3buqWoi2ZVbHnKSNQzT5UpDeVi3c9qaiaLx9ylVyS2JXh25UzZcrmmp5jr2KITb8jWgbXvL1lnbgWgQ19XwPWCoaB/o56hkjPaiS0GShVpgLl+rNLbUHbR6p8sT3hWcQRL1BsAwct3typXKBRyWDmOKqJ/wjXLf9TOAd/PtGVZMajWnrM0493Vvc5NdePOMmPNGuF0Us+ILX5k4doXO4EOV2jNDm5P4KNBScY7x9fJG0BMoYHuUgaD+RM50F8XPd81vKrLXAsTZtIjbLa10ZDQ== 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 PA1PR04MB10580.eurprd04.prod.outlook.com (2603:10a6:102:482::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Mon, 14 Oct 2024 09:37:20 +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.8048.020; Mon, 14 Oct 2024 09:37:20 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v6 13/15] dma/dpaa: add Scatter Gather support Date: Mon, 14 Oct 2024 15:06:37 +0530 Message-Id: <20241014093639.553467-14-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241014093639.553467-1-g.singh@nxp.com> References: <20241008105810.1454133-2-g.singh@nxp.com> <20241014093639.553467-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2P153CA0033.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::21) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|PA1PR04MB10580:EE_ X-MS-Office365-Filtering-Correlation-Id: e9fc51f6-2267-467e-7434-08dcec33cc8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?kcVekD6huBrSRJt07Lt3YDAbvH3V9KdT4spj5KM85V9zoeiGyn1vN3bjUbEg?= =?us-ascii?Q?8tzrgpFSdWbwiSij+yojpciqr5wdx24yWv0ggoIizph999JKvHyAklvAPPvC?= =?us-ascii?Q?FfZUTmIgROzSePvmcUlx1KPyevmjL2O/gz64rjMCqyoTu2hzppRzG1CUcO+/?= =?us-ascii?Q?YYL/4RSlQCrZ6d5aRGxxlr/SyhElRPtqnopSFJeudyUDczEqmxUZOFARLOTY?= =?us-ascii?Q?36Kqp05rFtuZStc2eEqZfg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ascii?Q?z523JzhBo5m96nEsAL3q/PIr0p/zVl0Le3Wb94CN46oEzP3AfFpGllMAyj+V?= =?us-ascii?Q?ups/T9NacAfQ98FvnAJ7OFogukM6yVk/TmdPcrs8Wj/2eQ+vzNycCtSbVCcb?= =?us-ascii?Q?Pw14WXxx0jl7JNwAaRbha0LnfOaXixGep0dC9PRCAb1QBlL0wXkA7opieP8k?= =?us-ascii?Q?GFvkckoEqur5gmQBcjs8tYNi58WiBj15jrb7G3ih90l50w=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)(376014)(52116014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kl0+MfWoEz66Rit9QaKHPff6BTf2qDtwRHa7gTRCq0l+dON2Q+GKMEF4UQYd?= =?us-ascii?Q?yPpyg8Tow2QgiIWOd0jnRmpMfuP+payjGXkfytPmNTV+2Q/8PpUi8Wl1h+Xv?= =?us-ascii?Q?NYDy586/dtDozzFo0rz4RNRZ7BaGuuFyFYJVeXSo4AS6lvMRkFEgn28X/q3A?= =?us-ascii?Q?l7yS8WozyvrMTzhp6NhiXOU0Qm1r4nwFdnDM6Zs4QpZNJMKP5NeqqYd8oMKT?= =?us-ascii?Q?cYN8Ib9bnxqOYvl2n4yRCQtwajOJCw4OIm0QXkc7GeJ1eiHbvCzYO8Q5JEGi?= =?us-ascii?Q?bqaUWh3vkat2Ic17ftulcLh/+o3Y2lt69Eu+z3ovoTBMlFI+qD725D/T/Bn9?= =?us-ascii?Q?1dUMpJM3cR45O2LduaehsuZSlJidsPogfyc3HFIF8RvHePQQJoM/KobbLoqD?= =?us-ascii?Q?uoblvgeLzydScne4CxueGpNAKLNdM94V2OMbAOyZctG5Su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XqS7K0L6HJKEXFf83HO0XimmWTPRil2OT?= =?us-ascii?Q?brLfiPhCak/h1sh27UfZbEy1agODOCVIdBA4ARAe6ZpuoxX6ck5gb/ebv5gF?= =?us-ascii?Q?SxfaMP7lbyWoaBPLTbQ7ZNGgJGi4xFEuwT/5HONVk66lc9g0M7+m2AkwbLJ9?= =?us-ascii?Q?FllREWiq3CfDCV2xdN3SQ+uonPEgH7jf+1TqSVAfnLqtd4ytNwdWNPsE5Rny?= =?us-ascii?Q?g/ISIVkLVZg/Y8tdYGk=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9fc51f6-2267-467e-7434-08dcec33cc8b X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 09:37:20.1215 (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: g5JBb9WOy5NfHte4gXKx9ikSPWNd7MLfhqKZnWuXUjHF9qe/MGb+SEEW+hEnLDcO X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10580 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