[dpdk-dev,v4,3/4] eal: call pci_ioport_map when kernel driver isn't managing the device

Message ID 1456451636-118476-4-git-send-email-huawei.xie@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Huawei Xie Feb. 26, 2016, 1:53 a.m. UTC
  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 <huawei.xie@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
  

Comments

David Marchand Feb. 29, 2016, 9:02 a.m. UTC | #1
On Fri, Feb 26, 2016 at 2:53 AM, Huawei Xie <huawei.xie@intel.com> wrote:
> 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.

I suppose you meant 'Call pci_ioport_map when the pci device is not
bound to a kernel driver'.
If you keep on with your choice of words, at least put a space before the (.


> other minor changes:
>  * use RTE_ARCH_X86 for pci ioport map

This is a trivial change, but this should not be here.

>  * rework rte_eal_pci_ioport_map a bit

Well, not sure this comment helps the review, and anyway, why did you
need to change this ?
Your modification should be the smallest possible.


> Signed-off-by: Huawei Xie <huawei.xie@intel.com>

Let aside these nits.
Acked-by: David Marchand <david.marchand@6wind.com>
  

Patch

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)