From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: Re: [PATCH 1/5] pci: fix access to PCI config space in bsd Date: Tue, 31 May 2016 17:20:13 +0100 Message-ID: <20160531162013.GA28620@bricha3-MOBL3> References: <99991ceaae3c8ead727fb43d78dd62670214e573.1462519635.git.rahul.lakkireddy@chelsio.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, Kumar Sanghvi , Nirranjan Kirubaharan To: Rahul Lakkireddy Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 59D2D2C7A for ; Tue, 31 May 2016 18:20:18 +0200 (CEST) Content-Disposition: inline In-Reply-To: <99991ceaae3c8ead727fb43d78dd62670214e573.1462519635.git.rahul.lakkireddy@chelsio.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, May 06, 2016 at 01:13:15PM +0530, Rahul Lakkireddy wrote: > 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 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; > -- Does the read function as well as the write one need O_RDWR permissions? There is also an ioctl in rte_eal_pci_scan which operates on a RDONLY file descriptor. Does that need to be modified also? /Bruce