[dpdk-dev] [PATCH 1/5] pci: fix access to PCI config space in bsd
Rahul Lakkireddy
rahul.lakkireddy at chelsio.com
Fri May 6 09:43:15 CEST 2016
PCIOCREAD and PCIOCWRITE ioctls to read/write PCI config space fail
with EPERM due to missing write permission. Fix by opening /dev/pci/
with O_RDWR instead.
Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras at chelsio.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 2d16d78..82330be 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -422,7 +422,7 @@ int rte_eal_pci_read_config(const struct rte_pci_device *dev,
goto error;
}
- fd = open("/dev/pci", O_RDONLY);
+ fd = open("/dev/pci", O_RDWR);
if (fd < 0) {
RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
goto error;
@@ -466,7 +466,7 @@ int rte_eal_pci_write_config(const struct rte_pci_device *dev,
memcpy(&pi.pi_data, buf, len);
- fd = open("/dev/pci", O_RDONLY);
+ fd = open("/dev/pci", O_RDWR);
if (fd < 0) {
RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
goto error;
--
2.5.3
More information about the dev
mailing list