---
name: "rte_mempool.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_mempool.h"
---

# rte\_mempool.h(3)

## NAME

rte\_mempool.h

## SYNOPSIS

`#include <stdalign.h>`\
 `#include <stdio.h>`\
 `#include <stdint.h>`\
 `#include <inttypes.h>`\
 `#include <rte_compat.h>`\
 `#include <rte_config.h>`\
 `#include <rte_spinlock.h>`\
 `#include <rte_debug.h>`\
 `#include <rte_lcore.h>`\
 `#include <rte_log.h>`\
 `#include <rte_branch_prediction.h>`\
 `#include <rte_ring.h>`\
 `#include <rte_memcpy.h>`\
 `#include <rte_common.h>`\
 `#include 'rte_mempool_trace_fp.h'`\

### Data Structures

struct **rte\_mempool\_cache**\
 struct **rte\_mempool\_objsz**\
 struct **rte\_mempool\_objhdr**\
 struct **rte\_mempool\_memhdr**\
 struct **rte\_mempool\_info**\
 struct **rte\_mempool**\
 struct **rte\_mempool\_ops**\
 struct **rte\_mempool\_ops\_table**\
 struct **rte\_mempool\_mem\_range\_info**\

### Macros

\#define **RTE\_MEMPOOL\_HEADER\_COOKIE1**   0xbadbadbadadd2e55ULL\
 \#define **RTE\_MEMPOOL\_HEADER\_COOKIE2**   0xf2eef2eedadd2e55ULL\
 \#define **RTE\_MEMPOOL\_TRAILER\_COOKIE**   0xadd2e55badbadbadULL\
 \#define **RTE\_MEMPOOL\_ALIGN**   RTE\_CACHE\_LINE\_SIZE\
 \#define **RTE\_MEMPOOL\_F\_NO\_SPREAD**   0x0001\
 \#define **MEMPOOL\_F\_NO\_SPREAD**   **RTE\_MEMPOOL\_F\_NO\_SPREAD**\
 \#define **RTE\_MEMPOOL\_F\_NO\_CACHE\_ALIGN**   0x0002\
 \#define **MEMPOOL\_F\_NO\_CACHE\_ALIGN**   **RTE\_MEMPOOL\_F\_NO\_CACHE\_ALIGN**\
 \#define **RTE\_MEMPOOL\_F\_SP\_PUT**   0x0004\
 \#define **MEMPOOL\_F\_SP\_PUT**   **RTE\_MEMPOOL\_F\_SP\_PUT**\
 \#define **RTE\_MEMPOOL\_F\_SC\_GET**   0x0008\
 \#define **MEMPOOL\_F\_SC\_GET**   **RTE\_MEMPOOL\_F\_SC\_GET**\
 \#define **RTE\_MEMPOOL\_F\_POOL\_CREATED**   0x0010\
 \#define **RTE\_MEMPOOL\_F\_NO\_IOVA\_CONTIG**   0x0020\
 \#define **MEMPOOL\_F\_NO\_IOVA\_CONTIG**   **RTE\_MEMPOOL\_F\_NO\_IOVA\_CONTIG**\
 \#define **RTE\_MEMPOOL\_F\_NON\_IO**   0x0040\
 \#define **RTE\_MEMPOOL\_VALID\_USER\_FLAGS**\
 \#define **RTE\_MEMPOOL\_OPS\_NAMESIZE**   32\
 \#define **RTE\_MEMPOOL\_POPULATE\_F\_ALIGN\_OBJ**   0x0001\
 \#define **RTE\_MEMPOOL\_MAX\_OPS\_IDX**   16\
 \#define **RTE\_MEMPOOL\_REGISTER\_OPS**(ops)\

### Typedefs

**typedef** void() **rte\_mempool\_memchunk\_free\_cb\_t**(struct **rte\_mempool\_memhdr** \*memhdr, void \*opaque)\
 **typedef** int(\* **rte\_mempool\_alloc\_t**) (struct **rte\_mempool** \*mp)\
 **typedef** void(\* **rte\_mempool\_free\_t**) (struct **rte\_mempool** \*mp)\
 **typedef** int(\* **rte\_mempool\_enqueue\_t**) (struct **rte\_mempool** \*mp, void \*const \*obj\_table, unsigned int n)\
 **typedef** int(\* **rte\_mempool\_dequeue\_t**) (struct **rte\_mempool** \*mp, void \*\*obj\_table, unsigned int n)\
 **typedef** int(\* **rte\_mempool\_dequeue\_contig\_blocks\_t**) (struct **rte\_mempool** \*mp, void \*\*first\_obj\_table, unsigned int n)\
 **typedef** unsigned(\* **rte\_mempool\_get\_count**) (const struct **rte\_mempool** \*mp)\
 **typedef** ssize\_t(\* **rte\_mempool\_calc\_mem\_size\_t**) (const struct **rte\_mempool** \*mp, uint32\_t obj\_num, uint32\_t pg\_shift, size\_t \*min\_chunk\_size, size\_t \*align)\
 **typedef** void() **rte\_mempool\_populate\_obj\_cb\_t**(struct **rte\_mempool** \*mp, void \*opaque, void \*vaddr, **rte\_iova\_t** iova)\
 **typedef** int(\* **rte\_mempool\_populate\_t**) (struct **rte\_mempool** \*mp, unsigned int max\_objs, void \*vaddr, **rte\_iova\_t** iova, size\_t len, **rte\_mempool\_populate\_obj\_cb\_t** \*obj\_cb, void \*obj\_cb\_arg)\
 **typedef** int(\* **rte\_mempool\_get\_info\_t**) (const struct **rte\_mempool** \*mp, struct **rte\_mempool\_info** \*info)\
 **typedef** void() **rte\_mempool\_obj\_cb\_t**(struct **rte\_mempool** \*mp, void \*opaque, void \*obj, unsigned obj\_idx)\
 **typedef** void() **rte\_mempool\_mem\_cb\_t**(struct **rte\_mempool** \*mp, void \*opaque, struct **rte\_mempool\_memhdr** \*memhdr, unsigned mem\_idx)\
 **typedef** void() **rte\_mempool\_ctor\_t**(struct **rte\_mempool** \*, void \*)\

