[dpdk-dev,v5,07/12] eal: introduce iova mode helper api
Checks
Commit Message
Introducing rte_eal_iova_mode() helper API. This API
used by non-eal library for detecting iova mode.
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
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(+)
@@ -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)
@@ -243,5 +243,6 @@ DPDK_17.11 {
rte_pci_match;
rte_pci_get_iommu_class;
rte_bus_get_iommu_class;
+ rte_eal_iova_mode;
} DPDK_17.08;
@@ -45,6 +45,7 @@
#include <rte_per_lcore.h>
#include <rte_config.h>
+#include <rte_bus.h>
#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);
+
#define RTE_INIT(func) \
static void __attribute__((constructor, used)) func(void)
@@ -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)
@@ -248,5 +248,6 @@ DPDK_17.11 {
rte_pci_match;
rte_pci_get_iommu_class;
rte_bus_get_iommu_class;
+ rte_eal_iova_mode;
} DPDK_17.08;