From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0055.outbound.protection.outlook.com [104.47.32.55]) by dpdk.org (Postfix) with ESMTP id 007EA1AEF5 for ; Mon, 18 Sep 2017 12:44:22 +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=w1GbGsvNgy3VieBuLZYhvV7aQGvehgq+8ghFSSk6d+0=; b=EGnl9oGuCqIp0epuVIERgm3YPX8U+y03yEPb2vpkD2jB2GkSkQXPdY87WGq/nZKgfcau9OysKWh8toccHtcYYLZJs4Xqvnmi5sC4hynS4PXydeEbsMtej3AvnlNt/+Uqbl6ukTbfaU7wWUlxRgl+GyZqXeIj+xzgYtN8BYbpsw4= Received: from localhost.localdomain (14.140.2.178) by DM5PR07MB3097.namprd07.prod.outlook.com (10.172.85.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.9; Mon, 18 Sep 2017 10:44:15 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: olivier.matz@6wind.com, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, aconole@redhat.com, stephen@networkplumber.org, anatoly.burakov@intel.com, gaetan.rivet@6wind.com, shreyansh.jain@nxp.com, bruce.richardson@intel.com, sergio.gonzalez.monroy@intel.com, maxime.coquelin@redhat.com, Santosh Shukla Date: Mon, 18 Sep 2017 16:12:34 +0530 Message-Id: <20170918104234.9149-10-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170918104234.9149-1-santosh.shukla@caviumnetworks.com> References: <20170831032618.7120-1-santosh.shukla@caviumnetworks.com> <20170918104234.9149-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: PN1PR01CA0093.INDPRD01.PROD.OUTLOOK.COM (10.174.144.161) To DM5PR07MB3097.namprd07.prod.outlook.com (10.172.85.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c951e463-dea9-4fe0-a1f9-08d4fe82389f 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:DM5PR07MB3097; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3097; 3:1O8E4DNfyZngLVKX0HHu0oFRFUqD/LfwPYI7tzBSBE/w8gAXXk9bDktTi7iTPQFVopU/5fUqW6evhRbV8C4xVZxxlO/SDuhFOP7+m6/FkzBj3Leux9ufaqgusVy1a9Ex1/b8MkL6b1VQCn6lJ3iR44zxB9s65jKk7f5dYRpNP4HDo3CVHVq+fLJyzqg8WW+VnKIjpIwrEiK8DEUj7b2/UoaXD0AZISLnpeJL47L9RaPXx7wD2c6kWlGTbX+iIyV7; 25:yDVwbpRJeOlC8LrHh4b2iCEhJv8SvNjsjkdtXcvK3iOIM4hbB3w6oaDTGMHy3OIrG5JeB1H5SNqa1soISMrXP7VRJDzXCHA9Q9nbql3DhIeoz9ZLV4PuGJBI8UoWfLHUoZWUHxWKyjHAnbj8as5w+UeyfH+YBkFmjhLs1ntLPSvuayGLU1XHLGmSgtKPu4SbVFJpTclDgj9cXlzZPMIB8yQazUClZJ+A1jzH7OEuJGDkWUdZt/D8kQiMDlJ9qah5z1g4AVVgRhWGxwNudzdHoi4WGGIFf/B8bQHy/4JD5eHvqxxZ+2qyFHKcJzcWwibuPRg+f9YaWJVVKhWFN/CTOQ==; 31:bEwieprleHVW/X1M1nDzFk6xEZDNu/zAzRH940Lv924BEoDD544tPb1iXF+fEQBjF9DH1K+oWWnGquJttu9mxZJFO5G049vLFo94bc5vSC78S/oiWZqIBIDIRazL9Ehl+xmgORpcN1KCq2GIye+HhlvSZlCuVMrcLvFgynEh+pp52Bqc94V1HYXdUW7LOQkneIWRu1i5cZ4cb/gX8jqkVj+kcYG4fVbVJKWo5PY5zhc= X-MS-TrafficTypeDiagnostic: DM5PR07MB3097: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3097; 20:I0vVULpjDODAQMNrbjDpUm4J7xisksTOQeFQSgrljp6H/ZxAjrbIwdkSIJHoG6Z8+dprdLQCyGIpVCDmXS+7K432jqCrkyLjsW7Z9Yh3sh1Nk4zXO3U80V1/nh0EZOGZxwIraLpr2z+iaAif0t+M1aK0FHaK7DQAuFnR82zEdWQpBGQsZy2G8Rs+IwinJmISSbCCxZ0acBJh7udk8qN+dcNLDzdz2RfgipM9uNUDgndzKStiUJMs6hx1F4quYksYpjMjDMNeJbSarfGUmgtnh9ui2PV/7RGpU8S7wgtOpIyp5Tg1na5tUatK9caMRzrS0anY3LcVZS7Wb8NQylkb0eauLVbTMP7G8kHlY4pcKqA4dt1OrT+En5b54XNnPWvWdcA5bFaKHseKmIxAQBddUjxlc+OkAqVHz8nII8YlIshqPL6J3wOHA6wdkt6vL1sCwtv3/vFl3LKl3YFhP2DBmsmAIpmNVC6B+K0b2nL67pvR3to7uqQfBhbg6SIV2aJNjOlVN15fAKg9FoNwI4nuN3NHsJAsTmXWX0zDWoAABdKr/9RTnz0Fb37g4n9Grimzf0OLydIeSa56TZKUTtErC1kMnrTdlW5rWk3+yailLNQ=; 4:mAbEQ/ccyvB7pY8y95/4xl/FsNz3japPb2smy7x14dmgcn7Xp3jajj2SoSBxRbBlQBWzfQ9/aTkGi54xbDEGdhlb+APTOvMzGOJij/yoeEdfFxwZyJDtXITg3EHzDICIcZ0WZpa7Z6cXUpvIRRSW28yFuD6+eSm3apj8PHNbBuEItc5TBUMlr55WwY7Ngph7V877Tz/C2ms/j3CY+fU6UjDUXQQP/VwQ3UgNQjZfTZYGD+8SAkt/Ht5LfwtO/wWM5QK3igf4ocZONmT0dDLueBxKeuNZ++9fnDLdSNJ7WBc= X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(10201501046)(100000703101)(100105400095)(6041248)(20161123560025)(20161123558100)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3097; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3097; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(346002)(376002)(199003)(189002)(6486002)(76176999)(6506006)(48376002)(50466002)(25786009)(5003940100001)(107886003)(110136004)(53936002)(4326008)(101416001)(97736004)(6512007)(16586007)(106356001)(105586002)(2351001)(47776003)(305945005)(189998001)(33646002)(478600001)(5660300001)(2361001)(42882006)(6916009)(6666003)(2950100002)(7416002)(36756003)(66066001)(2906002)(7736002)(81156014)(68736007)(50986999)(8656003)(81166006)(50226002)(316002)(8676002)(3846002)(5009440100003)(8936002)(16526017)(6116002)(1076002)(72206003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3097; 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?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75i/o08lpwbNgg==; 24:HwO+QTMx4rHTIEB0a/HvzZZlBBkr7CMKoNE1jb2O5gzo6m+nsaH6vlVJQxSE17+Nk0d8Nu215ix0rvQEid6If2AZnOWQN7UZqMB7jIMnEPU=; 7:cEjIqZgYtWM+ZVV/KIsOIndnG/mfdm6MDDOedo5MwOyxLBV9LfvFManWxyWdlTofqkChvrOEpBKMDU0e0qykt/6zrc3V/T3w0xXu2+YQfHa8NJAapG0s4T9TeNBy3TGomv8Ph3kTdAtC1Je/ye740Y1uCoooCNinrFFTLYYUE0lUrIWr18sxdNF21x6sIUTyPLZJp6pWXC91D4RsVbe9LPX4Xkb9Nj7s81eKrWHrzjw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 10:44:15.2771 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3097 Subject: [dpdk-dev] [PATCH v8 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: Mon, 18 Sep 2017 10:44:23 -0000 Check iova mode and accordingly return phy addr. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob Reviewed-by: Maxime Coquelin Reviewed-by: Anatoly Burakov --- 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.14.1