From 93878cf0255e9dc21322ed99ad535adc048fa44f Mon Sep 17 00:00:00 2001 From: Santosh Shukla Date: Fri, 6 Oct 2017 16:33:42 +0530 Subject: [PATCH] eal: introduce helper API for IOVA mode Introducing rte_eal_iova_mode() helper API. This API used by non-eal library for detecting iova mode. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob Reviewed-by: Maxime Coquelin Tested-by: Hemant Agrawal --- lib/librte_eal/bsdapp/eal/eal.c | 6 ++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/include/rte_eal.h | 12 ++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 6 ++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 5 files changed, 26 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 5fa598842d..07e72203f5 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -119,6 +119,12 @@ rte_eal_get_configuration(void) return &rte_config; } +enum rte_iova_mode +rte_eal_iova_mode(void) +{ + return rte_eal_get_configuration()->iova_mode; +} + /* parse a sysfs (or other) file containing one integer value */ int eal_parse_sysfs_value(const char *filename, unsigned long *val) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index e887e065c8..d54583c93e 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -243,6 +243,7 @@ DPDK_17.11 { global: rte_bus_get_iommu_class; + rte_eal_iova_mode; rte_pci_get_iommu_class; rte_pci_match; diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index 559d2308eb..436094d241 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -45,6 +45,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -87,6 +88,9 @@ struct rte_config { /** Primary or secondary configuration */ enum rte_proc_type_t process_type; + /** PA or VA mapping mode */ + enum rte_iova_mode iova_mode; + /** * Pointer to memory configuration, which may be shared across multiple * DPDK instances @@ -287,6 +291,14 @@ static inline int rte_gettid(void) return RTE_PER_LCORE(_thread_id); } +/** + * Get the iova mode + * + * @return + * enum rte_iova_mode value. + */ +enum rte_iova_mode rte_eal_iova_mode(void); + /** * Run function before main() with low priority. * diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 48f12f44cf..febbafdb3f 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -128,6 +128,12 @@ rte_eal_get_configuration(void) return &rte_config; } +enum rte_iova_mode +rte_eal_iova_mode(void) +{ + return rte_eal_get_configuration()->iova_mode; +} + /* parse a sysfs (or other) file containing one integer value */ int eal_parse_sysfs_value(const char *filename, unsigned long *val) diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 0f04b0ad2e..b537e8b92b 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -248,6 +248,7 @@ DPDK_17.11 { global: rte_bus_get_iommu_class; + rte_eal_iova_mode; rte_pci_get_iommu_class; rte_pci_match; -- 2.20.1