aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mem.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-16 02:40:18 -0800
committerDave Barach <openvpp@barachs.net>2018-01-17 19:11:14 +0000
commitd3e83a9c82b4a57c24061828db6a309692f7f2d4 (patch)
treecf774d9a360267686929dd0956a38de001acd9ff /src/vppinfra/mem.h
parent919f377efefb9c97a5206923f41651da559ad3fa (diff)
ssvm: reuse clib mem infra for memfd segments
Change-Id: I67648dbed3c7ed291b3e1ce617d83a776d3623bb Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vppinfra/mem.h')
-rw-r--r--src/vppinfra/mem.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/vppinfra/mem.h b/src/vppinfra/mem.h
index 69ab880317d..b566e8d8895 100644
--- a/src/vppinfra/mem.h
+++ b/src/vppinfra/mem.h
@@ -330,7 +330,7 @@ typedef struct
#define CLIB_MEM_VM_F_HUGETLB_PREALLOC (1 << 4)
u32 flags; /**< vm allocation flags:
<br> CLIB_MEM_VM_F_SHARED: request shared memory, file
- destiptor will be provided on successful allocation.
+ descriptor will be provided on successful allocation.
<br> CLIB_MEM_VM_F_HUGETLB: request hugepages.
<br> CLIB_MEM_VM_F_NUMA_PREFER: numa_node field contains valid
numa node preference.
@@ -342,15 +342,26 @@ typedef struct
uword size; /**< Allocation size, set by caller. */
int numa_node; /**< numa node preference. Valid if CLIB_MEM_VM_F_NUMA_PREFER set. */
void *addr; /**< Pointer to allocated memory, set on successful allocation. */
- int fd; /**< File desriptor, set on successful allocation if CLIB_MEM_VM_F_SHARED is set. */
+ int fd; /**< File descriptor, set on successful allocation if CLIB_MEM_VM_F_SHARED is set. */
int log2_page_size; /* Page size in log2 format, set on successful allocation. */
int n_pages; /* Number of pages. */
+ uword requested_va; /**< Request fixed position mapping */
} clib_mem_vm_alloc_t;
clib_error_t *clib_mem_vm_ext_alloc (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);
+typedef struct
+{
+ uword size; /**< Map size */
+ int fd; /**< File descriptor to be mapped */
+ uword requested_va; /**< Request fixed position mapping */
+ void *addr; /**< Pointer to mapped memory, if successful */
+} clib_mem_vm_map_t;
+clib_error_t *clib_mem_vm_ext_map (clib_mem_vm_map_t * a);
+
#include <vppinfra/error.h> /* clib_panic */