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 <gaetan.rivet@6wind.com>
This commit is contained in:
Gaetan Rivet 2017-10-26 12:05:51 +02:00 committed by Thomas Monjalon
parent 701b6f4909
commit 821f86e0f4
4 changed files with 63 additions and 0 deletions

View File

@ -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;
}

View File

@ -47,6 +47,8 @@
#include <rte_config.h>
#include <rte_bus.h>
#include <rte_pci_dev_feature_defs.h>
#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.
*

View File

@ -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)
{

View File

@ -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;