From 821f86e0f4d4c773316f537c16b46c9398a9060b Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Thu, 26 Oct 2017 12:05:51 +0200 Subject: [PATCH] eal: expose internal config elements Some internal configuration elements set by the user on the command line are necessary outside the EAL, when the PCI bus is detached. Expose: + rte_eal_create_uio_dev + rte_eal_has_pci + rte_eal_vfio_intr_mode Signed-off-by: Gaetan Rivet --- lib/librte_eal/bsdapp/eal/eal.c | 16 ++++++++++++++ lib/librte_eal/common/include/rte_eal.h | 28 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 16 ++++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 4 files changed, 63 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index e981721aa6..d54a28001c 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -723,3 +723,19 @@ rte_eal_process_type(void) { return rte_config.process_type; } + +int rte_eal_has_pci(void) +{ + return !internal_config.no_pci; +} + +int rte_eal_create_uio_dev(void) +{ + return internal_config.create_uio_dev; +} + +enum rte_intr_mode +rte_eal_vfio_intr_mode(void) +{ + return RTE_INTR_MODE_NONE; +} diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index 4ea2ff4be5..cc2636ca36 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -47,6 +47,8 @@ #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -267,6 +269,32 @@ rte_set_application_usage_hook(rte_usage_hook_t usage_func); */ int rte_eal_has_hugepages(void); +/** + * Whether EAL is using PCI bus. + * Disabled by --no-pci option. + * + * @return + * Nonzero if the PCI bus is enabled. + */ +int rte_eal_has_pci(void); + +/** + * Whether the EAL was asked to create UIO device. + * + * @return + * Nonzero if true. + */ +int rte_eal_create_uio_dev(void); + +/** + * The user-configured vfio interrupt mode. + * + * @return + * Interrupt mode configured with the command line, + * RTE_INTR_MODE_NONE by default. + */ +enum rte_intr_mode rte_eal_vfio_intr_mode(void); + /** * A wrap API for syscall gettid. * diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 02381d0d15..18a07b0b25 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -989,6 +989,22 @@ int rte_eal_has_hugepages(void) return ! internal_config.no_hugetlbfs; } +int rte_eal_has_pci(void) +{ + return !internal_config.no_pci; +} + +int rte_eal_create_uio_dev(void) +{ + return internal_config.create_uio_dev; +} + +enum rte_intr_mode +rte_eal_vfio_intr_mode(void) +{ + return internal_config.vfio_intr_mode; +} + int rte_eal_check_module(const char *module_name) { diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index bcc594de11..9f06d23159 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -241,10 +241,13 @@ EXPERIMENTAL { DPDK_17.11 { global: + rte_eal_create_uio_dev; rte_bus_get_iommu_class; + rte_eal_has_pci; rte_eal_iova_mode; rte_eal_mbuf_default_mempool_ops; rte_eal_using_phys_addrs; + rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; rte_pci_get_iommu_class; -- 2.20.1