.TH "rte_mempool.h" 3 "Version 25.11.0" "DPDK" \" -*- nroff -*-
.ad l
.nh
.SH NAME
rte_mempool.h
.SH SYNOPSIS
.br
.PP
\fR#include <stdalign\&.h>\fP
.br
\fR#include <stdio\&.h>\fP
.br
\fR#include <stdint\&.h>\fP
.br
\fR#include <inttypes\&.h>\fP
.br
\fR#include <rte_compat\&.h>\fP
.br
\fR#include <rte_config\&.h>\fP
.br
\fR#include <rte_spinlock\&.h>\fP
.br
\fR#include <rte_debug\&.h>\fP
.br
\fR#include <rte_lcore\&.h>\fP
.br
\fR#include <rte_log\&.h>\fP
.br
\fR#include <rte_branch_prediction\&.h>\fP
.br
\fR#include <rte_ring\&.h>\fP
.br
\fR#include <rte_memcpy\&.h>\fP
.br
\fR#include <rte_common\&.h>\fP
.br
\fR#include 'rte_mempool_trace_fp\&.h'\fP
.br

.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBrte_mempool_cache\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool_objsz\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool_objhdr\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool_memhdr\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool_info\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool_ops\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool_ops_table\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool_mem_range_info\fP"
.br
.in -1c
.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fBRTE_MEMPOOL_HEADER_COOKIE1\fP   0xbadbadbadadd2e55ULL"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_HEADER_COOKIE2\fP   0xf2eef2eedadd2e55ULL"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_TRAILER_COOKIE\fP   0xadd2e55badbadbadULL"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_ALIGN\fP   RTE_CACHE_LINE_SIZE"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_F_NO_SPREAD\fP   0x0001"
.br
.ti -1c
.RI "#define \fBMEMPOOL_F_NO_SPREAD\fP   \fBRTE_MEMPOOL_F_NO_SPREAD\fP"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_F_NO_CACHE_ALIGN\fP   0x0002"
.br
.ti -1c
.RI "#define \fBMEMPOOL_F_NO_CACHE_ALIGN\fP   \fBRTE_MEMPOOL_F_NO_CACHE_ALIGN\fP"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_F_SP_PUT\fP   0x0004"
.br
.ti -1c
.RI "#define \fBMEMPOOL_F_SP_PUT\fP   \fBRTE_MEMPOOL_F_SP_PUT\fP"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_F_SC_GET\fP   0x0008"
.br
.ti -1c
.RI "#define \fBMEMPOOL_F_SC_GET\fP   \fBRTE_MEMPOOL_F_SC_GET\fP"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_F_POOL_CREATED\fP   0x0010"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_F_NO_IOVA_CONTIG\fP   0x0020"
.br
.ti -1c
.RI "#define \fBMEMPOOL_F_NO_IOVA_CONTIG\fP   \fBRTE_MEMPOOL_F_NO_IOVA_CONTIG\fP"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_F_NON_IO\fP   0x0040"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_VALID_USER_FLAGS\fP"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_OPS_NAMESIZE\fP   32"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_POPULATE_F_ALIGN_OBJ\fP   0x0001"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_MAX_OPS_IDX\fP   16"
.br
.ti -1c
.RI "#define \fBRTE_MEMPOOL_REGISTER_OPS\fP(ops)"
.br
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "\fBtypedef\fP void \fBrte_mempool_memchunk_free_cb_t\fP(struct \fBrte_mempool_memhdr\fP *memhdr, void *opaque)"
.br
.ti -1c
.RI "\fBtypedef\fP int(* \fBrte_mempool_alloc_t\fP) (struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "\fBtypedef\fP void(* \fBrte_mempool_free_t\fP) (struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "\fBtypedef\fP int(* \fBrte_mempool_enqueue_t\fP) (struct \fBrte_mempool\fP *mp, void *const *obj_table, unsigned int n)"
.br
.ti -1c
.RI "\fBtypedef\fP int(* \fBrte_mempool_dequeue_t\fP) (struct \fBrte_mempool\fP *mp, void **obj_table, unsigned int n)"
.br
.ti -1c
.RI "\fBtypedef\fP int(* \fBrte_mempool_dequeue_contig_blocks_t\fP) (struct \fBrte_mempool\fP *mp, void **first_obj_table, unsigned int n)"
.br
.ti -1c
.RI "\fBtypedef\fP unsigned(* \fBrte_mempool_get_count\fP) (const struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "\fBtypedef\fP ssize_t(* \fBrte_mempool_calc_mem_size_t\fP) (const struct \fBrte_mempool\fP *mp, uint32_t obj_num, uint32_t pg_shift, size_t *min_chunk_size, size_t *align)"
.br
.ti -1c
.RI "\fBtypedef\fP void \fBrte_mempool_populate_obj_cb_t\fP(struct \fBrte_mempool\fP *mp, void *opaque, void *vaddr, \fBrte_iova_t\fP iova)"
.br
.ti -1c
.RI "\fBtypedef\fP int(* \fBrte_mempool_populate_t\fP) (struct \fBrte_mempool\fP *mp, unsigned int max_objs, void *vaddr, \fBrte_iova_t\fP iova, size_t len, \fBrte_mempool_populate_obj_cb_t\fP *obj_cb, void *obj_cb_arg)"
.br
.ti -1c
.RI "\fBtypedef\fP int(* \fBrte_mempool_get_info_t\fP) (const struct \fBrte_mempool\fP *mp, struct \fBrte_mempool_info\fP *info)"
.br
.ti -1c
.RI "\fBtypedef\fP void \fBrte_mempool_obj_cb_t\fP(struct \fBrte_mempool\fP *mp, void *opaque, void *obj, unsigned obj_idx)"
.br
.ti -1c
.RI "\fBtypedef\fP void \fBrte_mempool_mem_cb_t\fP(struct \fBrte_mempool\fP *mp, void *opaque, struct \fBrte_mempool_memhdr\fP *memhdr, unsigned mem_idx)"
.br
.ti -1c
.RI "\fBtypedef\fP void \fBrte_mempool_ctor_t\fP(struct \fBrte_mempool\fP *, void *)"
.br
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBrte_mempool_event\fP { \fBRTE_MEMPOOL_EVENT_READY\fP = 0, \fBRTE_MEMPOOL_EVENT_DESTROY\fP = 1 }"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "\fBRTE_STAILQ_HEAD\fP (rte_mempool_objhdr_list, \fBrte_mempool_objhdr\fP)"
.br
.ti -1c
.RI "\fBRTE_STAILQ_HEAD\fP (rte_mempool_memhdr_list, \fBrte_mempool_memhdr\fP)"
.br
.ti -1c
.RI "static struct \fBrte_mempool\fP * \fBrte_mempool_from_obj\fP (void *obj)"
.br
.ti -1c
.RI "ssize_t \fBrte_mempool_op_calc_mem_size_default\fP (const struct \fBrte_mempool\fP *mp, uint32_t obj_num, uint32_t pg_shift, size_t *min_chunk_size, size_t *align)"
.br
.ti -1c
.RI "int \fBrte_mempool_op_populate_default\fP (struct \fBrte_mempool\fP *mp, unsigned int max_objs, void *vaddr, \fBrte_iova_t\fP iova, size_t len, \fBrte_mempool_populate_obj_cb_t\fP *obj_cb, void *obj_cb_arg)"
.br
.ti -1c
.RI "int \fBrte_mempool_ops_get_info\fP (const struct \fBrte_mempool\fP *mp, struct \fBrte_mempool_info\fP *info)"
.br
.ti -1c
.RI "int \fBrte_mempool_set_ops_byname\fP (struct \fBrte_mempool\fP *mp, const char *name, void *pool_config)"
.br
.ti -1c
.RI "int \fBrte_mempool_register_ops\fP (const struct \fBrte_mempool_ops\fP *ops)"
.br
.ti -1c
.RI "void \fBrte_mempool_free\fP (struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "struct \fBrte_mempool\fP * \fBrte_mempool_create\fP (const char *name, unsigned n, unsigned elt_size, unsigned cache_size, unsigned private_data_size, \fBrte_mempool_ctor_t\fP *mp_init, void *mp_init_arg, \fBrte_mempool_obj_cb_t\fP *obj_init, void *obj_init_arg, int socket_id, unsigned int flags) \fB__rte_malloc\fP \fB__rte_dealloc\fP(\fBrte_mempool_free\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool\fP struct \fBrte_mempool\fP * \fBrte_mempool_create_empty\fP (const char *name, unsigned int n, unsigned int elt_size, unsigned int cache_size, unsigned int private_data_size, int socket_id, unsigned int flags) \fB__rte_malloc\fP \fB__rte_dealloc\fP(\fBrte_mempool_free\fP"
.br
.ti -1c
.RI "struct \fBrte_mempool\fP struct \fBrte_mempool\fP int \fBrte_mempool_populate_iova\fP (struct \fBrte_mempool\fP *mp, char *vaddr, \fBrte_iova_t\fP iova, size_t len, \fBrte_mempool_memchunk_free_cb_t\fP *free_cb, void *opaque)"
.br
.ti -1c
.RI "int \fBrte_mempool_populate_virt\fP (struct \fBrte_mempool\fP *mp, char *addr, size_t len, size_t pg_sz, \fBrte_mempool_memchunk_free_cb_t\fP *free_cb, void *opaque)"
.br
.ti -1c
.RI "int \fBrte_mempool_populate_default\fP (struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "int \fBrte_mempool_populate_anon\fP (struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "uint32_t \fBrte_mempool_obj_iter\fP (struct \fBrte_mempool\fP *mp, \fBrte_mempool_obj_cb_t\fP *obj_cb, void *obj_cb_arg)"
.br
.ti -1c
.RI "uint32_t \fBrte_mempool_mem_iter\fP (struct \fBrte_mempool\fP *mp, \fBrte_mempool_mem_cb_t\fP *mem_cb, void *mem_cb_arg)"
.br
.ti -1c
.RI "void \fBrte_mempool_dump\fP (FILE *f, struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "struct \fBrte_mempool_cache\fP * \fBrte_mempool_cache_create\fP (uint32_t size, int socket_id)"
.br
.ti -1c
.RI "void \fBrte_mempool_cache_free\fP (struct \fBrte_mempool_cache\fP *cache)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP struct \fBrte_mempool_cache\fP * \fBrte_mempool_default_cache\fP (struct \fBrte_mempool\fP *mp, unsigned lcore_id)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP void \fBrte_mempool_cache_flush\fP (struct \fBrte_mempool_cache\fP *cache, struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP void \fBrte_mempool_generic_put\fP (struct \fBrte_mempool\fP *mp, void *const *obj_table, unsigned int n, struct \fBrte_mempool_cache\fP *cache)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP void \fBrte_mempool_put_bulk\fP (struct \fBrte_mempool\fP *mp, void *const *obj_table, unsigned int n)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP void \fBrte_mempool_put\fP (struct \fBrte_mempool\fP *mp, void *obj)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP int \fBrte_mempool_generic_get\fP (struct \fBrte_mempool\fP *mp, void **obj_table, unsigned int n, struct \fBrte_mempool_cache\fP *cache)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP int \fBrte_mempool_get_bulk\fP (struct \fBrte_mempool\fP *mp, void **obj_table, unsigned int n)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP int \fBrte_mempool_get\fP (struct \fBrte_mempool\fP *mp, void **obj_p)"
.br
.ti -1c
.RI "static \fB__rte_always_inline\fP int \fBrte_mempool_get_contig_blocks\fP (struct \fBrte_mempool\fP *mp, void **first_obj_table, unsigned int n)"
.br
.ti -1c
.RI "unsigned int \fBrte_mempool_avail_count\fP (const struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "unsigned int \fBrte_mempool_in_use_count\fP (const struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "static int \fBrte_mempool_full\fP (const struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "static int \fBrte_mempool_empty\fP (const struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "static \fBrte_iova_t\fP \fBrte_mempool_virt2iova\fP (const void *elt)"
.br
.ti -1c
.RI "void \fBrte_mempool_audit\fP (struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "static void * \fBrte_mempool_get_priv\fP (struct \fBrte_mempool\fP *mp)"
.br
.ti -1c
.RI "void \fBrte_mempool_list_dump\fP (FILE *f)"
.br
.ti -1c
.RI "struct \fBrte_mempool\fP * \fBrte_mempool_lookup\fP (const char *name)"
.br
.ti -1c
.RI "uint32_t \fBrte_mempool_calc_obj_size\fP (uint32_t elt_size, uint32_t flags, struct \fBrte_mempool_objsz\fP *sz)"
.br
.ti -1c
.RI "void \fBrte_mempool_walk\fP (void(*func)(struct \fBrte_mempool\fP *, void *arg), void *arg)"
.br
.ti -1c
.RI "__rte_experimental int \fBrte_mempool_get_mem_range\fP (const struct \fBrte_mempool\fP *mp, struct \fBrte_mempool_mem_range_info\fP *mem_range)"
.br
.ti -1c
.RI "__rte_experimental size_t \fBrte_mempool_get_obj_alignment\fP (const struct \fBrte_mempool\fP *mp)"
.br
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "struct rte_mempool_ops_table \fBrte_mempool_ops_table\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
RTE Mempool\&.

.PP
A memory pool is an allocator of fixed-size object\&. It is identified by its name, and uses a ring to store free objects\&. It provides some other optional services, like a per-core object cache, and an alignment helper to ensure that objects are padded to spread them equally on all RAM channels, ranks, and so on\&.

.PP
Objects owned by a mempool should never be added in another mempool\&. When an object is freed using \fBrte_mempool_put()\fP or equivalent, the object data is not modified; the user can save some meta-data in the object data and retrieve them when allocating a new object\&.

.PP
Note: the mempool implementation is not preemptible\&. An lcore must not be interrupted by another task that uses the same mempool (because it uses a ring which is not preemptible)\&. Also, usual mempool functions like \fBrte_mempool_get()\fP or \fBrte_mempool_put()\fP are designed to be called from an EAL thread due to the internal per-lcore cache\&. Due to the lack of caching, \fBrte_mempool_get()\fP or \fBrte_mempool_put()\fP performance will suffer when called by unregistered non-EAL threads\&. Instead, unregistered non-EAL threads should call \fBrte_mempool_generic_get()\fP or \fBrte_mempool_generic_put()\fP with a user cache created with \fBrte_mempool_cache_create()\fP\&. 
.PP
Definition in file \fBrte_mempool\&.h\fP\&.
.SH "Macro Definition Documentation"
.PP 
.SS "#define RTE_MEMPOOL_HEADER_COOKIE1   0xbadbadbadadd2e55ULL"
Header cookie\&. 
.PP
Definition at line \fB59\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_HEADER_COOKIE2   0xf2eef2eedadd2e55ULL"
Header cookie\&. 
.PP
Definition at line \fB60\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_TRAILER_COOKIE   0xadd2e55badbadbadULL"
Trailer cookie\&. 
.PP
Definition at line \fB61\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_ALIGN   RTE_CACHE_LINE_SIZE"
Alignment of elements inside mempool\&. 
.PP
Definition at line \fB139\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_F_NO_SPREAD   0x0001"
Spreading among memory channels not required\&. 
.PP
Definition at line \fB275\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define MEMPOOL_F_NO_SPREAD   \fBRTE_MEMPOOL_F_NO_SPREAD\fP"
Backward compatibility synonym for RTE_MEMPOOL_F_NO_SPREAD\&. To be deprecated\&. 
.PP
Definition at line \fB280\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_F_NO_CACHE_ALIGN   0x0002"
Do not align objects on cache lines\&. 
.PP
Definition at line \fB282\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define MEMPOOL_F_NO_CACHE_ALIGN   \fBRTE_MEMPOOL_F_NO_CACHE_ALIGN\fP"
Backward compatibility synonym for RTE_MEMPOOL_F_NO_CACHE_ALIGN\&. To be deprecated\&. 
.PP
Definition at line \fB287\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_F_SP_PUT   0x0004"
Default put is "single-producer"\&. 
.PP
Definition at line \fB289\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define MEMPOOL_F_SP_PUT   \fBRTE_MEMPOOL_F_SP_PUT\fP"
Backward compatibility synonym for RTE_MEMPOOL_F_SP_PUT\&. To be deprecated\&. 
.PP
Definition at line \fB294\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_F_SC_GET   0x0008"
Default get is "single-consumer"\&. 
.PP
Definition at line \fB296\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define MEMPOOL_F_SC_GET   \fBRTE_MEMPOOL_F_SC_GET\fP"
Backward compatibility synonym for RTE_MEMPOOL_F_SC_GET\&. To be deprecated\&. 
.PP
Definition at line \fB301\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_F_POOL_CREATED   0x0010"
Internal: pool is created\&. 
.PP
Definition at line \fB303\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_F_NO_IOVA_CONTIG   0x0020"
Don't need IOVA contiguous objects\&. 
.PP
Definition at line \fB305\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define MEMPOOL_F_NO_IOVA_CONTIG   \fBRTE_MEMPOOL_F_NO_IOVA_CONTIG\fP"
Backward compatibility synonym for RTE_MEMPOOL_F_NO_IOVA_CONTIG\&. To be deprecated\&. 
.PP
Definition at line \fB310\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_F_NON_IO   0x0040"
Internal: no object from the pool can be used for device IO (DMA)\&. 
.PP
Definition at line \fB312\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_VALID_USER_FLAGS"
\fBValue:\fP
.nf
    (RTE_MEMPOOL_F_NO_SPREAD \\
    | RTE_MEMPOOL_F_NO_CACHE_ALIGN \\
    | RTE_MEMPOOL_F_SP_PUT \\
    | RTE_MEMPOOL_F_SC_GET \\
    | RTE_MEMPOOL_F_NO_IOVA_CONTIG \\
    )
.PP
.fi
This macro lists all the mempool flags an application may request\&. 
.PP
Definition at line \fB317\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_OPS_NAMESIZE   32"
Max length of ops struct name\&. 
.PP
Definition at line \fB458\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_POPULATE_F_ALIGN_OBJ   0x0001"
Align objects on addresses multiple of total_elt_sz\&. 
.PP
Definition at line \fB634\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_MAX_OPS_IDX   16"
Max registered ops structs 
.PP
Definition at line \fB719\fP of file \fBrte_mempool\&.h\fP\&.
.SS "#define RTE_MEMPOOL_REGISTER_OPS( ops)"
\fBValue:\fP
.nf
    RTE_INIT(mp_hdlr_init_##ops)                \\
    {                           \\
        rte_mempool_register_ops(&ops);         \\
    }
.PP
.fi
Macro to statically register the ops of a mempool handler\&. Note that the rte_mempool_register_ops fails silently here when more than RTE_MEMPOOL_MAX_OPS_IDX is registered\&. 
.PP
Definition at line \fB988\fP of file \fBrte_mempool\&.h\fP\&.
.SH "Typedef Documentation"
.PP 
.SS "\fBtypedef\fP void rte_mempool_memchunk_free_cb_t(struct \fBrte_mempool_memhdr\fP *memhdr, void *opaque)"
Callback used to free a memory chunk 
.PP
Definition at line \fB197\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP int(* rte_mempool_alloc_t) (struct \fBrte_mempool\fP *mp)"
Prototype for implementation specific data provisioning function\&.

.PP
The function should provide the implementation specific memory for use by the other mempool ops functions in a given mempool ops struct\&. E\&.g\&. the default ops provides an instance of the \fBrte_ring\fP for this purpose\&. it will most likely point to a different type of data structure, and will be transparent to the application programmer\&. This function should set mp->pool_data\&. 
.PP
Definition at line \fB470\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP void(* rte_mempool_free_t) (struct \fBrte_mempool\fP *mp)"
Free the opaque private data pointed to by mp->pool_data pointer\&. 
.PP
Definition at line \fB475\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP int(* rte_mempool_enqueue_t) (struct \fBrte_mempool\fP *mp, void *const *obj_table, unsigned int n)"
Enqueue 'n' objects into the external pool\&. 
.PP
\fBReturns\fP
.RS 4

.IP "\(bu" 2
0: Success
.IP "\(bu" 2
<0: Error 
.PP
.RE
.PP

.PP
Definition at line \fB483\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP int(* rte_mempool_dequeue_t) (struct \fBrte_mempool\fP *mp, void **obj_table, unsigned int n)"
Dequeue 'n' objects from the external pool\&. 
.PP
\fBReturns\fP
.RS 4

.IP "\(bu" 2
0: Success
.IP "\(bu" 2
<0: Error 
.PP
.RE
.PP

.PP
Definition at line \fB492\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP int(* rte_mempool_dequeue_contig_blocks_t) (struct \fBrte_mempool\fP *mp, void **first_obj_table, unsigned int n)"
Dequeue a number of contiguous object blocks from the external pool\&. 
.PP
Definition at line \fB498\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP unsigned(* rte_mempool_get_count) (const struct \fBrte_mempool\fP *mp)"
Return the number of available objects in the external pool\&. 
.PP
Definition at line \fB504\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP ssize_t(* rte_mempool_calc_mem_size_t) (const struct \fBrte_mempool\fP *mp, uint32_t obj_num, uint32_t pg_shift, size_t *min_chunk_size, size_t *align)"
Calculate memory size required to store given number of objects\&.

.PP
If mempool objects are not required to be IOVA-contiguous (the flag RTE_MEMPOOL_F_NO_IOVA_CONTIG is set), min_chunk_size defines virtually contiguous chunk size\&. Otherwise, if mempool objects must be IOVA-contiguous (the flag RTE_MEMPOOL_F_NO_IOVA_CONTIG is clear), min_chunk_size defines IOVA-contiguous chunk size\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP Pointer to the memory pool\&. 
.br
\fIobj_num\fP Number of objects\&. 
.br
\fIpg_shift\fP LOG2 of the physical pages size\&. If set to 0, ignore page boundaries\&. 
.br
\fImin_chunk_size\fP Location for minimum size of the memory chunk which may be used to store memory pool objects\&. 
.br
\fIalign\fP Location for required memory chunk alignment\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Required memory size\&. 
.RE
.PP

.PP
Definition at line \fB529\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP void rte_mempool_populate_obj_cb_t(struct \fBrte_mempool\fP *mp, void *opaque, void *vaddr, \fBrte_iova_t\fP iova)"
Function to be called for each populated object\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIopaque\fP An opaque pointer passed to iterator\&. 
.br
\fIvaddr\fP Object virtual address\&. 
.br
\fIiova\fP Input/output virtual address of the object or RTE_BAD_IOVA\&. 
.RE
.PP

.PP
Definition at line \fB595\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP int(* rte_mempool_populate_t) (struct \fBrte_mempool\fP *mp, unsigned int max_objs, void *vaddr, \fBrte_iova_t\fP iova, size_t len, \fBrte_mempool_populate_obj_cb_t\fP *obj_cb, void *obj_cb_arg)"
Populate memory pool objects using provided memory chunk\&.

.PP
Populated objects should be enqueued to the pool, e\&.g\&. using rte_mempool_ops_enqueue_bulk()\&.

.PP
If the given IO address is unknown (iova = RTE_BAD_IOVA), the chunk doesn't need to be physically contiguous (only virtually), and allocated objects may span two pages\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fImax_objs\fP Maximum number of objects to be populated\&. 
.br
\fIvaddr\fP The virtual address of memory that should be used to store objects\&. 
.br
\fIiova\fP The IO address 
.br
\fIlen\fP The length of memory in bytes\&. 
.br
\fIobj_cb\fP Callback function to be executed for each populated object\&. 
.br
\fIobj_cb_arg\fP An opaque pointer passed to the callback function\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The number of objects added on success\&. On error, no objects are populated and a negative errno is returned\&. 
.RE
.PP

.PP
Definition at line \fB626\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP int(* rte_mempool_get_info_t) (const struct \fBrte_mempool\fP *mp, struct \fBrte_mempool_info\fP *info)"
Get some additional information about a mempool\&. 
.PP
Definition at line \fB687\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP void rte_mempool_obj_cb_t(struct \fBrte_mempool\fP *mp, void *opaque, void *obj, unsigned obj_idx)"
An object callback function for mempool\&.

.PP
Used by \fBrte_mempool_create()\fP and \fBrte_mempool_obj_iter()\fP\&. 
.PP
Definition at line \fB999\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP void rte_mempool_mem_cb_t(struct \fBrte_mempool\fP *mp, void *opaque, struct \fBrte_mempool_memhdr\fP *memhdr, unsigned mem_idx)"
A memory callback function for mempool\&.

.PP
Used by \fBrte_mempool_mem_iter()\fP\&. 
.PP
Definition at line \fB1008\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBtypedef\fP void rte_mempool_ctor_t(struct \fBrte_mempool\fP *, void *)"
A mempool constructor callback function\&.

.PP
Arguments are the mempool and the opaque pointer given by the user in \fBrte_mempool_create()\fP\&. 
.PP
Definition at line \fB1018\fP of file \fBrte_mempool\&.h\fP\&.
.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBrte_mempool_event\fP"
Mempool event type\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\f(BIRTE_MEMPOOL_EVENT_READY \fP
Occurs after a mempool is fully populated\&. 
.TP
\f(BIRTE_MEMPOOL_EVENT_DESTROY \fP
Occurs before the destruction of a mempool begins\&. 
.PP
Definition at line \fB1991\fP of file \fBrte_mempool\&.h\fP\&.
.SH "Function Documentation"
.PP 
.SS "RTE_STAILQ_HEAD (rte_mempool_objhdr_list , \fBrte_mempool_objhdr\fP )"
A list of object headers type 
.SS "RTE_STAILQ_HEAD (rte_mempool_memhdr_list , \fBrte_mempool_memhdr\fP )"
A list of memory where objects are stored 
.SS "struct \fBrte_mempool\fP * rte_mempool_from_obj (void * obj)\fR [inline]\fP, \fR [static]\fP"
Return a pointer to the mempool owning this object\&.

.PP
\fBParameters\fP
.RS 4
\fIobj\fP An object that is owned by a pool\&. If this is not the case, the behavior is undefined\&. 
.RE
.PP
\fBReturns\fP
.RS 4
A pointer to the mempool structure\&. 
.RE
.PP

.PP
Definition at line \fB392\fP of file \fBrte_mempool\&.h\fP\&.
.SS "ssize_t rte_mempool_op_calc_mem_size_default (const struct \fBrte_mempool\fP * mp, uint32_t obj_num, uint32_t pg_shift, size_t * min_chunk_size, size_t * align)"
Default way to calculate memory size required to store given number of objects\&.

.PP
Equivalent to rte_mempool_op_calc_mem_size_helper(mp, obj_num, pg_shift,
0, min_chunk_size, align)\&. 
.SS "int rte_mempool_op_populate_default (struct \fBrte_mempool\fP * mp, unsigned int max_objs, void * vaddr, \fBrte_iova_t\fP iova, size_t len, \fBrte_mempool_populate_obj_cb_t\fP * obj_cb, void * obj_cb_arg)"
Default way to populate memory pool object using provided memory chunk\&.

.PP
Equivalent to rte_mempool_op_populate_helper(mp, 0, max_objs, vaddr, iova,
len, obj_cb, obj_cb_arg)\&. 
.SS "int rte_mempool_ops_get_info (const struct \fBrte_mempool\fP * mp, struct \fBrte_mempool_info\fP * info)"
Wrapper for mempool_ops get_info callback\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP Pointer to the memory pool\&. 
.br
\fIinfo\fP Pointer to the \fBrte_mempool_info\fP structure 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0: Success; The mempool driver supports retrieving supplementary mempool information
.IP "\(bu" 2
-ENOTSUP - doesn't support get_info ops (valid case)\&. 
.PP
.RE
.PP

.SS "int rte_mempool_set_ops_byname (struct \fBrte_mempool\fP * mp, const char * name, void * pool_config)"
Set the ops of a mempool\&.

.PP
This can only be done on a mempool that is not populated, i\&.e\&. just after a call to \fBrte_mempool_create_empty()\fP\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP Pointer to the memory pool\&. 
.br
\fIname\fP Name of the ops structure to use for this mempool\&. 
.br
\fIpool_config\fP Opaque data that can be passed by the application to the ops functions\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0: Success; the mempool is now using the requested ops functions\&.
.IP "\(bu" 2
-EINVAL - Invalid ops struct name provided\&.
.IP "\(bu" 2
-EEXIST - mempool already has an ops struct assigned\&. 
.PP
.RE
.PP

.SS "int rte_mempool_register_ops (const struct \fBrte_mempool_ops\fP * ops)"
Register mempool operations\&.

.PP
\fBParameters\fP
.RS 4
\fIops\fP Pointer to an ops structure to register\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
>=0: Success; return the index of the ops struct in the table\&.
.IP "\(bu" 2
-EINVAL - some missing callbacks while registering ops struct\&.
.IP "\(bu" 2
-ENOSPC - the maximum number of ops structs has been reached\&. 
.PP
.RE
.PP

.SS "void rte_mempool_free (struct \fBrte_mempool\fP * mp)"
Free a mempool

.PP
Unlink the mempool from global list, free the memory chunks, and all memory referenced by the mempool\&. The objects must not be used by other cores as they will be freed\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. If NULL then, the function does nothing\&. 
.RE
.PP

.SS "struct \fBrte_mempool\fP * rte_mempool_create (const char * name, unsigned n, unsigned elt_size, unsigned cache_size, unsigned private_data_size, \fBrte_mempool_ctor_t\fP * mp_init, void * mp_init_arg, \fBrte_mempool_obj_cb_t\fP * obj_init, void * obj_init_arg, int socket_id, unsigned int flags)"
Create a new mempool named \fIname\fP in memory\&.

.PP
This function uses \fR\fBrte_memzone_reserve()\fP\fP to allocate memory\&. The pool contains n elements of elt_size\&. Its size is set to n\&.

.PP
\fBParameters\fP
.RS 4
\fIname\fP The name of the mempool\&. 
.br
\fIn\fP The 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)\&. 
.br
\fIelt_size\fP The size of each element\&. 
.br
\fIcache_size\fP If cache_size is non-zero, the \fBrte_mempool\fP library will try to limit the accesses to the common lockless pool, by maintaining a per-lcore object cache\&. This argument must be lower or equal to RTE_MEMPOOL_CACHE_MAX_SIZE and n / 1\&.5\&. It is advised to choose cache_size to have "n modulo cache_size == 0": if this is not the case, some elements will always stay in the pool and will never be used\&. The access to the per-lcore table is of course faster than the multi-producer/consumer pool\&. The cache can be disabled if the cache_size argument is set to 0; it can be useful to avoid losing objects in cache\&. 
.br
\fIprivate_data_size\fP The size of the private data appended after the mempool structure\&. This is useful for storing some private data after the mempool structure, as is done for rte_mbuf_pool for example\&. 
.br
\fImp_init\fP A function pointer that is called for initialization of the pool, before object initialization\&. The user can initialize the private data in this function if needed\&. This parameter can be NULL if not needed\&. 
.br
\fImp_init_arg\fP An opaque pointer to data that can be used in the mempool constructor function\&. 
.br
\fIobj_init\fP A 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\&. 
.br
\fIobj_init_arg\fP An opaque pointer to data that can be used as an argument for each call to the object constructor function\&. 
.br
\fIsocket_id\fP The \fIsocket_id\fP argument is the socket identifier in the case of NUMA\&. The value can be \fISOCKET_ID_ANY\fP if there is no NUMA constraint for the reserved zone\&. 
.br
\fIflags\fP The \fIflags\fP arguments is an OR of following flags:
.IP "\(bu" 2
RTE_MEMPOOL_F_NO_SPREAD: By default, objects addresses are spread between channels in RAM: the pool allocator will add padding between objects depending on the hardware configuration\&. See Memory alignment constraints for details\&. If this flag is set, the allocator will just align them to a cache line\&.
.IP "\(bu" 2
RTE_MEMPOOL_F_NO_CACHE_ALIGN: By default, the returned objects are cache-aligned\&. This flag removes this constraint, and no padding will be present between objects\&. This flag implies RTE_MEMPOOL_F_NO_SPREAD\&.
.IP "\(bu" 2
RTE_MEMPOOL_F_SP_PUT: If this flag is set, the default behavior when using \fBrte_mempool_put()\fP or \fBrte_mempool_put_bulk()\fP is "single-producer"\&. Otherwise, it is "multi-producers"\&.
.IP "\(bu" 2
RTE_MEMPOOL_F_SC_GET: If this flag is set, the default behavior when using \fBrte_mempool_get()\fP or \fBrte_mempool_get_bulk()\fP is "single-consumer"\&. Otherwise, it is "multi-consumers"\&.
.IP "\(bu" 2
RTE_MEMPOOL_F_NO_IOVA_CONTIG: If set, allocated objects won't necessarily be contiguous in IO memory\&. 
.PP
.RE
.PP
\fBReturns\fP
.RS 4
The pointer to the new allocated mempool, on success\&. NULL on error with rte_errno set appropriately\&. Possible rte_errno values include:
.IP "\(bu" 2
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
.IP "\(bu" 2
EINVAL - cache size provided is too large or an unknown flag was passed
.IP "\(bu" 2
ENOSPC - the maximum number of memzones has already been allocated
.IP "\(bu" 2
EEXIST - a memzone with the same name already exists
.IP "\(bu" 2
ENOMEM - no appropriate memory area found in which to create memzone 
.PP
.RE
.PP

.SS "struct \fBrte_mempool\fP struct \fBrte_mempool\fP * rte_mempool_create_empty (const char * name, unsigned int n, unsigned int elt_size, unsigned int cache_size, unsigned int private_data_size, int socket_id, unsigned int flags)"
Create an empty mempool

.PP
The mempool is allocated and initialized, but it is not populated: no memory is allocated for the mempool elements\&. The user has to call rte_mempool_populate_*() to add memory chunks to the pool\&. Once populated, the user may also want to initialize each object with \fBrte_mempool_obj_iter()\fP\&.

.PP
\fBParameters\fP
.RS 4
\fIname\fP The name of the mempool\&. 
.br
\fIn\fP The maximum number of elements that can be added 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)\&. 
.br
\fIelt_size\fP The size of each element\&. 
.br
\fIcache_size\fP Size of the cache\&. See \fBrte_mempool_create()\fP for details\&. 
.br
\fIprivate_data_size\fP The size of the private data appended after the mempool structure\&. This is useful for storing some private data after the mempool structure, as is done for rte_mbuf_pool for example\&. 
.br
\fIsocket_id\fP The \fIsocket_id\fP argument is the socket identifier in the case of NUMA\&. The value can be \fISOCKET_ID_ANY\fP if there is no NUMA constraint for the reserved zone\&. 
.br
\fIflags\fP Flags controlling the behavior of the mempool\&. See \fBrte_mempool_create()\fP for details\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The pointer to the new allocated mempool, on success\&. NULL on error with rte_errno set appropriately\&. See \fBrte_mempool_create()\fP for details\&. 
.RE
.PP

.SS "struct \fBrte_mempool\fP struct \fBrte_mempool\fP int rte_mempool_populate_iova (struct \fBrte_mempool\fP * mp, char * vaddr, \fBrte_iova_t\fP iova, size_t len, \fBrte_mempool_memchunk_free_cb_t\fP * free_cb, void * opaque)"
Add physically contiguous memory for objects in the pool at init

.PP
Add a virtually and physically contiguous memory chunk in the pool where objects can be instantiated\&.

.PP
If the given IO address is unknown (iova = RTE_BAD_IOVA), the chunk doesn't need to be physically contiguous (only virtually), and allocated objects may span two pages\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIvaddr\fP The virtual address of memory that should be used to store objects\&. 
.br
\fIiova\fP The IO address 
.br
\fIlen\fP The length of memory in bytes\&. 
.br
\fIfree_cb\fP The callback used to free this chunk when destroying the mempool\&. 
.br
\fIopaque\fP An opaque argument passed to free_cb\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The number of objects added on success (strictly positive)\&. On error, the chunk is not added in the memory list of the mempool the following code is returned: (0): not enough room in chunk for one object\&. (-ENOSPC): mempool is already populated\&. (-ENOMEM): allocation failure\&. 
.RE
.PP

.SS "int rte_mempool_populate_virt (struct \fBrte_mempool\fP * mp, char * addr, size_t len, size_t pg_sz, \fBrte_mempool_memchunk_free_cb_t\fP * free_cb, void * opaque)"
Add virtually contiguous memory for objects in the pool at init

.PP
Add a virtually contiguous memory chunk in the pool where objects can be instantiated\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIaddr\fP The virtual address of memory that should be used to store objects\&. 
.br
\fIlen\fP The length of memory in bytes\&. 
.br
\fIpg_sz\fP The size of memory pages in this virtual area\&. 
.br
\fIfree_cb\fP The callback used to free this chunk when destroying the mempool\&. 
.br
\fIopaque\fP An opaque argument passed to free_cb\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The number of objects added on success (strictly positive)\&. On error, the chunk is not added in the memory list of the mempool the following code is returned: (0): not enough room in chunk for one object\&. (-ENOSPC): mempool is already populated\&. (-ENOMEM): allocation failure\&. 
.RE
.PP

.SS "int rte_mempool_populate_default (struct \fBrte_mempool\fP * mp)"
Add memory for objects in the pool at init

.PP
This is the default function used by \fBrte_mempool_create()\fP to populate the mempool\&. It adds memory allocated using \fBrte_memzone_reserve()\fP\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The number of objects added on success\&. On error, the chunk is not added in the memory list of the mempool and a negative errno is returned\&. 
.RE
.PP

.SS "int rte_mempool_populate_anon (struct \fBrte_mempool\fP * mp)"
Add memory from anonymous mapping for objects in the pool at init

.PP
This function mmap an anonymous memory zone that is locked in memory to store the objects of the mempool\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The number of objects added on success\&. On error, 0 is returned, rte_errno is set, and the chunk is not added in the memory list of the mempool\&. 
.RE
.PP

.SS "uint32_t rte_mempool_obj_iter (struct \fBrte_mempool\fP * mp, \fBrte_mempool_obj_cb_t\fP * obj_cb, void * obj_cb_arg)"
Call a function for each mempool element

.PP
Iterate across all objects attached to a \fBrte_mempool\fP and call the callback function on it\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to an initialized mempool\&. 
.br
\fIobj_cb\fP A function pointer that is called for each object\&. 
.br
\fIobj_cb_arg\fP An opaque pointer passed to the callback function\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Number of objects iterated\&. 
.RE
.PP

.SS "uint32_t rte_mempool_mem_iter (struct \fBrte_mempool\fP * mp, \fBrte_mempool_mem_cb_t\fP * mem_cb, void * mem_cb_arg)"
Call a function for each mempool memory chunk

.PP
Iterate across all memory chunks attached to a \fBrte_mempool\fP and call the callback function on it\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to an initialized mempool\&. 
.br
\fImem_cb\fP A function pointer that is called for each memory chunk\&. 
.br
\fImem_cb_arg\fP An opaque pointer passed to the callback function\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Number of memory chunks iterated\&. 
.RE
.PP

.SS "void rte_mempool_dump (FILE * f, struct \fBrte_mempool\fP * mp)"
Dump the status of the mempool to a file\&.

.PP
\fBParameters\fP
.RS 4
\fIf\fP A pointer to a file for output 
.br
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP

.SS "struct \fBrte_mempool_cache\fP * rte_mempool_cache_create (uint32_t size, int socket_id)"
Create a user-owned mempool cache\&.

.PP
This can be used by unregistered non-EAL threads to enable caching when they interact with a mempool\&.

.PP
\fBParameters\fP
.RS 4
\fIsize\fP The size of the mempool cache\&. See \fBrte_mempool_create()\fP's cache_size parameter description for more information\&. The same limits and considerations apply here too\&. 
.br
\fIsocket_id\fP The socket identifier in the case of NUMA\&. The value can be SOCKET_ID_ANY if there is no NUMA constraint for the reserved zone\&. 
.RE
.PP

.SS "void rte_mempool_cache_free (struct \fBrte_mempool_cache\fP * cache)"
Free a user-owned mempool cache\&.

.PP
\fBParameters\fP
.RS 4
\fIcache\fP A pointer to the mempool cache\&. 
.RE
.PP

.SS "\fB__rte_always_inline\fP struct \fBrte_mempool_cache\fP * rte_mempool_default_cache (struct \fBrte_mempool\fP * mp, unsigned lcore_id)\fR [static]\fP"
Get a pointer to the per-lcore default mempool cache\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIlcore_id\fP The logical core id\&. 
.RE
.PP
\fBReturns\fP
.RS 4
A pointer to the mempool cache or NULL if disabled or unregistered non-EAL thread\&. 
.RE
.PP

.PP
Definition at line \fB1339\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP void rte_mempool_cache_flush (struct \fBrte_mempool_cache\fP * cache, struct \fBrte_mempool\fP * mp)\fR [static]\fP"
Flush a user-owned mempool cache to the specified mempool\&.

.PP
\fBParameters\fP
.RS 4
\fIcache\fP A pointer to the mempool cache\&. 
.br
\fImp\fP A pointer to the mempool\&. 
.RE
.PP

.PP
Definition at line \fB1361\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP void rte_mempool_generic_put (struct \fBrte_mempool\fP * mp, void *const * obj_table, unsigned int n, struct \fBrte_mempool_cache\fP * cache)\fR [static]\fP"
Put several objects back in the mempool\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIobj_table\fP A pointer to a table of void * pointers (objects)\&. 
.br
\fIn\fP The number of objects to add in the mempool from the obj_table\&. 
.br
\fIcache\fP A pointer to a mempool cache structure\&. May be NULL if not needed\&. 
.RE
.PP

.PP
Definition at line \fB1451\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP void rte_mempool_put_bulk (struct \fBrte_mempool\fP * mp, void *const * obj_table, unsigned int n)\fR [static]\fP"
Put several objects back in the mempool\&.

.PP
This function calls the multi-producer or the single-producer version depending on the default behavior that was specified at mempool creation time (see flags)\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIobj_table\fP A pointer to a table of void * pointers (objects)\&. 
.br
\fIn\fP The number of objects to add in the mempool from obj_table\&. 
.RE
.PP

.PP
Definition at line \fB1474\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP void rte_mempool_put (struct \fBrte_mempool\fP * mp, void * obj)\fR [static]\fP"
Put one object back in the mempool\&.

.PP
This function calls the multi-producer or the single-producer version depending on the default behavior that was specified at mempool creation time (see flags)\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIobj\fP A pointer to the object to be added\&. 
.RE
.PP

.PP
Definition at line \fB1496\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP int rte_mempool_generic_get (struct \fBrte_mempool\fP * mp, void ** obj_table, unsigned int n, struct \fBrte_mempool_cache\fP * cache)\fR [static]\fP"
Get several objects from the mempool\&.

.PP
If cache is enabled, objects will be retrieved first from cache, subsequently from the common pool\&. Note that it can return -ENOENT when the local cache and common pool are empty, even if cache from other lcores are full\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIobj_table\fP A pointer to a table of void * pointers (objects) that will be filled\&. 
.br
\fIn\fP The number of objects to get from mempool to obj_table\&. 
.br
\fIcache\fP A pointer to a mempool cache structure\&. May be NULL if not needed\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0: Success; objects taken\&.
.IP "\(bu" 2
-ENOENT: Not enough entries in the mempool; no object is retrieved\&. 
.PP
.RE
.PP

.PP
Definition at line \fB1657\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP int rte_mempool_get_bulk (struct \fBrte_mempool\fP * mp, void ** obj_table, unsigned int n)\fR [static]\fP"
Get several objects from the mempool\&.

.PP
This function calls the multi-consumers or the single-consumer version, depending on the default behaviour that was specified at mempool creation time (see flags)\&.

.PP
If cache is enabled, objects will be retrieved first from cache, subsequently from the common pool\&. Note that it can return -ENOENT when the local cache and common pool are empty, even if cache from other lcores are full\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIobj_table\fP A pointer to a table of void * pointers (objects) that will be filled\&. 
.br
\fIn\fP The number of objects to get from the mempool to obj_table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0: Success; objects taken
.IP "\(bu" 2
-ENOENT: Not enough entries in the mempool; no object is retrieved\&. 
.PP
.RE
.PP

.PP
Definition at line \fB1691\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP int rte_mempool_get (struct \fBrte_mempool\fP * mp, void ** obj_p)\fR [static]\fP"
Get one object from the mempool\&.

.PP
This function calls the multi-consumers or the single-consumer version, depending on the default behavior that was specified at mempool creation (see flags)\&.

.PP
If cache is enabled, objects will be retrieved first from cache, subsequently from the common pool\&. Note that it can return -ENOENT when the local cache and common pool are empty, even if cache from other lcores are full\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIobj_p\fP A pointer to a void * pointer (object) that will be filled\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0: Success; objects taken\&.
.IP "\(bu" 2
-ENOENT: Not enough entries in the mempool; no object is retrieved\&. 
.PP
.RE
.PP

.PP
Definition at line \fB1720\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fB__rte_always_inline\fP int rte_mempool_get_contig_blocks (struct \fBrte_mempool\fP * mp, void ** first_obj_table, unsigned int n)\fR [static]\fP"
Get a contiguous blocks of objects from the mempool\&.

.PP
If cache is enabled, consider to flush it first, to reuse objects as soon as possible\&.

.PP
The application should check that the driver supports the operation by calling \fBrte_mempool_ops_get_info()\fP and checking that \fRcontig_block_size\fP is not zero\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.br
\fIfirst_obj_table\fP A pointer to a pointer to the first object in each block\&. 
.br
\fIn\fP The number of blocks to get from mempool\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0: Success; blocks taken\&.
.IP "\(bu" 2
-ENOBUFS: Not enough entries in the mempool; no object is retrieved\&.
.IP "\(bu" 2
-EOPNOTSUPP: The mempool driver does not support block dequeue 
.PP
.RE
.PP

.PP
Definition at line \fB1747\fP of file \fBrte_mempool\&.h\fP\&.
.SS "unsigned int rte_mempool_avail_count (const struct \fBrte_mempool\fP * mp)"
Return the number of entries in the mempool\&.

.PP
When cache is enabled, this function has to browse the length of all lcores, so it should not be used in a data path, but only for debug purposes\&. User-owned mempool caches are not accounted for\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The number of entries in the mempool\&. 
.RE
.PP

.SS "unsigned int rte_mempool_in_use_count (const struct \fBrte_mempool\fP * mp)"
Return the number of elements which have been allocated from the mempool

.PP
When cache is enabled, this function has to browse the length of all lcores, so it should not be used in a data path, but only for debug purposes\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The number of free entries in the mempool\&. 
.RE
.PP

.SS "int rte_mempool_full (const struct \fBrte_mempool\fP * mp)\fR [inline]\fP, \fR [static]\fP"
Test if the mempool is full\&.

.PP
When cache is enabled, this function has to browse the length of all lcores, so it should not be used in a data path, but only for debug purposes\&. User-owned mempool caches are not accounted for\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
1: The mempool is full\&.
.IP "\(bu" 2
0: The mempool is not full\&. 
.PP
.RE
.PP

.PP
Definition at line \fB1810\fP of file \fBrte_mempool\&.h\fP\&.
.SS "int rte_mempool_empty (const struct \fBrte_mempool\fP * mp)\fR [inline]\fP, \fR [static]\fP"
Test if the mempool is empty\&.

.PP
When cache is enabled, this function has to browse the length of all lcores, so it should not be used in a data path, but only for debug purposes\&. User-owned mempool caches are not accounted for\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
1: The mempool is empty\&.
.IP "\(bu" 2
0: The mempool is not empty\&. 
.PP
.RE
.PP

.PP
Definition at line \fB1829\fP of file \fBrte_mempool\&.h\fP\&.
.SS "\fBrte_iova_t\fP rte_mempool_virt2iova (const void * elt)\fR [inline]\fP, \fR [static]\fP"
Return the IO address of elt, which is an element of the pool mp\&.

.PP
\fBParameters\fP
.RS 4
\fIelt\fP A pointer (virtual address) to the element of the pool\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The IO address of the elt element\&. If the mempool was created with RTE_MEMPOOL_F_NO_IOVA_CONTIG, the returned value is RTE_BAD_IOVA\&. 
.RE
.PP

.PP
Definition at line \fB1845\fP of file \fBrte_mempool\&.h\fP\&.
.SS "void rte_mempool_audit (struct \fBrte_mempool\fP * mp)"
Check the consistency of mempool objects\&.

.PP
Verify the coherency of fields in the mempool structure\&. Also check that the cookies of mempool objects (even the ones that are not present in pool) have a correct value\&. If not, a panic will occur\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP

.SS "void * rte_mempool_get_priv (struct \fBrte_mempool\fP * mp)\fR [inline]\fP, \fR [static]\fP"
Return a pointer to the private data in an mempool structure\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP A pointer to the mempool structure\&. 
.RE
.PP
\fBReturns\fP
.RS 4
A pointer to the private data\&. 
.RE
.PP

.PP
Definition at line \fB1873\fP of file \fBrte_mempool\&.h\fP\&.
.SS "void rte_mempool_list_dump (FILE * f)"
Dump the status of all mempools on the console

.PP
\fBParameters\fP
.RS 4
\fIf\fP A pointer to a file for output 
.RE
.PP

.SS "struct \fBrte_mempool\fP * rte_mempool_lookup (const char * name)"
Search a mempool from its name

.PP
\fBParameters\fP
.RS 4
\fIname\fP The name of the mempool\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The pointer to the mempool matching the name, or NULL if not found\&. NULL on error with rte_errno set appropriately\&. Possible rte_errno values include:
.IP "\(bu" 2
ENOENT - required entry not available to return\&. 
.PP
.RE
.PP

.SS "uint32_t rte_mempool_calc_obj_size (uint32_t elt_size, uint32_t flags, struct \fBrte_mempool_objsz\fP * sz)"
Get the header, trailer and total size of a mempool element\&.

.PP
Given a desired size of the mempool element and mempool flags, calculates header, trailer, body and total sizes of the mempool object\&.

.PP
\fBParameters\fP
.RS 4
\fIelt_size\fP The size of each element, without header and trailer\&. 
.br
\fIflags\fP The flags used for the mempool creation\&. Consult \fBrte_mempool_create()\fP for more information about possible values\&. The size of each element\&. 
.br
\fIsz\fP The calculated detailed size the mempool object\&. May be NULL\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Total size of the mempool object\&. 
.RE
.PP

.SS "void rte_mempool_walk (void(* func )(struct \fBrte_mempool\fP *, void *arg), void * arg)"
Walk list of all memory pools

.PP
\fBParameters\fP
.RS 4
\fIfunc\fP Iterator function 
.br
\fIarg\fP Argument passed to iterator 
.RE
.PP

.SS "__rte_experimental int rte_mempool_get_mem_range (const struct \fBrte_mempool\fP * mp, struct \fBrte_mempool_mem_range_info\fP * mem_range)"

.PP
\fBWarning\fP
.RS 4
\fBEXPERIMENTAL:\fP this API may change without prior notice\&.
.RE
.PP
Get information about the memory range used to store objects in the mempool\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP Pointer to an initialized mempool\&. 
.br
\fImem_range\fP Pointer to struct which is used to return lowest address, length of the memory range containing all the addresses, and whether these addresses are contiguous\&. 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -EINVAL if mempool is not valid or mem_range is NULL\&. 
.RE
.PP

.SS "__rte_experimental size_t rte_mempool_get_obj_alignment (const struct \fBrte_mempool\fP * mp)"

.PP
\fBWarning\fP
.RS 4
\fBEXPERIMENTAL:\fP this API may change without prior notice\&.
.RE
.PP
Return alignment of objects stored in the mempool\&.

.PP
\fBParameters\fP
.RS 4
\fImp\fP Pointer to a mempool\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Object alignment if mp is valid\&. 0 if mp is NULL\&. 
.RE
.PP

.SH "Variable Documentation"
.PP 
.SS "struct rte_mempool_ops_table rte_mempool_ops_table\fR [extern]\fP"
Array of registered ops structs\&. 
.SH "Author"
.PP 
Generated automatically by Doxygen for DPDK from the source code\&.
