DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal/bus: use RTE_IOVA_PA only if phys addresses are available
@ 2018-09-07 15:47 Darek Stojaczyk
  2018-09-07 15:58 ` [dpdk-dev] [PATCH v2] " Darek Stojaczyk
  0 siblings, 1 reply; 7+ messages in thread
From: Darek Stojaczyk @ 2018-09-07 15:47 UTC (permalink / raw)
  To: dev, Santosh Shukla, Hemant Agrawal, Jerin Jacob
  Cc: Maxime Coquelin, Anatoly Burakov, Chas Williams, Darek Stojaczyk

When neither RTE_IOVA_VA nor RTE_IOVA_PA was explicitly
requested, DPDK would currently fallback to the default
RTE_IOVA_PA mode and possibly encounter a failure later
on if running as a non-priviledged user. Attempting to
use RTE_IOVA_VA if no phys addresses are available may
help in this case.

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
---
 lib/librte_eal/common/eal_common_bus.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index 0943851cc..8b56979d7 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -236,9 +236,19 @@ rte_bus_get_iommu_class(void)
 			mode |= bus->get_iommu_class();
 	}
 
-	if (mode != RTE_IOVA_VA) {
-		/* Use default IOVA mode */
-		mode = RTE_IOVA_PA;
+	if (mode == RTE_IOVA_VA)
+		return RTE_IOVA_VA;
+
+	if (mode & RTE_IOVA_PA) {
+		/* Not all buses support RTE_IOVA_VA, fallback to RTE_IOVA_PA */
+		return RTE_IOVA_PA;
+	}
+
+	if (rte_eal_using_phys_addrs()) {
+		/* Default to RTE_IOVA_PA only if it's supported */
+		return RTE_IOVA_PA;
 	}
-	return mode;
+
+	/* Since RTE_IOVA_PA is unsupported, fallback to RTE_IOVA_VA */
+	return RTE_IOVA_VA;
 }
-- 
2.17.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-10-30 12:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-07 15:47 [dpdk-dev] [PATCH] eal/bus: use RTE_IOVA_PA only if phys addresses are available Darek Stojaczyk
2018-09-07 15:58 ` [dpdk-dev] [PATCH v2] " Darek Stojaczyk
2018-09-17 10:33   ` Burakov, Anatoly
2018-09-17 13:06     ` Stojaczyk, Dariusz
2018-10-30 12:58       ` Alejandro Lucero
2018-10-28 23:11     ` Thomas Monjalon
2018-10-30 10:25       ` Burakov, Anatoly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).