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 4D6EC45B40; Tue, 15 Oct 2024 09:16:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA74A40B90; Tue, 15 Oct 2024 09:14:57 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010004.outbound.protection.outlook.com [52.101.69.4]) by mails.dpdk.org (Postfix) with ESMTP id 94DEC4064C for ; Tue, 15 Oct 2024 09:14:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pbxeoVB6pZ/+dzuVc8uP1l8nFY1ZbqDv0Y/PM5kP6RQw0l2P9Cwgd5K70GjQ0S49eh9EA00YS5pRdUUH9Dj5E5Vw93jS5tWhqUrkGmY6PLXAzjna0pEf4svxIn5OZxpAM63GxpuCwstn+9YpkxLCv6t53400zSabi7gx0Hii6PWRk7xfRbjkE4qvJardZZNdtb4TobwosI7Ar3AMBEBDuUJ59SsTfS6haqqV780V/58N4R7CtH6+WWysXukbMAqrZJkUt6G/obBAwFbA+3w7Kiu7bidNJJOkKqFnFsV/5KegzRJlfIdsIwWBnzVk8odGJxdp/MllVYbDgc7z3Gg+ew== 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=8v3+jz4W+NDpG6BzUPTykmGC6d7gwVkqD9mQEY3NnNA=; b=i2l2jhVixKHiUHQs9n1awY8vFeWeSod1MeNCah4UuGkxynmTuxFdeOpX10G3cO2t6x4QFL0iaSGoCoEpsVV6d6aoMtpbnRBXBA7saC5HM6Fu8p2PtGBZDNWVdy8PdmXQwEbVzeas5xHkROjD8gaY9+vGUw7AW6+FNMRe3ifiBRK3cNjirG9KnLrAAm0XzvnAesW0dnpiUWGS5efVK3pETbaMUoFvLhN71TLoQismQmSrqCvsSefssJiTlU2P3tmqY201SYSztz50tEbAb/aj/em8YNLDFqG/hFNg5bXSGXiMH1KTsdJSF1MxV2g+zEz+7PiQaQMxspD8/cLUDG/XRQ== 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=8v3+jz4W+NDpG6BzUPTykmGC6d7gwVkqD9mQEY3NnNA=; b=hebUK6hVpnlnIJaOoYkMpvkjL5Nj2xIZtiWedHYsgaISMIZg29f8xiy7gOmB5rLPTFAmpk4bwkap1Rrg+M7+f+95MMGKrSh9fj/wI8eOFXz/gMgVjitVJrjLLf+jdLYSN52xn44FMzpu0T9VhcC2U6K3BcMye5OtDIaF9Fg14E6FtNj/OcuGewT6H2CnowTtUFqaDWL6S4xcM2dJagneki4Xhs3Utwe1Y7lsSEW4Bt9bpmpZbX6HB6pl21vzi/cO+H1oka25J+fIEL87E4jlk8N3/6z/hjxKzO2vTtclqgCcNXr2SBzhbyhjlZ54s7jzRSfLFgwj5kmawnwq/ZeCvQ== 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 AM8PR04MB7218.eurprd04.prod.outlook.com (2603:10a6:20b:1d9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Tue, 15 Oct 2024 07:14:45 +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; Tue, 15 Oct 2024 07:14:45 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v7 13/15] dma/dpaa: add Scatter Gather support Date: Tue, 15 Oct 2024 12:44:01 +0530 Message-Id: <20241015071403.1940833-14-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241015071403.1940833-1-g.singh@nxp.com> References: <20241014093639.553467-1-g.singh@nxp.com> <20241015071403.1940833-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0058.apcprd02.prod.outlook.com (2603:1096:4:54::22) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AM8PR04MB7218:EE_ X-MS-Office365-Filtering-Correlation-Id: 848a78d3-e78b-4a58-a968-08dcece90be6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?irWfzvFQEMpUB8xLLq5kLoM9+Ah9RhU4RgiPtjqzt8xTEp7ezyLDetvI5bzN?= =?us-ascii?Q?XEJ7T17SAlWx6T6Hqi/Oww9sQJj0KET/kqxW5nqwnTAxK8CU0Pout0F1KVbW?= =?us-ascii?Q?+5ISqOnzZDylE/gO+wBGhLTsVOC7qBAYglzskBg9iFuIPPlQ80bsl4gifdHI?= =?us-ascii?Q?NNA8FoFYs/WgO2MWCnE20x8/21yLGCQuAZ3Yo+ZyjZUrla2KfHYySTCwl1Gj?= =?us-ascii?Q?GzhMWlyQpZTAqf0058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ascii?Q?XyePy4oIE705cbhgho8ZFsS+JDpS9/gLMUEN/EVG2Pt+vVF4wBRkThAIxjq6?= =?us-ascii?Q?zuhGaqU6jcU5DS10b0YIcP5QNAjMB88FGG02Tosl9Ib8jiy79XhKEFMQE2mQ?= =?us-ascii?Q?XmU2QfitISeBW/lrPZOtl39Pz807LyK7J8XBhCGUQ1ayIezruXEJqXIpu66S?= =?us-ascii?Q?b4pZkehlRoNNuQn21gGx/923DgFpIKGQk3zUXV4beUcrPg=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)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Vav2TifPyMPB658w6cnUuzO70f5RdF1ulLuliaUnxZrEZMM5bKSr+qXQJcio?= =?us-ascii?Q?YUGvOY+NgUi32afQOK3A56UoQg3BKDGle3zxYBAwOYmT5Tn5o/lB4EmO02wb?= =?us-ascii?Q?vl/F6yANwYPH6SK5MlPq5fUB6rWRCDfh1aDH2xrxq+Qf63eRPFEm6QTBOFac?= =?us-ascii?Q?BGabt8W6cBcxDdakJVPIGEUh4wwbx2VRdrATSYk5NicxKqnKifKbCe4V6Pt7?= =?us-ascii?Q?Knx6Xl4ph3a6B1ZnkznmRYGWJw88+RCWMaofpVet29X2f1sIRwcnmSXSaszf?= =?us-ascii?Q?v6p/Da5MEg2lbPM1H7U1y9VTjP6eJEKO7lYKTqlMAgZI3s9VRf/2684bDGW5?= =?us-ascii?Q?vui9SbRwYZWhrAalIjK2jahi/rVnt5sLh62rFcNj/mNk7W4zpCanhBV/y60h?= =?us-ascii?Q?ClIl5Wf5io2wxoaKFEKkUtrR4KyCcmxEuKa+hs7A5OCzovHqaFXA8K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QlsoAq+RbOL9W29YElJNPMn6+C/sWW?= =?us-ascii?Q?Gemp6G31QHLu8YuKaQiSnky7nDB9VMzIZqt5+FI7gqqGY19Y9qezazawUyuY?= =?us-ascii?Q?HFKWQUL+ljdKjZThjty77yNqPBIzFwJiJua8Ww2EqOtnfzTOncxAK9rxB5RB?= =?us-ascii?Q?kn2Amq2OwTRpWH7k7qh4Hfhh6IRpZ8FQJW5yJH02IRvLMj2+BwdQUqxdmpzW?= =?us-ascii?Q?4GiIISZzhB8g6eypOM4=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 848a78d3-e78b-4a58-a968-08dcece90be6 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 07:14:45.4800 (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: Bg5Rbzs/aMmzrJbx3jOaixDJTFJmRiI4dIfFz1b97xP3iSbwIK3rZ3qLMmlfOypw X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7218 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 6a6cfa85cc..2bde91f563 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -1025,6 +1025,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, @@ -1239,6 +1293,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