### Enumerations

enum **rte\_mempool\_event** { **RTE\_MEMPOOL\_EVENT\_READY** = 0, **RTE\_MEMPOOL\_EVENT\_DESTROY** = 1 }\

### Functions

**RTE\_STAILQ\_HEAD** (rte\_mempool\_objhdr\_list, **rte\_mempool\_objhdr**)\
 **RTE\_STAILQ\_HEAD** (rte\_mempool\_memhdr\_list, **rte\_mempool\_memhdr**)\
 static struct **rte\_mempool** \* **rte\_mempool\_from\_obj** (void \*obj)\
 ssize\_t **rte\_mempool\_op\_calc\_mem\_size\_default** (const struct **rte\_mempool** \*mp, uint32\_t obj\_num, uint32\_t pg\_shift, size\_t \*min\_chunk\_size, size\_t \*align)\
 int **rte\_mempool\_op\_populate\_default** (struct **rte\_mempool** \*mp, unsigned int max\_objs, void \*vaddr, **rte\_iova\_t** iova, size\_t len, **rte\_mempool\_populate\_obj\_cb\_t** \*obj\_cb, void \*obj\_cb\_arg)\
 int **rte\_mempool\_ops\_get\_info** (const struct **rte\_mempool** \*mp, struct **rte\_mempool\_info** \*info)\
 int **rte\_mempool\_set\_ops\_byname** (struct **rte\_mempool** \*mp, const char \*name, void \*pool\_config)\
 int **rte\_mempool\_register\_ops** (const struct **rte\_mempool\_ops** \*ops)\
 struct **rte\_mempool** \* **rte\_mempool\_create** (const char \*name, unsigned n, unsigned elt\_size, unsigned cache\_size, unsigned private\_data\_size, **rte\_mempool\_ctor\_t** \*mp\_init, void \*mp\_init\_arg, **rte\_mempool\_obj\_cb\_t** \*obj\_init, void \*obj\_init\_arg, int socket\_id, unsigned flags)\
 struct **rte\_mempool** \* **rte\_mempool\_create\_empty** (const char \*name, unsigned n, unsigned elt\_size, unsigned cache\_size, unsigned private\_data\_size, int socket\_id, unsigned flags)\
 void **rte\_mempool\_free** (struct **rte\_mempool** \*mp)\
 int **rte\_mempool\_populate\_iova** (struct **rte\_mempool** \*mp, char \*vaddr, **rte\_iova\_t** iova, size\_t len, **rte\_mempool\_memchunk\_free\_cb\_t** \*free\_cb, void \*opaque)\
 int **rte\_mempool\_populate\_virt** (struct **rte\_mempool** \*mp, char \*addr, size\_t len, size\_t pg\_sz, **rte\_mempool\_memchunk\_free\_cb\_t** \*free\_cb, void \*opaque)\
 int **rte\_mempool\_populate\_default** (struct **rte\_mempool** \*mp)\
 int **rte\_mempool\_populate\_anon** (struct **rte\_mempool** \*mp)\
 uint32\_t **rte\_mempool\_obj\_iter** (struct **rte\_mempool** \*mp, **rte\_mempool\_obj\_cb\_t** \*obj\_cb, void \*obj\_cb\_arg)\
 uint32\_t **rte\_mempool\_mem\_iter** (struct **rte\_mempool** \*mp, **rte\_mempool\_mem\_cb\_t** \*mem\_cb, void \*mem\_cb\_arg)\
 void **rte\_mempool\_dump** (FILE \*f, struct **rte\_mempool** \*mp)\
 struct **rte\_mempool\_cache** \* **rte\_mempool\_cache\_create** (uint32\_t size, int socket\_id)\
 void **rte\_mempool\_cache\_free** (struct **rte\_mempool\_cache** \*cache)\
 static **\_\_rte\_always\_inline** struct **rte\_mempool\_cache** \* **rte\_mempool\_default\_cache** (struct **rte\_mempool** \*mp, unsigned lcore\_id)\
 static **\_\_rte\_always\_inline** void **rte\_mempool\_cache\_flush** (struct **rte\_mempool\_cache** \*cache, struct **rte\_mempool** \*mp)\
 static **\_\_rte\_always\_inline** void **rte\_mempool\_generic\_put** (struct **rte\_mempool** \*mp, void \*const \*obj\_table, unsigned int n, struct **rte\_mempool\_cache** \*cache)\
 static **\_\_rte\_always\_inline** void **rte\_mempool\_put\_bulk** (struct **rte\_mempool** \*mp, void \*const \*obj\_table, unsigned int n)\
 static **\_\_rte\_always\_inline** void **rte\_mempool\_put** (struct **rte\_mempool** \*mp, void \*obj)\
 static **\_\_rte\_always\_inline** int **rte\_mempool\_generic\_get** (struct **rte\_mempool** \*mp, void \*\*obj\_table, unsigned int n, struct **rte\_mempool\_cache** \*cache)\
 static **\_\_rte\_always\_inline** int **rte\_mempool\_get\_bulk** (struct **rte\_mempool** \*mp, void \*\*obj\_table, unsigned int n)\
 static **\_\_rte\_always\_inline** int **rte\_mempool\_get** (struct **rte\_mempool** \*mp, void \*\*obj\_p)\
 static **\_\_rte\_always\_inline** int **rte\_mempool\_get\_contig\_blocks** (struct **rte\_mempool** \*mp, void \*\*first\_obj\_table, unsigned int n)\
 unsigned int **rte\_mempool\_avail\_count** (const struct **rte\_mempool** \*mp)\
 unsigned int **rte\_mempool\_in\_use\_count** (const struct **rte\_mempool** \*mp)\
 static int **rte\_mempool\_full** (const struct **rte\_mempool** \*mp)\
 static int **rte\_mempool\_empty** (const struct **rte\_mempool** \*mp)\
 static **rte\_iova\_t** **rte\_mempool\_virt2iova** (const void \*elt)\
 void **rte\_mempool\_audit** (struct **rte\_mempool** \*mp)\
 static void \* **rte\_mempool\_get\_priv** (struct **rte\_mempool** \*mp)\
 void **rte\_mempool\_list\_dump** (FILE \*f)\
 struct **rte\_mempool** \* **rte\_mempool\_lookup** (const char \*name)\
 uint32\_t **rte\_mempool\_calc\_obj\_size** (uint32\_t elt\_size, uint32\_t flags, struct **rte\_mempool\_objsz** \*sz)\
 void **rte\_mempool\_walk** (void(\*func)(struct **rte\_mempool** \*, void \*arg), void \*arg)\
 \_\_rte\_experimental int **rte\_mempool\_get\_mem\_range** (const struct **rte\_mempool** \*mp, struct **rte\_mempool\_mem\_range\_info** \*mem\_range)\
 \_\_rte\_experimental size\_t **rte\_mempool\_get\_obj\_alignment** (const struct **rte\_mempool** \*mp)\

