From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0072.outbound.protection.outlook.com [104.47.36.72]) by dpdk.org (Postfix) with ESMTP id 066E16841 for ; Thu, 31 Aug 2017 05:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=oXGyaVW/FxlJEHLwMgmV+wY8eZdjWxVvuebziATurVs=; b=WSeD4UgAQvlXMq8rn2pCpsDkvSU6aaVY8NiIqNBBXZP6P0NH4RHwv6OY1bYHlBICh+ojME93Kv00WC+jJh6JeMYeTmltdEHo/xhqIsJ+4hkow7HA+0R1phpn9oq+6j7lQGIylnmhbluFE7w1KlpLbjxjmXW6SNjnc2VoxnLpoQ8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Thu, 31 Aug 2017 03:27:31 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, olivier.matz@6wind.com, maxime.coquelin@redhat.com, sergio.gonzalez.monroy@intel.com, bruce.richardson@intel.com, shreyansh.jain@nxp.com, gaetan.rivet@6wind.com, anatoly.burakov@intel.com, stephen@networkplumber.org, aconole@redhat.com, Santosh Shukla Date: Thu, 31 Aug 2017 03:26:18 +0000 Message-Id: <20170831032618.7120-10-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170831032618.7120-1-santosh.shukla@caviumnetworks.com> References: <20170814161059.6684-1-santosh.shukla@caviumnetworks.com> <20170831032618.7120-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0118.INDPRD01.PROD.OUTLOOK.COM (10.174.144.34) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d9bc6d8-4709-41cf-2ec6-08d4f0203936 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:bVzUebojkBOdaneZqT8wXC9lIvLTZNSsSEKp6Ul3wVazGAGfx7j645jLucDyA+RkpqP8w4aQuva+jA7K4+J74Uz4g7qUUG3Ujx04yjFIk2g0TxGYWndHWxHGCseUF7MtM93Qh0+WulErEU3K1S4Y/FRMn3/GML7c1n1K4mGzWPdcy+QKbRUqu7m1xUfPkS13jfxgg6phsCB9bA8hLHTXOwvEJqXdl2AiWFtn3p5NNwTRpSDzxOaDcKUF/+sa5u3a; 25:fIPSn3QD1CBML+RE7iVsxn3MrNDSBpm1Mq38LoGcbmjfdc6pUs/asU5azPUTL6bMNcN5YP2WvU86KdGVDn6j58fESm+IO15Ee7rdEGwPKz31Q8Ey86ZSU/5mMaMe+27kgTm4+TKdumCcyzGd3YHx1L9jXBho37lhyF2ge3Wp23blwAr+Moslx6xtZeMPcHgCL+qPRbVzGvoCpESHpBxJPWb6W5ZKfuLzwpcaaOXoyAwnokPIORtht7CLEptCMh5PDwzhMHp+iBkCVxFskJaH52/vUM900NvAH+2bOjkFGXC4r/uu7t9wjmoo1PdmIzLeVChOr6Szbt2ppWX98MuLUA==; 31:0Swxa97JjJxTqH4PFhq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sQ4lcmS/QHdMoypBiKr/4gVSBOWK+pWrWgy/S0doqbXIxz9qGV8ISdR2V9CCH45WLqe7RsmRLGx9frk X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(199003)(189002)(81156014)(8936002)(81166006)(8676002)(7736002)(6666003)(5003940100001)(305945005)(2950100002)(7416002)(2906002)(6916009)(42882006)(76176999)(50986999)(101416001)(50226002)(5660300001)(6486002)(6506006)(48376002)(50466002)(72206003)(36756003)(97736004)(478600001)(189998001)(42186005)(2361001)(2351001)(33646002)(106356001)(105586002)(110136004)(107886003)(5009440100003)(8656003)(6512007)(53936002)(4326008)(68736007)(1076002)(6116002)(3846002)(66066001)(47776003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB3089; 23:lg0hLeFLBG9c8PnBfoswGGNTD+fSqaqfmyswTO7Yc?= =?us-ascii?Q?c5DODTsod7tkKkxyF3VH2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Z+uSAMRlOwj9m1Mu2GrKJHc1SMQA+Lp9ax1U1qHURBpxmfxufV1W+mKSgHUUgpaaFwXk1BVoh09mxijr3Lc1XF1i7LlMoS80A/2qFxvQxRg4l11omCxCHi4U3GZErLa5dhpayxdqXZCcvaeRwE3SIqZiyOY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 03:27:31.8863 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v7 9/9] eal/rte_malloc: honor iova mode in virt2phy 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: , X-List-Received-Date: Thu, 31 Aug 2017 03:27:37 -0000 Check iova mode and accordingly return phy addr. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob Reviewed-by: Maxime Coquelin --- lib/librte_eal/common/rte_malloc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c index 5c0627bf4..d65c05a4d 100644 --- a/lib/librte_eal/common/rte_malloc.c +++ b/lib/librte_eal/common/rte_malloc.c @@ -251,10 +251,17 @@ rte_malloc_set_limit(__rte_unused const char *type, phys_addr_t rte_malloc_virt2phy(const void *addr) { + phys_addr_t paddr; const struct malloc_elem *elem = malloc_elem_from_data(addr); if (elem == NULL) return RTE_BAD_PHYS_ADDR; if (elem->ms->phys_addr == RTE_BAD_PHYS_ADDR) return RTE_BAD_PHYS_ADDR; - return elem->ms->phys_addr + ((uintptr_t)addr - (uintptr_t)elem->ms->addr); + + if (rte_eal_iova_mode() == RTE_IOVA_VA) + paddr = (uintptr_t)addr; + else + paddr = elem->ms->phys_addr + + ((uintptr_t)addr - (uintptr_t)elem->ms->addr); + return paddr; } -- 2.13.0