From: Changpeng Liu <changpeng.liu@intel.com>
To: dev@dpdk.org
Cc: changpeng.liu@intel.com, ferruh.yigit@intel.com
Subject: [PATCH] pci/uio: enable prefetchable resources mapping
Date: Thu, 1 Feb 2018 09:18:22 +0800 [thread overview]
Message-ID: <1517447902-4166-1-git-send-email-changpeng.liu@intel.com> (raw)
For PCI prefetchable resources, Linux will create a
write combined file as well, the library will try
to map resourceX_wc file first, if the file does
not exist, then it will map resourceX as usual.
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
---
drivers/bus/pci/linux/pci_uio.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index d423e4b..2957a5f 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -293,7 +293,7 @@
/* update devname for mmap */
snprintf(devname, sizeof(devname),
- "%s/" PCI_PRI_FMT "/resource%d",
+ "%s/" PCI_PRI_FMT "/resource%d_wc",
rte_pci_get_sysfs_path(),
loc->domain, loc->bus, loc->devid,
loc->function, res_idx);
@@ -307,13 +307,22 @@
}
/*
- * open resource file, to mmap it
+ * open prefetchable resource file first, try to mmap it
*/
fd = open(devname, O_RDWR);
if (fd < 0) {
- RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
- devname, strerror(errno));
- goto error;
+ snprintf(devname, sizeof(devname),
+ "%s/" PCI_PRI_FMT "/resource%d",
+ rte_pci_get_sysfs_path(),
+ loc->domain, loc->bus, loc->devid,
+ loc->function, res_idx);
+ /* then try to map resource file */
+ fd = open(devname, O_RDWR);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
+ devname, strerror(errno));
+ goto error;
+ }
}
/* try mapping somewhere close to the end of hugepages */
--
1.9.3
next reply other threads:[~2018-02-01 1:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 1:18 Changpeng Liu [this message]
2018-02-01 9:59 ` [PATCH] pci/uio: enable prefetchable resources mapping Bruce Richardson
2018-02-01 10:08 ` Andrew Rybchenko
-- strict thread matches above, loose matches on Subject: below --
2017-06-02 22:40 Changpeng Liu
2017-10-05 0:06 ` Ferruh Yigit
2017-10-05 8:28 ` Bruce Richardson
2017-10-05 8:33 ` Bruce Richardson
2018-10-28 1:59 ` Ferruh Yigit
2018-10-29 0:48 ` Liu, Changpeng
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=1517447902-4166-1-git-send-email-changpeng.liu@intel.com \
--to=changpeng.liu@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.