### Variables

struct **rte\_mempool\_ops\_table** **rte\_mempool\_ops\_table**\

## Detailed Description

RTE Mempool.

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.

Objects owned by a mempool should never be added in another mempool. When an object is freed using **rte\_mempool\_put()** 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.

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 **rte\_mempool\_get()** or **rte\_mempool\_put()** are designed to be called from an EAL thread due to the internal per-lcore cache. Due to the lack of caching, **rte\_mempool\_get()** or **rte\_mempool\_put()** performance will suffer when called by unregistered non-EAL threads. Instead, unregistered non-EAL threads should call **rte\_mempool\_generic\_get()** or **rte\_mempool\_generic\_put()** with a user cache created with **rte\_mempool\_cache\_create()**.

Definition in file **rte\_mempool.h**.

## Macro Definition Documentation

### #define RTE\_MEMPOOL\_HEADER\_COOKIE1 0xbadbadbadadd2e55ULL

Header cookie.

Definition at line **59** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_HEADER\_COOKIE2 0xf2eef2eedadd2e55ULL

Header cookie.

Definition at line **60** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_TRAILER\_COOKIE 0xadd2e55badbadbadULL

Trailer cookie.

Definition at line **61** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_ALIGN RTE\_CACHE\_LINE\_SIZE

Alignment of elements inside mempool.

Definition at line **139** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_F\_NO\_SPREAD 0x0001

Spreading among memory channels not required.

Definition at line **275** of file **rte\_mempool.h**.

### #define MEMPOOL\_F\_NO\_SPREAD RTE\_MEMPOOL\_F\_NO\_SPREAD

Backward compatibility synonym for RTE\_MEMPOOL\_F\_NO\_SPREAD. To be deprecated.

Definition at line **280** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_F\_NO\_CACHE\_ALIGN 0x0002

Do not align objects on cache lines.

Definition at line **282** of file **rte\_mempool.h**.

### #define MEMPOOL\_F\_NO\_CACHE\_ALIGN RTE\_MEMPOOL\_F\_NO\_CACHE\_ALIGN

Backward compatibility synonym for RTE\_MEMPOOL\_F\_NO\_CACHE\_ALIGN. To be deprecated.

Definition at line **287** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_F\_SP\_PUT 0x0004

Default put is 'single-producer'.

Definition at line **289** of file **rte\_mempool.h**.

### #define MEMPOOL\_F\_SP\_PUT RTE\_MEMPOOL\_F\_SP\_PUT

Backward compatibility synonym for RTE\_MEMPOOL\_F\_SP\_PUT. To be deprecated.

