aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/linux/pci.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-09-11 22:16:53 +0200
committerDamjan Marion <damarion@cisco.com>2020-09-17 12:38:41 +0200
commit6bfd07670b991c30761ef74fb09f42181dbfd182 (patch)
treef82fa63e1b3ec6e4d31827efb553516936392288 /src/vlib/linux/pci.c
parentc63e2a4f980e09b4274558f0562cee285f9741b5 (diff)
vppinfra: support main heap with different page sizes
Type: improvement Change-Id: I381fc3dec8580208d0e24637d791af69011aa83b Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/linux/pci.c')
-rw-r--r--src/vlib/linux/pci.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c
index 168acde7288..a010e64fa13 100644
--- a/src/vlib/linux/pci.c
+++ b/src/vlib/linux/pci.c
@@ -1132,8 +1132,10 @@ vlib_pci_map_region_int (vlib_main_t * vm, vlib_pci_dev_handle_t h,
if (p->type == LINUX_PCI_DEVICE_TYPE_UIO && addr != 0)
flags |= MAP_FIXED;
- *result = mmap (addr, size, PROT_READ | PROT_WRITE, flags, fd, offset);
- if (*result == (void *) -1)
+ *result = clib_mem_vm_map_shared (addr, size, fd, offset,
+ "PCIe %U region %u", format_vlib_pci_addr,
+ vlib_pci_get_addr (vm, h), bar);
+ if (*result == CLIB_MEM_VM_MAP_FAILED)
{
error = clib_error_return_unix (0, "mmap `BAR%u'", bar);
if (p->type == LINUX_PCI_DEVICE_TYPE_UIO && (fd != -1))
@@ -1337,7 +1339,7 @@ vlib_pci_device_close (vlib_main_t * vm, vlib_pci_dev_handle_t h)
{
if (res->size == 0)
continue;
- munmap (res->addr, res->size);
+ clib_mem_vm_unmap (res->addr);
if (res->fd != -1)
close (res->fd);
}