From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EF2FCA04DB; Thu, 15 Oct 2020 11:48:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2C0AD1DDB3; Thu, 15 Oct 2020 11:47:26 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 3E89C1DD7E for ; Thu, 15 Oct 2020 11:47:22 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0C9C1200574; Thu, 15 Oct 2020 11:47:21 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 7C93720056D; Thu, 15 Oct 2020 11:47:18 +0200 (CEST) Received: from lsv11086.swis.cn-sha01.nxp.com (lsv11086.swis.cn-sha01.nxp.com [92.121.210.87]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C473240313; Thu, 15 Oct 2020 11:47:14 +0200 (CEST) From: Gagandeep Singh To: dev@dpdk.org, nipun.gupta@nxp.com, hemant.agrawal@nxp.com Cc: thomas@monjalon.net, Jun Yang Date: Thu, 15 Oct 2020 17:47:05 +0800 Message-Id: <1602755228-25535-5-git-send-email-g.singh@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1602755228-25535-1-git-send-email-g.singh@nxp.com> References: <1599470764-30569-1-git-send-email-g.singh@nxp.com> <1602755228-25535-1-git-send-email-g.singh@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: optimize IOVA conversion X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jun Yang rte_mempool_virt2iova is now used for converting with IOVA off. Signed-off-by: Jun Yang --- drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 29 +++++++++++++++++++++++------ drivers/raw/dpaa2_qdma/dpaa2_qdma.h | 5 +++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c index 6eef7a57a..94dc7886a 100644 --- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c @@ -221,7 +221,9 @@ static inline int dpdmai_dev_set_fd_lf( { struct rte_qdma_rbp *rbp = &qdma_vq->rbp; struct rte_qdma_job **ppjob; + void *elem; struct qbman_fle *fle; + uint64_t elem_iova, fle_iova; int ret = 0; struct qdma_device *qdma_dev = QDMA_DEV_OF_VQ(qdma_vq); @@ -229,19 +231,29 @@ static inline int dpdmai_dev_set_fd_lf( * Get an FLE/SDD from FLE pool. * Note: IO metadata is before the FLE and SDD memory. */ - ret = rte_mempool_get(qdma_dev->fle_pool, (void **)(&ppjob)); + ret = rte_mempool_get(qdma_dev->fle_pool, (void **)(&elem)); if (ret) { DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE"); return ret; } +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + elem_iova = rte_mempool_virt2iova(elem); +#else + elem_iova = DPAA2_VADDR_TO_IOVA(elem); +#endif + /* Set the metadata */ job->vq_id = qdma_vq->vq_id; + ppjob = (struct rte_qdma_job **) + ((uintptr_t)(uint64_t)elem + QDMA_FLE_JOB_OFFSET); *ppjob = job; - fle = (struct qbman_fle *)(ppjob + 1); + fle = (struct qbman_fle *) + ((uintptr_t)(uint64_t)elem + QDMA_FLE_FLE_OFFSET); + fle_iova = elem_iova + QDMA_FLE_FLE_OFFSET; - DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle)); + DPAA2_SET_FD_ADDR(fd, fle_iova); DPAA2_SET_FD_COMPOUND_FMT(fd); DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); @@ -283,6 +295,8 @@ static inline uint16_t dpdmai_dev_get_job_lf( const struct qbman_fd *fd, struct rte_qdma_job **job) { + void *elem; + struct qbman_fle *fle; struct rte_qdma_job **ppjob; uint16_t vqid; struct qdma_device *qdma_dev = QDMA_DEV_OF_VQ(qdma_vq); @@ -291,9 +305,12 @@ static inline uint16_t dpdmai_dev_get_job_lf( * Fetch metadata from FLE. job and vq_id were set * in metadata in the enqueue operation. */ - ppjob = (struct rte_qdma_job **) + fle = (struct qbman_fle *) DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); - ppjob -= 1; + elem = (void *)((uintptr_t)(uint64_t)fle - QDMA_FLE_FLE_OFFSET); + + ppjob = (struct rte_qdma_job **) + ((uintptr_t)(uint64_t)elem + QDMA_FLE_JOB_OFFSET); *job = (struct rte_qdma_job *)*ppjob; (*job)->status = (DPAA2_GET_FD_ERR(fd) << 8) | @@ -301,7 +318,7 @@ static inline uint16_t dpdmai_dev_get_job_lf( vqid = (*job)->vq_id; /* Free FLE to the pool */ - rte_mempool_put(qdma_dev->fle_pool, (void *)ppjob); + rte_mempool_put(qdma_dev->fle_pool, elem); return vqid; } diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h index 4265ee828..ff7743fb5 100644 --- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h @@ -17,6 +17,11 @@ struct rte_qdma_job; #define QDMA_FLE_POOL_SIZE (sizeof(struct rte_qdma_job *) + \ sizeof(struct qbman_fle) * DPAA2_QDMA_MAX_FLE + \ sizeof(struct qdma_sdd) * DPAA2_QDMA_MAX_SDD) + +#define QDMA_FLE_JOB_OFFSET 0 +#define QDMA_FLE_FLE_OFFSET \ + (QDMA_FLE_JOB_OFFSET + sizeof(struct rte_qdma_job *)) + /** FLE pool cache size */ #define QDMA_FLE_CACHE_SIZE(_num) (_num/(RTE_MAX_LCORE * 2)) -- 2.17.1