From d9d4b291bad1bf7ef9823ff467ac70688820bf91 Mon Sep 17 00:00:00 2001 From: Rahul Lakkireddy Date: Fri, 6 May 2016 13:13:15 +0530 Subject: [PATCH] pci: fix config space access on FreeBSD 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 Signed-off-by: Kumar Sanghvi --- 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 7fdd6f1d92..374b68f226 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -427,7 +427,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; @@ -471,7 +471,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.20.1