Definition at line **294** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_F\_SC\_GET 0x0008

Default get is 'single-consumer'.

Definition at line **296** of file **rte\_mempool.h**.

### #define MEMPOOL\_F\_SC\_GET RTE\_MEMPOOL\_F\_SC\_GET

Backward compatibility synonym for RTE\_MEMPOOL\_F\_SC\_GET. To be deprecated.

Definition at line **301** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_F\_POOL\_CREATED 0x0010

Internal: pool is created.

Definition at line **303** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_F\_NO\_IOVA\_CONTIG 0x0020

Don't need IOVA contiguous objects.

Definition at line **305** of file **rte\_mempool.h**.

### #define MEMPOOL\_F\_NO\_IOVA\_CONTIG RTE\_MEMPOOL\_F\_NO\_IOVA\_CONTIG

Backward compatibility synonym for RTE\_MEMPOOL\_F\_NO\_IOVA\_CONTIG. To be deprecated.

Definition at line **310** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_F\_NON\_IO 0x0040

Internal: no object from the pool can be used for device IO (DMA).

Definition at line **312** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_VALID\_USER\_FLAGS

**Value:**.PP

```
    (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 \
    )
```

This macro lists all the mempool flags an application may request.

Definition at line **317** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_OPS\_NAMESIZE 32

Max length of ops struct name.

Definition at line **458** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_POPULATE\_F\_ALIGN\_OBJ 0x0001

Align objects on addresses multiple of total\_elt\_sz.

Definition at line **634** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_MAX\_OPS\_IDX 16

Max registered ops structs

Definition at line **719** of file **rte\_mempool.h**.

### #define RTE\_MEMPOOL\_REGISTER\_OPS(ops)

**Value:**.PP

```
    RTE_INIT(mp_hdlr_init_##ops)                \
    {                           \
        rte_mempool_register_ops(&ops);         \
    }
```

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.

Definition at line **983** of file **rte\_mempool.h**.

## Typedef Documentation

### typedef void() rte\_mempool\_memchunk\_free\_cb\_t(struct rte\_mempool\_memhdr \*memhdr, void \*opaque)

Callback used to free a memory chunk

Definition at line **197** of file **rte\_mempool.h**.

### typedef int(\* rte\_mempool\_alloc\_t) (struct rte\_mempool \*mp)

Prototype for implementation specific data provisioning function.

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 **rte\_ring** 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.

Definition at line **470** of file **rte\_mempool.h**.

### typedef void(\* rte\_mempool\_free\_t) (struct rte\_mempool \*mp)

Free the opaque private data pointed to by mp-\>pool\_data pointer.

Definition at line **475** of file **rte\_mempool.h**.

### typedef int(\* rte\_mempool\_enqueue\_t) (struct rte\_mempool \*mp, void \*const \*obj\_table, unsigned int n)

Enqueue 'n' objects into the external pool.

**Returns**

- •

  0: Success

- •

  \<0: Error

Definition at line **483** of file **rte\_mempool.h**.

### typedef int(\* rte\_mempool\_dequeue\_t) (struct rte\_mempool \*mp, void \*\*obj\_table, unsigned int n)

Dequeue 'n' objects from the external pool.

**Returns**

- •

  0: Success

- •

  \<0: Error

Definition at line **492** of file **rte\_mempool.h**.

### typedef int(\* rte\_mempool\_dequeue\_contig\_blocks\_t) (struct rte\_mempool \*mp, void \*\*first\_obj\_table, unsigned int n)

Dequeue a number of contiguous object blocks from the external pool.

Definition at line **498** of file **rte\_mempool.h**.

### typedef unsigned(\* rte\_mempool\_get\_count) (const struct rte\_mempool \*mp)

Return the number of available objects in the external pool.

Definition at line **504** of file **rte\_mempool.h**.

### typedef ssize\_t(\* rte\_mempool\_calc\_mem\_size\_t) (const struct rte\_mempool \*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.

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.

**Parameters**

*mp* Pointer to the memory pool. \
 *obj\_num* Number of objects. \
 *pg\_shift* LOG2 of the physical pages size. If set to 0, ignore page boundaries. \
 *min\_chunk\_size* Location for minimum size of the memory chunk which may be used to store memory pool objects. \
 *align* Location for required memory chunk alignment.

**Returns**

Required memory size.

Definition at line **529** of file **rte\_mempool.h**.

### typedef void() rte\_mempool\_populate\_obj\_cb\_t(struct rte\_mempool \*mp, void \*opaque, void \*vaddr, rte\_iova\_t iova)

Function to be called for each populated object.

**Parameters**

*mp* A pointer to the mempool structure. \
 *opaque* An opaque pointer passed to iterator. \
 *vaddr* Object virtual address. \
 *iova* Input/output virtual address of the object or RTE\_BAD\_IOVA.

Definition at line **595** of file **rte\_mempool.h**.

### typedef int(\* rte\_mempool\_populate\_t) (struct rte\_mempool \*mp, unsigned int max\_objs, void \*vaddr, rte\_iova\_t iova, size\_t len, rte\_mempool\_populate\_obj\_cb\_t \*obj\_cb, void \*obj\_cb\_arg)

Populate memory pool objects using provided memory chunk.

