From: Bruce Richardson <bruce.richardson@intel.com>
To: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: dev@dpdk.org, Kumar Sanghvi <kumaras@chelsio.com>,
Nirranjan Kirubaharan <nirranjan@chelsio.com>
Subject: Re: [dpdk-dev] [PATCH 1/5] pci: fix access to PCI config space in bsd
Date: Tue, 31 May 2016 17:20:13 +0100 [thread overview]
Message-ID: <20160531162013.GA28620@bricha3-MOBL3> (raw)
In-Reply-To: <99991ceaae3c8ead727fb43d78dd62670214e573.1462519635.git.rahul.lakkireddy@chelsio.com>
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 <rahul.lakkireddy@chelsio.com>
> Signed-off-by: Kumar Sanghvi <kumaras@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;
> --
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
next prev parent reply other threads:[~2016-05-31 16:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 7:43 [dpdk-dev] [PATCH 0/5] cxgbe: add features to CXGBE PMD Rahul Lakkireddy
2016-05-06 7:43 ` [dpdk-dev] [PATCH 1/5] pci: fix access to PCI config space in bsd Rahul Lakkireddy
2016-05-31 16:20 ` Bruce Richardson [this message]
2016-06-01 8:34 ` Rahul Lakkireddy
2016-05-06 7:43 ` [dpdk-dev] [PATCH 2/5] cxgbe: add support to access PCI config space Rahul Lakkireddy
2016-05-06 7:43 ` [dpdk-dev] [PATCH 3/5] cxgbe: set default PCIe completion timeout Rahul Lakkireddy
2016-05-06 7:43 ` [dpdk-dev] [PATCH 4/5] cxgbe: add support to get/set EEPROM Rahul Lakkireddy
2016-05-06 7:43 ` [dpdk-dev] [PATCH 5/5] cxgbe: add support to get register dump Rahul Lakkireddy
2016-06-02 14:43 ` [dpdk-dev] [PATCH 0/5] cxgbe: add features to CXGBE PMD Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160531162013.GA28620@bricha3-MOBL3 \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=kumaras@chelsio.com \
--cc=nirranjan@chelsio.com \
--cc=rahul.lakkireddy@chelsio.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).