env_dpdk: use public function to check VFIO status
DPDK 17.11 added a public API, rte_vfio_is_enabled(), that we can use instead of declaring and using pci_vfio_is_enabled(). This removes one of the remaining non-public DPDK symbols we are currently using, getting us closer to building against the shared library version of DPDK. Change-Id: Idf4ee66d4868cf542521fa2896ed8c609d42ee29 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/405921 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
60e8667261
commit
75ed184a79
@ -49,12 +49,23 @@
|
||||
#define SPDK_VFIO_ENABLED 0
|
||||
#else
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
|
||||
/*
|
||||
* DPDK versions before 17.11 don't provide a way to get VFIO information in the public API,
|
||||
* and we can't link to internal symbols when built against shared library DPDK,
|
||||
* so disable VFIO entirely in that case.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) && \
|
||||
(RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3) || !defined(RTE_BUILD_SHARED_LIB))
|
||||
|
||||
#define SPDK_VFIO_ENABLED 1
|
||||
#include <linux/vfio.h>
|
||||
|
||||
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
|
||||
#include <rte_vfio.h>
|
||||
#else
|
||||
/* Internal DPDK function forward declaration */
|
||||
int pci_vfio_is_enabled(void);
|
||||
#endif
|
||||
|
||||
struct spdk_vfio_dma_map {
|
||||
struct vfio_iommu_type1_dma_map map;
|
||||
@ -372,6 +383,17 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map,
|
||||
}
|
||||
|
||||
#if SPDK_VFIO_ENABLED
|
||||
|
||||
static bool
|
||||
spdk_vfio_enabled(void)
|
||||
{
|
||||
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
|
||||
return rte_vfio_is_enabled("vfio_pci");
|
||||
#else
|
||||
return pci_vfio_is_enabled();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_vtophys_iommu_init(void)
|
||||
{
|
||||
@ -381,7 +403,7 @@ spdk_vtophys_iommu_init(void)
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
|
||||
if (!pci_vfio_is_enabled()) {
|
||||
if (!spdk_vfio_enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user