Populated objects should be enqueued to the pool, e.g. using rte\_mempool\_ops\_enqueue\_bulk().

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.

**Parameters**

*mp* A pointer to the mempool structure. \
 *max\_objs* Maximum number of objects to be populated. \
 *vaddr* The virtual address of memory that should be used to store objects. \
 *iova* The IO address \
 *len* The length of memory in bytes. \
 *obj\_cb* Callback function to be executed for each populated object. \
 *obj\_cb\_arg* An opaque pointer passed to the callback function.

**Returns**

The number of objects added on success. On error, no objects are populated and a negative errno is returned.

Definition at line **626** of file **rte\_mempool.h**.

### typedef int(\* rte\_mempool\_get\_info\_t) (const struct rte\_mempool \*mp, struct rte\_mempool\_info \*info)

Get some additional information about a mempool.

Definition at line **687** of file **rte\_mempool.h**.

### typedef void() rte\_mempool\_obj\_cb\_t(struct rte\_mempool \*mp, void \*opaque, void \*obj, unsigned obj\_idx)

An object callback function for mempool.

Used by **rte\_mempool\_create()** and **rte\_mempool\_obj\_iter()**.

Definition at line **994** of file **rte\_mempool.h**.

### typedef void() rte\_mempool\_mem\_cb\_t(struct rte\_mempool \*mp, void \*opaque, struct rte\_mempool\_memhdr \*memhdr, unsigned mem\_idx)

A memory callback function for mempool.

Used by **rte\_mempool\_mem\_iter()**.

Definition at line **1003** of file **rte\_mempool.h**.

### typedef void() rte\_mempool\_ctor\_t(struct rte\_mempool \*, void \*)

A mempool constructor callback function.

Arguments are the mempool and the opaque pointer given by the user in **rte\_mempool\_create()**.

Definition at line **1013** of file **rte\_mempool.h**.

## Enumeration Type Documentation

### enum rte\_mempool\_event

Mempool event type.

**Enumerator**

- *RTE\_MEMPOOL\_EVENT\_READY*

  *Occurs after a mempool is fully populated.*

- *RTE\_MEMPOOL\_EVENT\_DESTROY*

  *Occurs before the destruction of a mempool begins.*

*Definition at line* **1979** *of file* **rte\_mempool.h***.*

## Function Documentation

### RTE\_STAILQ\_HEAD (rte\_mempool\_objhdr\_list, rte\_mempool\_objhdr)

*A list of object headers type*

### RTE\_STAILQ\_HEAD (rte\_mempool\_memhdr\_list, rte\_mempool\_memhdr)

*A list of memory where objects are stored*

### static struct rte\_mempool \* rte\_mempool\_from\_obj (void \* obj)` [inline]`, ` [static]`

*Return a pointer to the mempool owning this object.*

**Parameters**

*obj An object that is owned by a pool. If this is not the case, the behavior is undefined.*

**Returns**

*A pointer to the mempool structure.*

*Definition at line* **392** *of file* **rte\_mempool.h***.*

### ssize\_t rte\_mempool\_op\_calc\_mem\_size\_default (const struct rte\_mempool \* 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.*

*Equivalent to rte\_mempool\_op\_calc\_mem\_size\_helper(mp, obj\_num, pg\_shift,* *0, min\_chunk\_size, align).*

### int rte\_mempool\_op\_populate\_default (struct rte\_mempool \* mp, unsigned int max\_objs, void \* vaddr, rte\_iova\_t iova, size\_t len, rte\_mempool\_populate\_obj\_cb\_t \* obj\_cb, void \* obj\_cb\_arg)

*Default way to populate memory pool object using provided memory chunk.*

*Equivalent to rte\_mempool\_op\_populate\_helper(mp, 0, max\_objs, vaddr, iova,* *len, obj\_cb, obj\_cb\_arg).*

### int rte\_mempool\_ops\_get\_info (const struct rte\_mempool \* mp, struct rte\_mempool\_info \* info)

*Wrapper for mempool\_ops get\_info callback.*

**Parameters**

*mp Pointer to the memory pool.* \
 *info Pointer to the* **rte\_mempool\_info** *structure*

**Returns**

- •

  *0: Success; The mempool driver supports retrieving supplementary mempool information*

- •

  *-ENOTSUP - doesn't support get\_info ops (valid case).*

### int rte\_mempool\_set\_ops\_byname (struct rte\_mempool \* mp, const char \* name, void \* pool\_config)

*Set the ops of a mempool.*

*This can only be done on a mempool that is not populated, i.e. just after a call to* **rte\_mempool\_create\_empty()***.*

**Parameters**

*mp Pointer to the memory pool.* \
 *name Name of the ops structure to use for this mempool.* \
 *pool\_config Opaque data that can be passed by the application to the ops functions.*

**Returns**

- •

  *0: Success; the mempool is now using the requested ops functions.*

- •

  *-EINVAL - Invalid ops struct name provided.*

- •

  *-EEXIST - mempool already has an ops struct assigned.*

### int rte\_mempool\_register\_ops (const struct rte\_mempool\_ops \* ops)

*Register mempool operations.*

**Parameters**

*ops Pointer to an ops structure to register.*

**Returns**

- •

  *\>=0: Success; return the index of the ops struct in the table.*

- •

  *-EINVAL - some missing callbacks while registering ops struct.*

