CNDP
22.08.0
|
Go to the source code of this file.
Data Structures | |
struct | mmap_sizes_t |
struct | mmap_stats_t |
Typedefs | |
typedef void | mmap_t |
Enumerations | |
enum | mmap_type_t { MMAP_HUGEPAGE_4KB , MMAP_HUGEPAGE_2MB , MMAP_HUGEPAGE_1GB , MMAP_HUGEPAGE_CNT } |
Functions | |
CNDP_API mmap_t * | mmap_alloc (uint32_t bufcnt, uint32_t bufsz, mmap_type_t hugepage) |
CNDP_API int | mmap_free (mmap_t *mmap) |
CNDP_API void * | mmap_addr_at_offset (mmap_t *mm, size_t offset) |
CNDP_API void * | mmap_addr (mmap_t *mm) |
CNDP_API size_t | mmap_size (mmap_t *mm, uint32_t *bufcnt, uint32_t *bufsz) |
CNDP_API mmap_type_t | mmap_type_by_name (const char *htype) |
CNDP_API const char * | mmap_name_by_type (mmap_type_t typ) |
CNDP_API void | mmap_set_default (mmap_type_t htype) |
CNDP_API void | mmap_set_default_by_name (const char *name) |
CNE allocator for huge pages
Allocate memory using MMAP anonyuous memory using hugepages.
Definition in file cne_mmap.h.
typedef void mmap_t |
Opaque pointer to internal mmap data
Definition at line 55 of file cne_mmap.h.
enum mmap_type_t |
Set of enums to help define HUGEPAGE sizes
Definition at line 27 of file cne_mmap.h.
CNDP_API mmap_t* mmap_alloc | ( | uint32_t | bufcnt, |
uint32_t | bufsz, | ||
mmap_type_t | hugepage | ||
) |
Allocate memory on the correct socket and use hugepages if set.
bufcnt | Number of buffers in the memory pool |
bufsz | The size of the buffers in the memory pool |
hugepage | Type of hugepage memory to allocate or non-hugepage memory. |
CNDP_API int mmap_free | ( | mmap_t * | mmap | ) |
Free the memory allocated
mmap | structure holding the mmap region information |
CNDP_API void* mmap_addr_at_offset | ( | mmap_t * | mm, |
size_t | offset | ||
) |
Return the address in the memory region for the buffer index and size of buffer.
Return the address based on the offset into the memory region.
mm | The mmap_t pointer |
offset | The offset value |
CNDP_API void* mmap_addr | ( | mmap_t * | mm | ) |
Returns the memory region for a given mmap_t pointer
mm | The mmap_t pointer |
CNDP_API size_t mmap_size | ( | mmap_t * | mm, |
uint32_t * | bufcnt, | ||
uint32_t * | bufsz | ||
) |
Return the true size of the memory mapped region
mm | The mmap_t pointer |
bufcnt | A uint32_t location to place the buffer count value, can be NULL. |
bufsz | A uint32_t location to place the buffer size value, can be NULL. |
CNDP_API mmap_type_t mmap_type_by_name | ( | const char * | htype | ) |
Find a memory hugepage type value by hugepage name
htype | The hugepage memory type string "4KB", "2MB" or "1GB" memory type |
CNDP_API const char* mmap_name_by_type | ( | mmap_type_t | typ | ) |
Find the hugepage memory string from a given type
typ | The integer value for a given type |
CNDP_API void mmap_set_default | ( | mmap_type_t | htype | ) |
Set the default memory type for allocations
htype | The integer hugepage memory type |
CNDP_API void mmap_set_default_by_name | ( | const char * | name | ) |
Set the default memory type by hugepage memory string
name | The number for a memory type "4KB", "2MB", ... |