aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-09-17 13:56:47 +0200
committerNeale Ranns <nranns@cisco.com>2020-09-21 13:24:56 +0000
commit0978e607cce4bb12588b0214298616756f86dc7d (patch)
tree0303aa7387d4115011d5fe1d873b4300980f4608 /src/plugins
parent27b50fea143f2d45613ef982870cd2052e21fb0f (diff)
dpdk: hugepage availibility check using new api
Type: improvement Change-Id: Iab623a2e11bd5787f4cae549143f49888e0dd9c4 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/main.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/plugins/dpdk/main.c b/src/plugins/dpdk/main.c
index e570cfb4d97..ea0348a5e7f 100644
--- a/src/plugins/dpdk/main.c
+++ b/src/plugins/dpdk/main.c
@@ -105,7 +105,6 @@ dpdk_early_init (vlib_main_t *vm)
int fd = -1;
u64 *pt = 0;
clib_error_t *err = 0;
- clib_mem_vm_alloc_t alloc = { 0 };
/* check if pagemap is accessible - if we get zero result
dpdk will not be able to get physical memory address and game is over
@@ -125,19 +124,18 @@ dpdk_early_init (vlib_main_t *vm)
goto error;
check_hugetlb:
- alloc.flags = CLIB_MEM_VM_F_SHARED | CLIB_MEM_VM_F_HUGETLB | CLIB_MEM_VM_F_HUGETLB_PREALLOC;
- alloc.size = 1;
- alloc.name = "dpdk_early_init";
+ fd = clib_mem_vm_create_fd (CLIB_MEM_PAGE_SZ_DEFAULT_HUGE,
+ "dpdk early init");
- if ((err = clib_mem_vm_ext_alloc (&alloc)))
+ if (fd != -1)
{
- clib_error_free (err);
- goto error;
+ u8 *page = clib_mem_vm_map_shared (0, 1, fd, 0, "dpdk_early_init");
+ if (page != CLIB_MEM_VM_MAP_FAILED)
+ {
+ clib_mem_vm_unmap (page);
+ goto done;
+ }
}
- else
- clib_mem_vm_ext_free (&alloc);
-
- goto done;
error:
err = clib_error_return (0, "access to physical devices is not allowed");