[dpdk-dev,1/2] eal/bsd: fix ioport write operation

Message ID 20170507133334.16219-2-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tiwei Bie May 7, 2017, 1:33 p.m. UTC
  The first param of out*() on FreeBSD is port, and the second one
is data. But they are reversed in DPDK. This patch fixes it.

Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_eal/bsdapp/eal/eal_pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Bruce Richardson May 8, 2017, 8:55 a.m. UTC | #1
On Sun, May 07, 2017 at 01:33:33PM +0000, Tiwei Bie wrote:
> The first param of out*() on FreeBSD is port, and the second one is
> data. But they are reversed in DPDK. This patch fixes it.
> 
> Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API") Cc:
> stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> ---
How was this bug discovered so that we can verify that it is fixed?.  Is
this in use by virtio or was it just discovered via code inspection?

/Bruce
  
Tiwei Bie May 8, 2017, 9:07 a.m. UTC | #2
On Mon, May 08, 2017 at 09:55:01AM +0100, Bruce Richardson wrote:
> On Sun, May 07, 2017 at 01:33:33PM +0000, Tiwei Bie wrote:
> > The first param of out*() on FreeBSD is port, and the second one is
> > data. But they are reversed in DPDK. This patch fixes it.
> > 
> > Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API") Cc:
> > stable@dpdk.org
> > 
> > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> ---
> How was this bug discovered so that we can verify that it is fixed?.  Is
> this in use by virtio or was it just discovered via code inspection?
> 

The virtio PMD in legacy mode doesn't work FreeBSD, and I tried to
fix this issue. And then I found this bug.

Best regards,
Tiwei Bie
  
Bruce Richardson May 8, 2017, 9:46 a.m. UTC | #3
On Mon, May 08, 2017 at 05:07:36PM +0800, Tiwei Bie wrote:
> On Mon, May 08, 2017 at 09:55:01AM +0100, Bruce Richardson wrote:
> > On Sun, May 07, 2017 at 01:33:33PM +0000, Tiwei Bie wrote:
> > > The first param of out*() on FreeBSD is port, and the second one is
> > > data. But they are reversed in DPDK. This patch fixes it.
> > > 
> > > Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API") Cc:
> > > stable@dpdk.org
> > > 
> > > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> ---
> > How was this bug discovered so that we can verify that it is fixed?.  Is
> > this in use by virtio or was it just discovered via code inspection?
> > 
> 
> The virtio PMD in legacy mode doesn't work FreeBSD, and I tried to
> fix this issue. And then I found this bug.
> 
> Best regards,
> Tiwei Bie

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 6294b7eab..59ceb7665 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -618,13 +618,13 @@  pci_uio_ioport_write(struct rte_pci_ioport *p,
 	for (s = data; len > 0; s += size, reg += size, len -= size) {
 		if (len >= 4) {
 			size = 4;
-			outl(*(const uint32_t *)s, reg);
+			outl(reg, *(const uint32_t *)s);
 		} else if (len >= 2) {
 			size = 2;
-			outw(*(const uint16_t *)s, reg);
+			outw(reg, *(const uint16_t *)s);
 		} else {
 			size = 1;
-			outb(*s, reg);
+			outb(reg, *s);
 		}
 	}
 #else