Call rte_eal_pci_ioport_map only if driver type is RTE_KDRV_NONE, which
means kernel driver(including UIO/VFIO) isn't managing the device.
other minor changes:
* use RTE_ARCH_X86 for pci ioport map
* rework rte_eal_pci_ioport_map a bit
Signed-off-by: Huawei Xie
---
lib/librte_eal/linuxapp/eal/eal_pci.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index b44fa32..112d540 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -621,7 +621,7 @@ int rte_eal_pci_write_config(const struct rte_pci_device
*device,
}
}
-#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
+#if defined(RTE_ARCH_X86)
static int
pci_ioport_map(struct rte_pci_device *dev, int bar __rte_unused,
struct rte_pci_ioport *p)
@@ -685,12 +685,11 @@ int
rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar,
struct rte_pci_ioport *p)
{
- int ret;
+ int ret = -1;
switch (dev->kdrv) {
#ifdef VFIO_PRESENT
case RTE_KDRV_VFIO:
- ret = -1;
if (pci_vfio_is_enabled())
ret = pci_vfio_ioport_map(dev, bar, p);
break;
@@ -699,14 +698,13 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int
bar,
case RTE_KDRV_UIO_GENERIC:
ret = pci_uio_ioport_map(dev, bar, p);
break;
- default:
-#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
- /* special case for x86 ... */
+ case RTE_KDRV_NONE:
+#if defined(RTE_ARCH_X86)
ret = pci_ioport_map(dev, bar, p);
-#else
- ret = -1;
#endif
break;
+ default:
+ break;
}
if (!ret)
--
1.8.1.4