CNDP  22.08.0
mempool_cfg Struct Reference

#include <mempool.h>

Data Fields

uint32_t objcnt
 
uint32_t objsz
 
uint16_t cache_sz
 
char * addr
 
mempool_ctor_tmp_init
 
mempool_obj_cb_tobj_init
 
void * mp_init_arg
 
void * obj_init_arg
 

Detailed Description

Parameters
objcntThe number of elements in the mempool. The optimum size (in terms of memory usage) for a mempool is when n is a power of two minus one: n = (2^q - 1).
objszThe size of each element.
cache_szSize of the for the mempool
addrThe address to the start of the mempool. If the addr is NULL then it will be allocated from the system memory and freed when the mempool is destroyed.
mp_initA function pointer that is called for initialization of the pool, before object initialization. This parameter can be NULL if not needed.
mp_init_argAn opaque pointer to data that can be used in the mempool constructor function.
obj_initA function pointer that is called for each object at initialization of the pool. The user can set some meta data in objects if needed. This parameter can be NULL if not needed. The obj_init() function takes the mempool pointer, the init_arg, the object pointer and the object number as parameters.
obj_init_argAn opaque pointer to data that can be used as an argument for each call to the object constructor function.

Definition at line 92 of file mempool.h.

Field Documentation

◆ objcnt

uint32_t objcnt

Number of object to create

Definition at line 93 of file mempool.h.

◆ objsz

uint32_t objsz

Size of each object

Definition at line 94 of file mempool.h.

◆ cache_sz

uint16_t cache_sz

Size of the cache mempool

Definition at line 95 of file mempool.h.

◆ addr

char* addr

Address for user supplied memory

Definition at line 96 of file mempool.h.

◆ mp_init

mempool_ctor_t* mp_init

Function to call for initing mempool

Definition at line 98 of file mempool.h.

◆ obj_init

mempool_obj_cb_t* obj_init

Object function to call for each object

Definition at line 99 of file mempool.h.

◆ mp_init_arg

void* mp_init_arg

Argument for mp_init function

Definition at line 100 of file mempool.h.

◆ obj_init_arg

void* obj_init_arg

Argument to pass to obj_init function

Definition at line 101 of file mempool.h.


The documentation for this struct was generated from the following file: