From mboxrd@z Thu Jan 1 00:00:00 1970 From: Santosh Shukla Subject: [PATCH v2 11/12] mempool: honor iova mode in virt2phy Date: Mon, 10 Jul 2017 11:42:34 +0000 Message-ID: <20170710114235.18970-12-santosh.shukla@caviumnetworks.com> References: <20170608110513.22548-1-santosh.shukla@caviumnetworks.com> <20170710114235.18970-1-santosh.shukla@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: bruce.richardson@intel.com, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com, gaetan.rivet@6wind.com, sergio.gonzalez.monroy@intel.com, anatoly.burakov@intel.com, stephen@networkplumber.org, maxime.coquelin@redhat.com, olivier.matz@6wind.com, Santosh Shukla To: thomas@monjalon.net, dev@dpdk.org Return-path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0060.outbound.protection.outlook.com [104.47.32.60]) by dpdk.org (Postfix) with ESMTP id 973A07CDE for ; Mon, 10 Jul 2017 13:44:33 +0200 (CEST) In-Reply-To: <20170710114235.18970-1-santosh.shukla@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Check iova mode and accordingly return phy addr. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- lib/librte_mempool/rte_mempool.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 76b5b3b15..fafa77e3b 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -78,6 +78,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -1397,9 +1398,14 @@ rte_mempool_empty(const struct rte_mempool *mp) static inline phys_addr_t rte_mempool_virt2phy(__rte_unused const struct rte_mempool *mp, const void *elt) { - const struct rte_mempool_objhdr *hdr; - hdr = (const struct rte_mempool_objhdr *)RTE_PTR_SUB(elt, + struct rte_mempool_objhdr *hdr; + + hdr = (struct rte_mempool_objhdr *)RTE_PTR_SUB(elt, sizeof(*hdr)); + + if (rte_eal_iova_mode() == RTE_IOVA_VA) + hdr->physaddr = (uintptr_t)elt; + return hdr->physaddr; } -- 2.13.0