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 3E8144564F; Fri, 19 Jul 2024 12:02:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 060CC42EA9; Fri, 19 Jul 2024 12:01:59 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013042.outbound.protection.outlook.com [52.101.67.42]) by mails.dpdk.org (Postfix) with ESMTP id B5EBC42EB8 for ; Fri, 19 Jul 2024 12:01:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uoR5rmuB7nla7VG7Nzrf8OzxVvPQJ4nBrCyNUTUZseTrp6NSmFWsLu6+mnQW6dDw75bVEXYZr7fXUmfDGrSsULU6umrVs8pQ6vau+BmJhPMC/0e+GyGBIfmacFIkqAPDE+wLPD2HRIoYxJp06y0Z5m/Q0LWu3zGYdOnYVluL9MBavCsyM8zyOcAaAbVzYTLcAXoTTtAX3V2SIPAQ5DCUon26h3PIKoVyFH7NKBBUJoQfLbQiLqoGxR9z7KmhK0QUqzZCLr3gDikMnoKgi4+eXDPJ0o0+i0zz43KhgZ78mDLThMKWm2IUOwuSpJ25Z1Q+/mWGVqeJNRyeI1VGnnIKRA== 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=yZ02CHTXYR+UUQpCh8VXXPZL3UZOl5iCK6tdQb45o+4=; b=ITvP4aFllWw11rFK34pbsjwflPU+nVwEkeuvhNfmLs+Y+TEEo3weKK9GvDS4u5u012tkP1Xh2vcsaWvC7knBs+NhO8iA+A2YpOXFhybxUSBwtjIS4REH//GVfYoriHdhkZvjdR/PZq4s6NQqsQdfakNzOnPvvHEHeianFYzU9stC1Bk6+U/R5T8o2V1vdzFNxmrneIiKqDToLQ/2q27bJeJqRZ32MY/ZsHC9GLdX5sXfLSlEOYKdSkj61dXVNSHK4ojHbxlWazMeq0d1PtfL2ifs8g/cXcxrWOfUiGIYJEycYKlkwPO1xpHlZrtphp30tcO+hu5PcR8HhgdpewuDFg== 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=yZ02CHTXYR+UUQpCh8VXXPZL3UZOl5iCK6tdQb45o+4=; b=eJhr6FyDC0rXhSspsVx9GMKJKxpV2C0OndBcB5w62HK+ENnBhu/Rqv62PjUUQawu/pPXXADOpjsp9k+MSqZWEY819FqyCFkrfKSwJ95aYtwbnrGvyj88hdlKXgg5v1GDezx8fWeO3C1cjwjxHO78UKEzkaf7ori2Exc9kzFWd2A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.19; Fri, 19 Jul 2024 10:01:52 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%6]) with mapi id 15.20.7784.016; Fri, 19 Jul 2024 10:01:52 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [PATCH 07/30] dma/dpaa2: borrow flags of DMA operation to pass job context Date: Fri, 19 Jul 2024 15:31:03 +0530 Message-Id: <20240719100126.1150373-7-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240719100126.1150373-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0184.apcprd01.prod.exchangelabs.com (2603:1096:4:189::9) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: ca733236-ee2e-4736-1644-08dca7d9d031 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ctxyiO2dk+GO/N5hc+0YsAdIht/xTW3agyLI1zMsJ2xeMEMan1nOX0VJhp+U?= =?us-ascii?Q?zzKXdnFmJYQ47KUJqs9ZFEPqBcZh12xjASANBQew1OByGrbVfFQ1e9FvYvUM?= =?us-ascii?Q?zTiT94rFEBki27K9gxO55KHCHIOYcH8SMo5/uudDHfS7NXqUpn42qXTILowq?= =?us-ascii?Q?/z/Ch7SjAWT2cpZ5cPFc67Q63xC9gRm6fWKSp4fU62HoHZhNVYy18GOPqxpE?= =?us-ascii?Q?e8GzhyeeT+pb441AqHCY2kqoWsN6X5Z50lFlqRcDj9/snOUXy1lgN32Wd46H?= =?us-ascii?Q?rL1QTALW51Qnn8wIOehbCtAnQA3bOI5Au+R6H6axNC7cwN/R5FhH3gpC6OYN?= =?us-ascii?Q?GpwdTA6AjPPPAEheHlDtRwBXSUNuBJMcLAwr0yZOyEMpITQ/g4eEKWlIN56z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8WNwGrExw1rvNssllFce7x7Y2tIKhCP9KAgNI?= =?us-ascii?Q?nJF/pTk87vCSEy6DnypY/jAJc0esvMw/LILbQ0J5YsUjHXx+niRRvNzbozMi?= =?us-ascii?Q?e4Eemq7WXVktpnuKCCDbDOCS7tpOfSl5Tmpqkatps/MtYGG1Ng=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YuINNutD/PWaxUT8JbvmWyg3PLKgOnZFRFsB4Akr63fRdq53cQ2j4hsonx9q?= =?us-ascii?Q?SEv/X4y2whMy1/dWetsW1nT2O2out5iCGQrFcHhQ3MBgHdMVAzz3oFeqvzHc?= =?us-ascii?Q?M6NIfxInCIOjqJogauovmYcfzJ5+mDh8atJBXMJ/Zt2MDbxILq6HblLuV94i?= =?us-ascii?Q?0Q6aC8snOWNQTQKcpMlXz/jHFHsDDcqu+mqydvqvHJWtKqpVtrlprpWvP6iK?= =?us-ascii?Q?dBEPmnX5WDu3GK/VAT7ar8oKlVIObpmbebNP4Kv1VbosJqD4d8comCgrRvGd?= =?us-ascii?Q?1AW1xyFnOWHtWHWEIoG0JI59IKNgpi/xfadgHGIAYlnLoA9E9WIejfoda9D2?= =?us-ascii?Q?EgIUfzzigig3JXzHOd4Sfrq0V8F3P88l6rBfxieSI0GvYWmPcyCsEIbXZwUf?= =?us-ascii?Q?a9gfO5E8cEZFg9ztqy4BKaZ21sbO1XypET2zJjCJX+b6KWCYV5xohTiKg2Ws?= =?us-ascii?Q?sPqiyFXszxDkbbVxE7U5Dag+9HCBTxCQn2UXLiBoFLno7IMz/faVAArfPMwq?= =?us-ascii?Q?Xk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= =?us-ascii?Q?TQEmZ6u4w0uZOmYfS0skagS3Cg3n7CSrt/JIEJoewM9QSfqj0RmY4qGDtiWb?= =?us-ascii?Q?gp6eJaIfdLdNXg4JCwSAJx6Pr+eP0E4jHUTxB2hpTzMNyU/H2SLbPg3j8L1A?= =?us-ascii?Q?rSKugo27+8xQ9iFogug=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca733236-ee2e-4736-1644-08dca7d9d031 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 10:01:52.3969 (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: YF0H9JaoK1/fO4LKNWh6nOQHqFk4D1FtL4pN84H7ZtD/K6gGfkFjzOZRRDC2Olk3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 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 e521df8817..b38a0f1bac 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->slient_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->slient_idx = + (qdma_vq->slient_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->slient_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->slient_idx = + (qdma_vq->slient_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..c93e0098a5 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 *)((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 slient_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