From 701b6f49090d459e3023a3bc3fd7a00083ec6fa7 Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Thu, 26 Oct 2017 12:05:50 +0200 Subject: [PATCH] mem: expose function for physical address use This function was previously private to the EAL layer. Other subsystems requires it, such as the PCI bus. In order not to force other components to include stdbool, which is incompatible with several NIC drivers, the return type has been changed from bool to int. Signed-off-by: Gaetan Rivet --- lib/librte_eal/bsdapp/eal/eal_memory.c | 6 ++++++ lib/librte_eal/common/eal_private.h | 11 ----------- lib/librte_eal/common/include/rte_memory.h | 11 +++++++++++ lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- lib/librte_eal/rte_eal_version.map | 1 + 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c index 3614da8db8..65c96b05ec 100644 --- a/lib/librte_eal/bsdapp/eal/eal_memory.c +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c @@ -192,3 +192,9 @@ error: close(fd_hugepage); return -1; } + +int +rte_eal_using_phys_addrs(void) +{ + return 0; +} diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 9340b6ebd8..80fea24c3d 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -344,17 +344,6 @@ int rte_eal_hugepage_init(void); */ int rte_eal_hugepage_attach(void); -/** - * Returns true if the system is able to obtain - * physical addresses. Return false if using DMA - * addresses through an IOMMU. - * - * Drivers based on uio will not load unless physical - * addresses are obtainable. It is only possible to get - * physical addresses when running as a privileged user. - */ -bool rte_eal_using_phys_addrs(void); - /** * Find a bus capable of identifying a device. * diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h index c545963c86..271d2bb65e 100644 --- a/lib/librte_eal/common/include/rte_memory.h +++ b/lib/librte_eal/common/include/rte_memory.h @@ -187,6 +187,17 @@ unsigned rte_memory_get_nchannel(void); */ unsigned rte_memory_get_nrank(void); +/** + * Drivers based on uio will not load unless physical + * addresses are obtainable. It is only possible to get + * physical addresses when running as a privileged user. + * + * @return + * 1 if the system is able to obtain physical addresses. + * 0 if using DMA addresses through an IOMMU. + */ +int rte_eal_using_phys_addrs(void); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 187d3389ec..ddf88c54e9 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1494,7 +1494,7 @@ error: return -1; } -bool +int rte_eal_using_phys_addrs(void) { return phys_addrs_available; diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 8eb53abdfa..bcc594de11 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -244,6 +244,7 @@ DPDK_17.11 { rte_bus_get_iommu_class; rte_eal_iova_mode; rte_eal_mbuf_default_mempool_ops; + rte_eal_using_phys_addrs; rte_lcore_has_role; rte_memcpy_ptr; rte_pci_get_iommu_class; -- 2.20.1