From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 31 May 2016 09:20:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,396,1459839600"; d="scan'208";a="965912270" Received: from amotzhad-mobl2.ger.corp.intel.com ([10.252.31.137]) by orsmga001.jf.intel.com with SMTP; 31 May 2016 09:20:14 -0700 Received: by (sSMTP sendmail emulation); Tue, 31 May 2016 17:20:14 +0025 Date: Tue, 31 May 2016 17:20:13 +0100 From: Bruce Richardson To: Rahul Lakkireddy Cc: dev@dpdk.org, Kumar Sanghvi , Nirranjan Kirubaharan 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 Content-Disposition: inline In-Reply-To: <99991ceaae3c8ead727fb43d78dd62670214e573.1462519635.git.rahul.lakkireddy@chelsio.com> Organization: Intel Research and =?iso-8859-1?Q?De=ACvel?= =?iso-8859-1?Q?opment?= Ireland Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH 1/5] pci: fix access to PCI config space in bsd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2016 16:20:18 -0000 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