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 E67C645681; Mon, 22 Jul 2024 14:03:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E533B40A6D; Mon, 22 Jul 2024 14:00:27 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) by mails.dpdk.org (Postfix) with ESMTP id 1D9814060A for ; Mon, 22 Jul 2024 14:00:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=upbdbPMcZIoGsGpr50LfAJhFSChaE2atXWazgNz8yAD+WQgdfImSE7oa4aPGlO0JMRU6uyu8aTuH1oaVR/B28Btl8IiECiGTd45LC2WJu9KohTsvykdNZ6LjiqAaDmzyh+AQAukvTa0Wq2zAnxYLKQjZU8C1dZ0RVVYT9MCcB3tqQdW3XFQ3jIBSIFbzBi6w/aE0kYjgxblCJtmaR689/AZvR/lXNcTfmoaNUrRQayPo0dqsGJqo9WfifaGqzLLRaTy+NA7faRj2cBtLQ0I90YQJuTlzvpJJdgVnoN6Behi39bP6ThmWBblFSRdi6VlOYa4Df50wqszja+fC961GwA== 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=Nd4k4D4gKzdDG7grH8cG9DZORPVz18JX/fj3xysIugo=; b=aKU5iEFwWIR8xtgLZiShj9dv9zCyNZTRHa98i05xKYMOqGl+9/dKlPz4pbxHj22+cuogEI8phSkMy1j9dhXrSZ8vMw+gOnPD9ywWpExrbyuom9UPDnvAnFmDV5mwGKAMsEQc21i4HV8wDs++SKYWrshub3r/i44eFyBAkeTQJMWh108g/l8hyPS8RuITmsU4uMWa9RtB7inRPlcTUIT7+VWpu+IlyYyBoXHFgRM8RdEoMUKK/QciSkU+P2PnNytiH+AT0VzpleNDFxuSQdhcVNdKuQpllUqaFdinXyQCPcw9YOkv+01fTobIUO8tx36tD2+gv1tHzRZx4MtLQxNJyg== 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=Nd4k4D4gKzdDG7grH8cG9DZORPVz18JX/fj3xysIugo=; b=fr0D3l5UJiVRGjjjlyGiNGd9LgCfY1Vo9ZD5l6XuI65X1b4HRcx2I/dyZFhlclRxUO6/H+9ROo9iH988Dv1Z9SJm8yKi+QOIElBDMe9Qahp6g38uI/lNdp8knfr10JZ+7uByzNqYaJTN8+2PBviWpqyJkW7c1dFeT4EE89BEKms= 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 DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:59:13 +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 11:59:13 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 07/30] dma/dpaa2: borrow flags of DMA operation to pass job context Date: Mon, 22 Jul 2024 17:28:20 +0530 Message-Id: <20240722115843.1830105-8-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 67967368-0bb7-4124-a205-08dcaa45b435 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?+zWWZAMRStOSefyT5GajsAICbuZrfygj6wMY0V2EP5GX4d7dJEoPVsR6XAw4?= =?us-ascii?Q?7D27NoFghQtzrx29XyNMTxBNZlQRG+NpSM1f+fnEXQxrrSxAmjnISUgWgYqV?= =?us-ascii?Q?eEQeI2bPjvlpPAfSlYiY22eRzwIuBVnStRbBNCBQY51DDIqsuB9iFQot+BRx?= =?us-ascii?Q?HLDcj38h+vyPu+jndr158UWH2J0mzx6EGrCrVbEl+N1sQfydKD3P3qriMlYM?= =?us-ascii?Q?OOJktwAP5jQ7y3nRlt/HkR1QMhP8MYsBhSvQtZMYfMKI9RDhgH7FilO2K0PI?= =?us-ascii?Q?4BK3z85Uyn5u7ar835+EfaYX1ZX1YZgmMGdAGrDfU9f6ysd0eGJSUmHYF0q4?= =?us-ascii?Q?Dw4z4sSXssSxLm4+uJczY0XlKVfcIO9s54MnU5kTuDoIl1vfGkXtpdMfDq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K+cR6OVgIFGOBHbcoyc/B+Kzk10RuXDN?= =?us-ascii?Q?2qJ4f8WXkzursPwjVf3oXZF75VP3iJOrswjrO1fox6nnkjKTTUXMm0fIVmZM?= =?us-ascii?Q?DC4FF9bQd7jr5J9U686hznWQSOtwcsbA2SPQck0jqwVLflQdag=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.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?VSkN1e86Po6zu6nCPyPAMmvx2P9PgDJDbYaAeLHgGleadQBgleYaxmWhPWP7?= =?us-ascii?Q?PvnmNA/cUV7qbH1NHU5Kdpor7ypQTE8viE6Idqp5dQGABCIy5/ZihOAuS3Ys?= =?us-ascii?Q?scQVbMwI3rDUL4l+5U6RETqUVrrKuZB0S5sN0bj3PypPMPsRq6gEFPDQx75E?= =?us-ascii?Q?Wjw5TYEy/iV+CgWV16g7dgdMRo+CCWnzXSP0bibrwz88jKRVUdxpuTCoZ9qg?= =?us-ascii?Q?Ob8uD/XVkvx1CZu8+kH7AM/WM26wYpDoDMW3x5pFLDu8aw8IlUMb7+pN4lnX?= =?us-ascii?Q?W54vOMJdUBUALLjsPm5eAhhbiBVa0A84zj4cbHNroi2fKIF3ZLG2w2+AC0S8?= =?us-ascii?Q?qUwV1ZPVWf17yao2AK4vOjtw/nUdQonDjNDq1BJ4XYdA/KOMKWTDOTA/Zyc2?= =?us-ascii?Q?1cI1riI8I2AJiUB3MsAR85ajsGxNbe/P9QPszMBmEsB2VPv2hw7yIY1QnrLw?= =?us-ascii?Q?3v33VYTD99FPKfB9vM/AUoMOUX7boRR3LP63Yg//v9nXm+o6BFwkD1Dfw/zq?= =?us-asc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vpuCC/HrUNJk6oGU?= =?us-ascii?Q?OXouXVDbPPaIQz5sCVaKn0qQ1tCchhYWCk3Kxgj6Dq4I8IbcmjGAfSZuN8bb?= =?us-ascii?Q?+sefATvUnxKMZnudcv+dprYNhHExTv3zMx6zoPsOZWYCpQ6IgpR7gGeR2Gbq?= =?us-ascii?Q?UAlz2e8Df0r1qDGiMIUS5vMHUpJdV+0MzwZtppS6?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67967368-0bb7-4124-a205-08dcaa45b435 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:13.5952 (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: tN/bPuVAaNs82YuZyLYS7JJ57v88hxbjCUhAUb/gD3NEhfgk405Ob9HiDzaU1+HF X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 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 For copy_sg: pass job index lists. For copy: pass job index. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 92 ++++++++++++++------------ drivers/dma/dpaa2/dpaa2_qdma.h | 7 ++ drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h | 15 ++++- 3 files changed, 68 insertions(+), 46 deletions(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 7f6ebcb46b..7de4894b35 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -280,25 +280,22 @@ sg_entry_post_populate(const struct rte_dma_sge *src, const struct rte_dma_sge *dst, struct qdma_cntx_sg *sg_cntx, uint16_t nb_sge) { - uint16_t i = 0, idx; - uint32_t total_len = 0, len; + uint16_t i; + uint32_t total_len = 0; struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; for (i = 0; i < (nb_sge - 1); i++) { if (unlikely(src[i].length != dst[i].length)) return -ENOTSUP; - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); - idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); src_sge->addr_lo = (uint32_t)src[i].addr; src_sge->addr_hi = (src[i].addr >> 32); - src_sge->data_len.data_len_sl0 = len; + src_sge->data_len.data_len_sl0 = src[i].length; dst_sge->addr_lo = (uint32_t)dst[i].addr; dst_sge->addr_hi = (dst[i].addr >> 32); - dst_sge->data_len.data_len_sl0 = len; - total_len += len; - sg_cntx->cntx_idx[i] = idx; + dst_sge->data_len.data_len_sl0 = dst[i].length; + total_len += dst[i].length; src_sge->ctrl.f = 0; dst_sge->ctrl.f = 0; @@ -309,19 +306,15 @@ sg_entry_post_populate(const struct rte_dma_sge *src, if (unlikely(src[i].length != dst[i].length)) return -ENOTSUP; - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); - idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); - src_sge->addr_lo = (uint32_t)src[i].addr; src_sge->addr_hi = (src[i].addr >> 32); - src_sge->data_len.data_len_sl0 = len; + src_sge->data_len.data_len_sl0 = src[i].length; dst_sge->addr_lo = (uint32_t)dst[i].addr; dst_sge->addr_hi = (dst[i].addr >> 32); - dst_sge->data_len.data_len_sl0 = len; + dst_sge->data_len.data_len_sl0 = dst[i].length; - total_len += len; - sg_cntx->cntx_idx[i] = idx; + total_len += dst[i].length; sg_cntx->job_nb = nb_sge; src_sge->ctrl.f = QDMA_SG_F; @@ -343,20 +336,18 @@ sg_entry_populate(const struct rte_dma_sge *src, const struct rte_dma_sge *dst, struct qdma_cntx_sg *sg_cntx, uint16_t nb_sge) { - uint16_t i, idx; - uint32_t total_len = 0, len; + uint16_t i; + uint32_t total_len = 0; struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; for (i = 0; i < nb_sge; i++) { if (unlikely(src[i].length != dst[i].length)) return -ENOTSUP; - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); - idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); src_sge->addr_lo = (uint32_t)src[i].addr; src_sge->addr_hi = (src[i].addr >> 32); - src_sge->data_len.data_len_sl0 = len; + src_sge->data_len.data_len_sl0 = src[i].length; src_sge->ctrl.sl = QDMA_SG_SL_LONG; src_sge->ctrl.fmt = QDMA_SG_FMT_SDB; #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -366,7 +357,7 @@ sg_entry_populate(const struct rte_dma_sge *src, #endif dst_sge->addr_lo = (uint32_t)dst[i].addr; dst_sge->addr_hi = (dst[i].addr >> 32); - dst_sge->data_len.data_len_sl0 = len; + dst_sge->data_len.data_len_sl0 = dst[i].length; dst_sge->ctrl.sl = QDMA_SG_SL_LONG; dst_sge->ctrl.fmt = QDMA_SG_FMT_SDB; #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -374,8 +365,7 @@ sg_entry_populate(const struct rte_dma_sge *src, #else dst_sge->ctrl.bmt = QDMA_SG_BMT_DISABLE; #endif - total_len += len; - sg_cntx->cntx_idx[i] = idx; + total_len += src[i].length; if (i == (nb_sge - 1)) { src_sge->ctrl.f = QDMA_SG_F; @@ -606,14 +596,15 @@ dpaa2_qdma_copy_sg(void *dev_private, struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - int ret = 0, expected; - uint32_t cntx_idx, len; + int ret = 0, expected, i; + uint32_t len; struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; - struct qdma_cntx_sg *cntx_sg; + struct qdma_cntx_sg *cntx_sg = NULL; rte_iova_t cntx_iova, fle_iova, sdd_iova; rte_iova_t src_sge_iova, dst_sge_iova; struct qbman_fle *fle; struct qdma_sdd *sdd; + const uint16_t *idx_addr = NULL; if (unlikely(nb_src != nb_dst)) { DPAA2_QDMA_ERR("SG entry src num(%d) != dst num(%d)", @@ -630,14 +621,16 @@ dpaa2_qdma_copy_sg(void *dev_private, memset(fd, 0, sizeof(struct qbman_fd)); if (qdma_dev->is_silent) { - cntx_idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[0].length); - cntx_sg = qdma_vq->cntx_sg[cntx_idx]; + cntx_sg = qdma_vq->cntx_sg[qdma_vq->silent_idx]; } else { ret = rte_mempool_get(qdma_vq->fle_pool, (void **)&cntx_sg); if (ret) return ret; DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); + idx_addr = DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flags); + for (i = 0; i < nb_src; i++) + cntx_sg->cntx_idx[i] = idx_addr[i]; } #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -656,8 +649,13 @@ dpaa2_qdma_copy_sg(void *dev_private, DPAA2_SET_FD_FLC(fd, (uint64_t)cntx_sg); if (qdma_vq->fle_pre_populate) { - if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) + if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) { fle_sdd_sg_pre_populate(cntx_sg, qdma_vq); + if (!qdma_dev->is_silent && cntx_sg && idx_addr) { + for (i = 0; i < nb_src; i++) + cntx_sg->cntx_idx[i] = idx_addr[i]; + } + } len = sg_entry_post_populate(src, dst, cntx_sg, nb_src); @@ -683,6 +681,8 @@ dpaa2_qdma_copy_sg(void *dev_private, dpaa2_qdma_long_fmt_dump(cntx_sg->fle_sdd.fle); qdma_vq->fd_idx++; + qdma_vq->silent_idx = + (qdma_vq->silent_idx + 1) & (DPAA2_QDMA_MAX_DESC - 1); if (flags & RTE_DMA_OP_FLAG_SUBMIT) { expected = qdma_vq->fd_idx; @@ -705,28 +705,23 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan, struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; int ret = 0, expected; - uint16_t cntx_idx; - uint32_t len; struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; - struct qdma_cntx_long *cntx_long; + struct qdma_cntx_long *cntx_long = NULL; rte_iova_t cntx_iova, fle_iova, sdd_iova; struct qbman_fle *fle; struct qdma_sdd *sdd; memset(fd, 0, sizeof(struct qbman_fd)); - cntx_idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(length); - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(length); - if (qdma_dev->is_silent) { - cntx_long = qdma_vq->cntx_long[cntx_idx]; + cntx_long = qdma_vq->cntx_long[qdma_vq->silent_idx]; } else { ret = rte_mempool_get(qdma_vq->fle_pool, (void **)&cntx_long); if (ret) return ret; DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); - cntx_long->cntx_idx = cntx_idx; + cntx_long->cntx_idx = DPAA2_QDMA_IDX_FROM_FLAG(flags); } #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -749,16 +744,20 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan, fle_sdd_pre_populate(&cntx_long->fle_sdd, &qdma_vq->rbp, 0, 0, QBMAN_FLE_WORD4_FMT_SBF); + if (!qdma_dev->is_silent && cntx_long) { + cntx_long->cntx_idx = + DPAA2_QDMA_IDX_FROM_FLAG(flags); + } } - fle_post_populate(fle, src, dst, len); + fle_post_populate(fle, src, dst, length); } else { sdd = cntx_long->fle_sdd.sdd; sdd_iova = cntx_iova + offsetof(struct qdma_cntx_long, fle_sdd) + offsetof(struct qdma_cntx_fle_sdd, sdd); fle_populate(fle, sdd, sdd_iova, &qdma_vq->rbp, - src, dst, len, + src, dst, length, QBMAN_FLE_WORD4_FMT_SBF); } @@ -766,6 +765,8 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan, dpaa2_qdma_long_fmt_dump(cntx_long->fle_sdd.fle); qdma_vq->fd_idx++; + qdma_vq->silent_idx = + (qdma_vq->silent_idx + 1) & (DPAA2_QDMA_MAX_DESC - 1); if (flags & RTE_DMA_OP_FLAG_SUBMIT) { expected = qdma_vq->fd_idx; @@ -963,14 +964,17 @@ dpaa2_qdma_info_get(const struct rte_dma_dev *dev, struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | - RTE_DMA_CAPA_MEM_TO_DEV | - RTE_DMA_CAPA_DEV_TO_DEV | - RTE_DMA_CAPA_DEV_TO_MEM | - RTE_DMA_CAPA_SILENT | - RTE_DMA_CAPA_OPS_COPY; + RTE_DMA_CAPA_MEM_TO_DEV | + RTE_DMA_CAPA_DEV_TO_DEV | + RTE_DMA_CAPA_DEV_TO_MEM | + RTE_DMA_CAPA_SILENT | + RTE_DMA_CAPA_OPS_COPY | + RTE_DMA_CAPA_OPS_COPY_SG; + dev_info->dev_capa |= RTE_DMA_CAPA_DPAA2_QDMA_FLAGS_INDEX; dev_info->max_vchans = dpdmai_dev->num_queues; dev_info->max_desc = DPAA2_QDMA_MAX_DESC; dev_info->min_desc = DPAA2_QDMA_MIN_DESC; + dev_info->max_sges = RTE_DPAA2_QDMA_JOB_SUBMIT_MAX; dev_info->dev_name = dev->device->name; if (dpdmai_dev->qdma_dev) dev_info->nb_vchans = dpdmai_dev->qdma_dev->num_vqs; diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index eb02bff08f..371393cb85 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -199,6 +199,12 @@ struct qdma_cntx_long { uint16_t rsv[3]; } __rte_packed; +#define DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flag) \ + ((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAA2_QDMA_SG_IDX_ADDR_MASK))) + +#define DPAA2_QDMA_IDX_FROM_FLAG(flag) \ + ((flag) >> RTE_DPAA2_QDMA_COPY_IDX_OFFSET) + /** Represents a DPDMAI device */ struct dpaa2_dpdmai_dev { /** Pointer to Next device instance */ @@ -256,6 +262,7 @@ struct qdma_virt_queue { /**Used for silent enabled*/ struct qdma_cntx_sg *cntx_sg[DPAA2_QDMA_MAX_DESC]; struct qdma_cntx_long *cntx_long[DPAA2_QDMA_MAX_DESC]; + uint16_t silent_idx; int num_valid_jobs; diff --git a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h index 729bff42bb..e49604c8fc 100644 --- a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h +++ b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021-2022 NXP + * Copyright 2021-2023 NXP */ #ifndef _RTE_PMD_DPAA2_QDMA_H_ @@ -20,6 +20,17 @@ #define RTE_DPAA2_QDMA_LEN_FROM_LENGTH(length) \ ((length) & RTE_DPAA2_QDMA_LEN_MASK) -#define RTE_DPAA2_QDMA_JOB_SUBMIT_MAX (32 + 8) +#define RTE_DPAA2_QDMA_COPY_IDX_OFFSET 8 +#define RTE_DPAA2_QDMA_SG_IDX_ADDR_ALIGN \ + RTE_BIT64(RTE_DPAA2_QDMA_COPY_IDX_OFFSET) +#define RTE_DPAA2_QDMA_SG_IDX_ADDR_MASK \ + (RTE_DPAA2_QDMA_SG_IDX_ADDR_ALIGN - 1) +#define RTE_DPAA2_QDMA_SG_SUBMIT(idx_addr, flag) \ + (((uint64_t)idx_addr) | (flag)) + +#define RTE_DPAA2_QDMA_COPY_SUBMIT(idx, flag) \ + ((idx << RTE_DPAA2_QDMA_COPY_IDX_OFFSET) | (flag)) +#define RTE_DPAA2_QDMA_JOB_SUBMIT_MAX (32 + 8) +#define RTE_DMA_CAPA_DPAA2_QDMA_FLAGS_INDEX RTE_BIT64(63) #endif /* _RTE_PMD_DPAA2_QDMA_H_ */ -- 2.25.1