diff options
-rw-r--r-- | src/plugins/dpdk/main.c | 2 | ||||
-rw-r--r-- | src/vppinfra/linux/mem.c | 11 | ||||
-rw-r--r-- | src/vppinfra/mem.h | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/dpdk/main.c b/src/plugins/dpdk/main.c index 72dffca7c4d..2bea10185cd 100644 --- a/src/plugins/dpdk/main.c +++ b/src/plugins/dpdk/main.c @@ -132,7 +132,7 @@ check_hugetlb: goto error; } else - clib_mem_vm_free (alloc.addr, 1 << alloc.log2_page_size); + clib_mem_vm_ext_free (&alloc); goto done; diff --git a/src/vppinfra/linux/mem.c b/src/vppinfra/linux/mem.c index bceb3b217b7..2d968fae0ac 100644 --- a/src/vppinfra/linux/mem.c +++ b/src/vppinfra/linux/mem.c @@ -252,6 +252,17 @@ done: return err; } +void +clib_mem_vm_ext_free (clib_mem_vm_alloc_t * a) +{ + if (a != 0) + { + clib_mem_vm_free (a->addr, 1 << a->log2_page_size); + if (a->fd != -1) + close (a->fd); + } +} + u64 * clib_mem_vm_get_paddr (void *mem, int log2_page_size, int n_pages) { diff --git a/src/vppinfra/mem.h b/src/vppinfra/mem.h index 0702aabb90a..fa7de204fbb 100644 --- a/src/vppinfra/mem.h +++ b/src/vppinfra/mem.h @@ -387,6 +387,7 @@ typedef struct } clib_mem_vm_alloc_t; clib_error_t *clib_mem_vm_ext_alloc (clib_mem_vm_alloc_t * a); +void clib_mem_vm_ext_free (clib_mem_vm_alloc_t * a); u64 clib_mem_vm_get_page_size (int fd); int clib_mem_vm_get_log2_page_size (int fd); u64 *clib_mem_vm_get_paddr (void *mem, int log2_page_size, int n_pages); |