- •

  *-ENOSPC - the maximum number of ops structs has been reached.*

### struct rte\_mempool \* rte\_mempool\_create (const char \* name, unsigned n, unsigned elt\_size, unsigned cache\_size, unsigned private\_data\_size, rte\_mempool\_ctor\_t \* mp\_init, void \* mp\_init\_arg, rte\_mempool\_obj\_cb\_t \* obj\_init, void \* obj\_init\_arg, int socket\_id, unsigned flags)

*Create a new mempool named name in memory.*

*This function uses* **rte\_memzone\_reserve() to allocate memory. The pool contains n elements of elt\_size. Its size is set to n.**

**Parameters**

*name* **The name of the mempool.** \
 *n* **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).** \
 *elt\_size* **The size of each element.** \
 *cache\_size* **If cache\_size is non-zero, the rte\_mempool 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.** \
 *private\_data\_size* **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.** \
 *mp\_init* **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.** \
 *mp\_init\_arg* **An opaque pointer to data that can be used in the mempool constructor function.** \
 *obj\_init* **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.** \
 *obj\_init\_arg* **An opaque pointer to data that can be used as an argument for each call to the object constructor function.** \
 *socket\_id* **The** *socket\_id* **argument is 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.** \
 *flags* **The** *flags* **arguments is an OR of following flags:**

- •

  **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.**

- •

  **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.**

- •

  **RTE\_MEMPOOL\_F\_SP\_PUT: If this flag is set, the default behavior when using rte\_mempool\_put() or rte\_mempool\_put\_bulk() is 'single-producer'. Otherwise, it is 'multi-producers'.**

- •

  **RTE\_MEMPOOL\_F\_SC\_GET: If this flag is set, the default behavior when using rte\_mempool\_get() or rte\_mempool\_get\_bulk() is 'single-consumer'. Otherwise, it is 'multi-consumers'.**

- •

  **RTE\_MEMPOOL\_F\_NO\_IOVA\_CONTIG: If set, allocated objects won't necessarily be contiguous in IO memory.**

**Returns**

**The pointer to the new allocated mempool, on success. NULL on error with rte\_errno set appropriately. Possible rte\_errno values include:**

- •

  **E\_RTE\_NO\_CONFIG - function could not get pointer to rte\_config structure**

- •

  **EINVAL - cache size provided is too large or an unknown flag was passed**

- •

  **ENOSPC - the maximum number of memzones has already been allocated**

- •

  **EEXIST - a memzone with the same name already exists**

- •

  **ENOMEM - no appropriate memory area found in which to create memzone**

### struct rte\_mempool \* rte\_mempool\_create\_empty (const char \* name, unsigned n, unsigned elt\_size, unsigned cache\_size, unsigned private\_data\_size, int socket\_id, unsigned flags)

**Create an empty mempool**

**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 rte\_mempool\_obj\_iter().**

**Parameters**

*name* **The name of the mempool.** \
 *n* **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).** \
 *elt\_size* **The size of each element.** \
 *cache\_size* **Size of the cache. See rte\_mempool\_create() for details.** \
 *private\_data\_size* **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.** \
 *socket\_id* **The** *socket\_id* **argument is 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.** \
 *flags* **Flags controlling the behavior of the mempool. See rte\_mempool\_create() for details.**

**Returns**

**The pointer to the new allocated mempool, on success. NULL on error with rte\_errno set appropriately. See rte\_mempool\_create() for details.**

### void rte\_mempool\_free (struct rte\_mempool \* mp)

**Free a mempool**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure. If NULL then, the function does nothing.**

### int rte\_mempool\_populate\_iova (struct rte\_mempool \* mp, char \* vaddr, rte\_iova\_t iova, size\_t len, rte\_mempool\_memchunk\_free\_cb\_t \* free\_cb, void \* opaque)

**Add physically contiguous memory for objects in the pool at init**

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

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *vaddr* **The virtual address of memory that should be used to store objects.** \
 *iova* **The IO address** \
 *len* **The length of memory in bytes.** \
 *free\_cb* **The callback used to free this chunk when destroying the mempool.** \
 *opaque* **An opaque argument passed to free\_cb.**

**Returns**

**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.**

### int rte\_mempool\_populate\_virt (struct rte\_mempool \* mp, char \* addr, size\_t len, size\_t pg\_sz, rte\_mempool\_memchunk\_free\_cb\_t \* free\_cb, void \* opaque)

**Add virtually contiguous memory for objects in the pool at init**

**Add a virtually contiguous memory chunk in the pool where objects can be instantiated.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *addr* **The virtual address of memory that should be used to store objects.** \
 *len* **The length of memory in bytes.** \
 *pg\_sz* **The size of memory pages in this virtual area.** \
 *free\_cb* **The callback used to free this chunk when destroying the mempool.** \
 *opaque* **An opaque argument passed to free\_cb.**

**Returns**

**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.**

### int rte\_mempool\_populate\_default (struct rte\_mempool \* mp)

**Add memory for objects in the pool at init**

**This is the default function used by rte\_mempool\_create() to populate the mempool. It adds memory allocated using rte\_memzone\_reserve().**

**Parameters**

*mp* **A pointer to the mempool structure.**

**Returns**

**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.**

