DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/4] x86 ioport fixes
@ 2016-03-15  6:29 David Marchand
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 1/4] pci: explicitly call ioport handlers for uio_pci_generic David Marchand
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: David Marchand @ 2016-03-15  6:29 UTC (permalink / raw)
  To: dev; +Cc: mauricio.vasquezbernal, yuanhan.liu, huawei.xie

Here is a patchset for little cleanups and a fix on newly introduced pci
ioport api.
The last patch fixes a regression reported by Mauricio V. [1].


[1]: http://dpdk.org/ml/archives/dev/2016-February/033922.html

-- 
David Marchand

David Marchand (4):
  pci: explicitly call ioport handlers for uio_pci_generic
  pci: align ioport unmap error handling to ioport map
  pci: align ioport special case for x86 in read/write/unmap
  pci: fix ioport support for uio_pci_generic on x86

 lib/librte_eal/linuxapp/eal/eal_pci.c | 36 +++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 1/4] pci: explicitly call ioport handlers for uio_pci_generic
  2016-03-15  6:29 [dpdk-dev] [PATCH 0/4] x86 ioport fixes David Marchand
@ 2016-03-15  6:29 ` David Marchand
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 2/4] pci: align ioport unmap error handling to ioport map David Marchand
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2016-03-15  6:29 UTC (permalink / raw)
  To: dev; +Cc: mauricio.vasquezbernal, yuanhan.liu, huawei.xie

Prepare for fixes on x86 by separating igb_uio and uio_pci_generic cases.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 9f75252..e2af371 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -617,6 +617,8 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar,
 		break;
 #endif
 	case RTE_KDRV_IGB_UIO:
+		ret = pci_uio_ioport_map(dev, bar, p);
+		break;
 	case RTE_KDRV_UIO_GENERIC:
 		ret = pci_uio_ioport_map(dev, bar, p);
 		break;
@@ -646,6 +648,8 @@ rte_eal_pci_ioport_read(struct rte_pci_ioport *p,
 		break;
 #endif
 	case RTE_KDRV_IGB_UIO:
+		pci_uio_ioport_read(p, data, len, offset);
+		break;
 	case RTE_KDRV_UIO_GENERIC:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
@@ -669,6 +673,8 @@ rte_eal_pci_ioport_write(struct rte_pci_ioport *p,
 		break;
 #endif
 	case RTE_KDRV_IGB_UIO:
+		pci_uio_ioport_write(p, data, len, offset);
+		break;
 	case RTE_KDRV_UIO_GENERIC:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
@@ -695,6 +701,8 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
 		break;
 #endif
 	case RTE_KDRV_IGB_UIO:
+		ret = pci_uio_ioport_unmap(p);
+		break;
 	case RTE_KDRV_UIO_GENERIC:
 		ret = pci_uio_ioport_unmap(p);
 		break;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/4] pci: align ioport unmap error handling to ioport map
  2016-03-15  6:29 [dpdk-dev] [PATCH 0/4] x86 ioport fixes David Marchand
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 1/4] pci: explicitly call ioport handlers for uio_pci_generic David Marchand
@ 2016-03-15  6:29 ` David Marchand
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 3/4] pci: align ioport special case for x86 in read/write/unmap David Marchand
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2016-03-15  6:29 UTC (permalink / raw)
  To: dev; +Cc: mauricio.vasquezbernal, yuanhan.liu, huawei.xie

Same idea as commit bd80d4730aca ("pci: rework ioport map error handling").

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index e2af371..7707292 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -690,12 +690,11 @@ rte_eal_pci_ioport_write(struct rte_pci_ioport *p,
 int
 rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
 {
-	int ret;
+	int ret = -1;
 
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
 	case RTE_KDRV_VFIO:
-		ret = -1;
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_unmap(p);
 		break;
@@ -710,8 +709,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
 #if defined(RTE_ARCH_X86)
 		/* special case for x86 ... nothing to do */
 		ret = 0;
-#else
-		ret = -1;
 #endif
 		break;
 	}
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 3/4] pci: align ioport special case for x86 in read/write/unmap
  2016-03-15  6:29 [dpdk-dev] [PATCH 0/4] x86 ioport fixes David Marchand
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 1/4] pci: explicitly call ioport handlers for uio_pci_generic David Marchand
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 2/4] pci: align ioport unmap error handling to ioport map David Marchand
@ 2016-03-15  6:29 ` David Marchand
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 4/4] pci: fix ioport support for uio_pci_generic on x86 David Marchand
  2016-03-16 20:21 ` [dpdk-dev] [PATCH 0/4] x86 ioport fixes Thomas Monjalon
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2016-03-15  6:29 UTC (permalink / raw)
  To: dev; +Cc: mauricio.vasquezbernal, yuanhan.liu, huawei.xie

