From: "Wangyu (Eric)" <seven.wangyu@huawei.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
Linuxarm <linuxarm@huawei.com>, "humin (Q)" <humin29@huawei.com>,
dengxiaofeng <dengxiaofeng@huawei.com>,
"Liyuan (Larry)" <Larry.T@huawei.com>
Subject: [dpdk-dev] [PATCH v3] bus/pci: resolve multiple NICs address conflicts
Date: Tue, 12 Nov 2019 02:22:36 +0000 [thread overview]
Message-ID: <78A93308629D474AA53B84C5879E84D24B1086FB@DGGEMM533-MBX.china.huawei.com> (raw)
In-Reply-To: <1573521821-21173-1-git-send-email-dengxiaofeng@huawei.com>
NIC address conflicts on 64K pagesize when using multiple NICs,
as system will mmap 64K pagesize for NIC,
but dev->mem_resource[i].len is 16K.
Signed-off-by: beard-627 <dengxiaofeng@huawei.com>
Signed-off-by: Wangyu (Eric) <seven.wangyu@huawei.com>
Acked-by: Wei Hu <xavier.huwei@huawei.com>
Acked-by: Min Hu <humin29@huawei.com>
---
drivers/bus/pci/linux/pci_uio.c | 2 ++ drivers/bus/pci/linux/pci_vfio.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 6dca05a..097dc19 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -351,6 +351,8 @@
pci_map_addr = RTE_PTR_ADD(mapaddr,
(size_t)dev->mem_resource[res_idx].len);
+ pci_map_addr = RTE_PTR_ALIGN(pci_map_addr, sysconf(_SC_PAGE_SIZE));
+
maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;
maps[map_idx].size = dev->mem_resource[res_idx].len;
maps[map_idx].addr = mapaddr;
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index b8faa23..64cd84a 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -750,6 +750,9 @@
bar_addr = pci_map_addr;
pci_map_addr = RTE_PTR_ADD(bar_addr, (size_t) reg->size);
+ pci_map_addr = RTE_PTR_ALIGN(pci_map_addr,
+ sysconf(_SC_PAGE_SIZE));
+
maps[i].addr = bar_addr;
maps[i].offset = reg->offset;
maps[i].size = reg->size;
--
1.8.3.1
next parent reply other threads:[~2019-11-12 2:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1573521821-21173-1-git-send-email-dengxiaofeng@huawei.com>
2019-11-12 2:22 ` Wangyu (Eric) [this message]
2019-11-12 7:01 ` Gavin Hu (Arm Technology China)
2019-11-12 12:29 ` Burakov, Anatoly
[not found] <D3165BB52137B64493C4E18DC69F10D62C8F4B4F@dggemm521-mbx.china.huawei.com>
2019-11-13 3:11 ` [dpdk-dev] 答复: " Wangyu (Eric)
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=78A93308629D474AA53B84C5879E84D24B1086FB@DGGEMM533-MBX.china.huawei.com \
--to=seven.wangyu@huawei.com \
--cc=Larry.T@huawei.com \
--cc=dengxiaofeng@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=humin29@huawei.com \
--cc=linuxarm@huawei.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).