### int rte\_mempool\_populate\_anon (struct rte\_mempool \* mp)

**Add memory from anonymous mapping for objects in the pool at init**

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

**Parameters**

*mp* **A pointer to the mempool structure.**

**Returns**

**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.**

### uint32\_t rte\_mempool\_obj\_iter (struct rte\_mempool \* mp, rte\_mempool\_obj\_cb\_t \* obj\_cb, void \* obj\_cb\_arg)

**Call a function for each mempool element**

**Iterate across all objects attached to a rte\_mempool and call the callback function on it.**

**Parameters**

*mp* **A pointer to an initialized mempool.** \
 *obj\_cb* **A function pointer that is called for each object.** \
 *obj\_cb\_arg* **An opaque pointer passed to the callback function.**

**Returns**

**Number of objects iterated.**

### uint32\_t rte\_mempool\_mem\_iter (struct rte\_mempool \* mp, rte\_mempool\_mem\_cb\_t \* mem\_cb, void \* mem\_cb\_arg)

**Call a function for each mempool memory chunk**

**Iterate across all memory chunks attached to a rte\_mempool and call the callback function on it.**

**Parameters**

*mp* **A pointer to an initialized mempool.** \
 *mem\_cb* **A function pointer that is called for each memory chunk.** \
 *mem\_cb\_arg* **An opaque pointer passed to the callback function.**

**Returns**

**Number of memory chunks iterated.**

### void rte\_mempool\_dump (FILE \* f, struct rte\_mempool \* mp)

**Dump the status of the mempool to a file.**

**Parameters**

*f* **A pointer to a file for output** \
 *mp* **A pointer to the mempool structure.**

### struct rte\_mempool\_cache \* rte\_mempool\_cache\_create (uint32\_t size, int socket\_id)

**Create a user-owned mempool cache.**

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

**Parameters**

*size* **The size of the mempool cache. See rte\_mempool\_create()'s cache\_size parameter description for more information. The same limits and considerations apply here too.** \
 *socket\_id* **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.**

### void rte\_mempool\_cache\_free (struct rte\_mempool\_cache \* cache)

**Free a user-owned mempool cache.**

**Parameters**

*cache* **A pointer to the mempool cache.**

### static \_\_rte\_always\_inline struct rte\_mempool\_cache \* rte\_mempool\_default\_cache (struct rte\_mempool \* mp, unsigned lcore\_id)` [static]`

**Get a pointer to the per-lcore default mempool cache.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *lcore\_id* **The logical core id.**

**Returns**

**A pointer to the mempool cache or NULL if disabled or unregistered non-EAL thread.**

**Definition at line 1331 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline void rte\_mempool\_cache\_flush (struct rte\_mempool\_cache \* cache, struct rte\_mempool \* mp)` [static]`

**Flush a user-owned mempool cache to the specified mempool.**

**Parameters**

*cache* **A pointer to the mempool cache.** \
 *mp* **A pointer to the mempool.**

**Definition at line 1353 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline void rte\_mempool\_generic\_put (struct rte\_mempool \* mp, void \*const \* obj\_table, unsigned int n, struct rte\_mempool\_cache \* cache)` [static]`

**Put several objects back in the mempool.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *obj\_table* **A pointer to a table of void \* pointers (objects).** \
 *n* **The number of objects to add in the mempool from the obj\_table.** \
 *cache* **A pointer to a mempool cache structure. May be NULL if not needed.**

**Definition at line 1442 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline void rte\_mempool\_put\_bulk (struct rte\_mempool \* mp, void \*const \* obj\_table, unsigned int n)` [static]`

**Put several objects back in the mempool.**

**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).**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *obj\_table* **A pointer to a table of void \* pointers (objects).** \
 *n* **The number of objects to add in the mempool from obj\_table.**

**Definition at line 1465 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline void rte\_mempool\_put (struct rte\_mempool \* mp, void \* obj)` [static]`

**Put one object back in the mempool.**

**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).**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *obj* **A pointer to the object to be added.**

**Definition at line 1487 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline int rte\_mempool\_generic\_get (struct rte\_mempool \* mp, void \*\* obj\_table, unsigned int n, struct rte\_mempool\_cache \* cache)` [static]`

**Get several objects from the mempool.**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *obj\_table* **A pointer to a table of void \* pointers (objects) that will be filled.** \
 *n* **The number of objects to get from mempool to obj\_table.** \
 *cache* **A pointer to a mempool cache structure. May be NULL if not needed.**

**Returns**

- •

  **0: Success; objects taken.**

- •

  **-ENOENT: Not enough entries in the mempool; no object is retrieved.**

**Definition at line 1645 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline int rte\_mempool\_get\_bulk (struct rte\_mempool \* mp, void \*\* obj\_table, unsigned int n)` [static]`

**Get several objects from the mempool.**

**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).**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *obj\_table* **A pointer to a table of void \* pointers (objects) that will be filled.** \
 *n* **The number of objects to get from the mempool to obj\_table.**

**Returns**

- •

  **0: Success; objects taken**

- •

  **-ENOENT: Not enough entries in the mempool; no object is retrieved.**

**Definition at line 1679 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline int rte\_mempool\_get (struct rte\_mempool \* mp, void \*\* obj\_p)` [static]`