Commit b8eb345378bd ("pci: ignore devices already managed in Linux when
mapping x86 ioport") did not update other parts of the ioport api.

The application is not supposed to call these read/write/unmap ioport
functions if map call failed but I prefer aligning the code for the sake
of consistency.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 7707292..74c6919 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -653,12 +653,13 @@ rte_eal_pci_ioport_read(struct rte_pci_ioport *p,
 	case RTE_KDRV_UIO_GENERIC:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
-	default:
+	case RTE_KDRV_NONE:
 #if defined(RTE_ARCH_X86)
-		/* special case for x86 ... */
 		pci_uio_ioport_read(p, data, len, offset);
 #endif
 		break;
+	default:
+		break;
 	}
 }
 
@@ -678,12 +679,13 @@ rte_eal_pci_ioport_write(struct rte_pci_ioport *p,
 	case RTE_KDRV_UIO_GENERIC:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
-	default:
+	case RTE_KDRV_NONE:
 #if defined(RTE_ARCH_X86)
-		/* special case for x86 ... */
 		pci_uio_ioport_write(p, data, len, offset);
 #endif
 		break;
+	default:
+		break;
 	}
 }
 
@@ -705,12 +707,13 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
 	case RTE_KDRV_UIO_GENERIC:
 		ret = pci_uio_ioport_unmap(p);
 		break;
-	default:
+	case RTE_KDRV_NONE:
 #if defined(RTE_ARCH_X86)
-		/* special case for x86 ... nothing to do */
 		ret = 0;
 #endif
 		break;
+	default:
+		break;
 	}
 
 	return ret;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 4/4] pci: fix ioport support for uio_pci_generic on x86
  2016-03-15  6:29 [dpdk-dev] [PATCH 0/4] x86 ioport fixes David Marchand
                   ` (2 preceding siblings ...)
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 3/4] pci: align ioport special case for x86 in read/write/unmap David Marchand
@ 2016-03-15  6:29 ` David Marchand
  2016-03-16 20:21 ` [dpdk-dev] [PATCH 0/4] x86 ioport fixes Thomas Monjalon
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2016-03-15  6:29 UTC (permalink / raw)
  To: dev; +Cc: mauricio.vasquezbernal, yuanhan.liu, huawei.xie

uio_pci_generic does not offer the same sysfs helpers as igb_uio.
In this case, ioport number can only be retrieved by parsing /proc/ioports.

Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API")

Reported-by: Mauricio Vásquez <mauricio.vasquezbernal@studenti.polito.it>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 74c6919..dbf12a8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -620,7 +620,11 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar,
 		ret = pci_uio_ioport_map(dev, bar, p);
 		break;
 	case RTE_KDRV_UIO_GENERIC:
+#if defined(RTE_ARCH_X86)
+		ret = pci_ioport_map(dev, bar, p);
+#else
 		ret = pci_uio_ioport_map(dev, bar, p);
+#endif
 		break;
 	case RTE_KDRV_NONE:
 #if defined(RTE_ARCH_X86)
@@ -705,7 +709,11 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
 		ret = pci_uio_ioport_unmap(p);
 		break;
 	case RTE_KDRV_UIO_GENERIC:
+#if defined(RTE_ARCH_X86)
+		ret = 0;
+#else
 		ret = pci_uio_ioport_unmap(p);
+#endif
 		break;
 	case RTE_KDRV_NONE:
 #if defined(RTE_ARCH_X86)
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 0/4] x86 ioport fixes
  2016-03-15  6:29 [dpdk-dev] [PATCH 0/4] x86 ioport fixes David Marchand
                   ` (3 preceding siblings ...)
  2016-03-15  6:29 ` [dpdk-dev] [PATCH 4/4] pci: fix ioport support for uio_pci_generic on x86 David Marchand
@ 2016-03-16 20:21 ` Thomas Monjalon
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2016-03-16 20:21 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, mauricio.vasquezbernal, yuanhan.liu, huawei.xie

2016-03-15 07:29, David Marchand:
> Here is a patchset for little cleanups and a fix on newly introduced pci
> ioport api.
> The last patch fixes a regression reported by Mauricio V. [1].
> 
> [1]: http://dpdk.org/ml/archives/dev/2016-February/033922.html

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-16 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15  6:29 [dpdk-dev] [PATCH 0/4] x86 ioport fixes David Marchand
2016-03-15  6:29 ` [dpdk-dev] [PATCH 1/4] pci: explicitly call ioport handlers for uio_pci_generic David Marchand
2016-03-15  6:29 ` [dpdk-dev] [PATCH 2/4] pci: align ioport unmap error handling to ioport map David Marchand
2016-03-15  6:29 ` [dpdk-dev] [PATCH 3/4] pci: align ioport special case for x86 in read/write/unmap David Marchand
2016-03-15  6:29 ` [dpdk-dev] [PATCH 4/4] pci: fix ioport support for uio_pci_generic on x86 David Marchand
2016-03-16 20:21 ` [dpdk-dev] [PATCH 0/4] x86 ioport fixes Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).