**Get one object from the mempool.**

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

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *obj\_p* **A pointer to a void \* pointer (object) that will be filled.**

**Returns**

- •

  **0: Success; objects taken.**

- •

  **-ENOENT: Not enough entries in the mempool; no object is retrieved.**

**Definition at line 1708 of file rte\_mempool.h.**

### static \_\_rte\_always\_inline int rte\_mempool\_get\_contig\_blocks (struct rte\_mempool \* mp, void \*\* first\_obj\_table, unsigned int n)` [static]`

**Get a contiguous blocks of objects from the mempool.**

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

**The application should check that the driver supports the operation by calling rte\_mempool\_ops\_get\_info() and checking that** `contig_block_size` **is not zero.**

**Parameters**

*mp* **A pointer to the mempool structure.** \
 *first\_obj\_table* **A pointer to a pointer to the first object in each block.** \
 *n* **The number of blocks to get from mempool.**

**Returns**

- •

  **0: Success; blocks taken.**

- •

  **-ENOBUFS: Not enough entries in the mempool; no object is retrieved.**

- •

  **-EOPNOTSUPP: The mempool driver does not support block dequeue**

**Definition at line 1735 of file rte\_mempool.h.**

### unsigned int rte\_mempool\_avail\_count (const struct rte\_mempool \* mp)

**Return the number of entries in the mempool.**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.**

**Returns**

**The number of entries in the mempool.**

### unsigned int rte\_mempool\_in\_use\_count (const struct rte\_mempool \* mp)

**Return the number of elements which have been allocated from the mempool**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.**

**Returns**

**The number of free entries in the mempool.**

### static int rte\_mempool\_full (const struct rte\_mempool \* mp)` [inline]`, ` [static]`

**Test if the mempool is full.**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.**

**Returns**

- •

  **1: The mempool is full.**

- •

  **0: The mempool is not full.**

**Definition at line 1798 of file rte\_mempool.h.**

### static int rte\_mempool\_empty (const struct rte\_mempool \* mp)` [inline]`, ` [static]`

**Test if the mempool is empty.**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.**

**Returns**

- •

  **1: The mempool is empty.**

- •

  **0: The mempool is not empty.**

**Definition at line 1817 of file rte\_mempool.h.**

### static rte\_iova\_t rte\_mempool\_virt2iova (const void \* elt)` [inline]`, ` [static]`

**Return the IO address of elt, which is an element of the pool mp.**

**Parameters**

*elt* **A pointer (virtual address) to the element of the pool.**

**Returns**

**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.**

**Definition at line 1833 of file rte\_mempool.h.**

### void rte\_mempool\_audit (struct rte\_mempool \* mp)

**Check the consistency of mempool objects.**

**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.**

**Parameters**

*mp* **A pointer to the mempool structure.**

### static void \* rte\_mempool\_get\_priv (struct rte\_mempool \* mp)` [inline]`, ` [static]`

**Return a pointer to the private data in an mempool structure.**

**Parameters**

*mp* **A pointer to the mempool structure.**

**Returns**

**A pointer to the private data.**

**Definition at line 1861 of file rte\_mempool.h.**

### void rte\_mempool\_list\_dump (FILE \* f)

**Dump the status of all mempools on the console**

**Parameters**

*f* **A pointer to a file for output**

### struct rte\_mempool \* rte\_mempool\_lookup (const char \* name)

**Search a mempool from its name**

**Parameters**

*name* **The name of the mempool.**

**Returns**

**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:**

- •

  **ENOENT - required entry not available to return.**

### uint32\_t rte\_mempool\_calc\_obj\_size (uint32\_t elt\_size, uint32\_t flags, struct rte\_mempool\_objsz \* sz)

**Get the header, trailer and total size of a mempool element.**

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

**Parameters**

*elt\_size* **The size of each element, without header and trailer.** \
 *flags* **The flags used for the mempool creation. Consult rte\_mempool\_create() for more information about possible values. The size of each element.** \
 *sz* **The calculated detailed size the mempool object. May be NULL.**

**Returns**

**Total size of the mempool object.**

### void rte\_mempool\_walk (void(\*)(struct rte\_mempool \*, void \*arg) func, void \* arg)

**Walk list of all memory pools**

**Parameters**

*func* **Iterator function** \
 *arg* **Argument passed to iterator**

### \_\_rte\_experimental int rte\_mempool\_get\_mem\_range (const struct rte\_mempool \* mp, struct rte\_mempool\_mem\_range\_info \* mem\_range)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Get information about the memory range used to store objects in the mempool.**

**Parameters**

*mp* **Pointer to an initialized mempool.** \
 *mem\_range* **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.**

**Returns**

**0 on success, -EINVAL if mempool is not valid or mem\_range is NULL.**

### \_\_rte\_experimental size\_t rte\_mempool\_get\_obj\_alignment (const struct rte\_mempool \* mp)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Return alignment of objects stored in the mempool.**

**Parameters**

*mp* **Pointer to a mempool.**

**Returns**

**Object alignment if mp is valid. 0 if mp is NULL.**

## Variable Documentation

### struct rte\_mempool\_ops\_table rte\_mempool\_ops\_table` [extern]`

**Array of registered ops structs.**

## Author

**Generated automatically by Doxygen for DPDK from the source code.**
