13#ifndef ZEPHYR_INCLUDE_MPIPE_MPIPE_BUFFER_H_
14#define ZEPHYR_INCLUDE_MPIPE_MPIPE_BUFFER_H_
int mpipe_buffer_pool_start(struct mpipe_buffer_pool *pool)
Start a buffer pool.
int mpipe_buffer_pool_stop(struct mpipe_buffer_pool *pool)
Stop a buffer pool.
int mpipe_buffer_pool_set_req_config(struct mpipe_buffer_pool *pool, const struct mpipe_buffer_pool_config *cfg)
State what a buffer pool requires of its own accord.
static struct mpipe_buffer_meta * mpipe_buffer_get_meta(const struct net_buf *buf)
Get the mpipe metadata carried by a buffer.
Definition mpipe_buffer.h:151
int mpipe_buffer_pool_set_config(struct mpipe_buffer_pool *pool, const struct mpipe_buffer_pool_config *cfg)
Apply a negotiated config to a buffer pool.
void mpipe_buffer_pool_init(struct mpipe_buffer_pool *pool)
Initialize a buffer pool.
int mpipe_buffer_pool_configure(struct mpipe_buffer_pool *pool, const struct mpipe_structure *config)
Configure a buffer pool.
void mpipe_buffer_destroy(struct net_buf *buf)
Destroy callback for net_buf.
static void * net_buf_user_data(const struct net_buf *buf)
Get a pointer to the user data of a buffer.
Definition net_buf.h:1756
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Buffer pool config structure.
Definition mpipe_buffer.h:59
uint32_t size
Size of each buffer in bytes.
Definition mpipe_buffer.h:61
uint16_t align
Alignment of each buffer in bytes.
Definition mpipe_buffer.h:63
uint8_t max_buffers
Maximum number of buffers in the pool.
Definition mpipe_buffer.h:67
uint8_t min_buffers
Minimum number of buffers for the pool to work.
Definition mpipe_buffer.h:65
Buffer pool structure.
Definition mpipe_buffer.h:75
int(* set_config)(struct mpipe_buffer_pool *pool, const struct mpipe_buffer_pool_config *cfg)
Apply a negotiated pool config.
Definition mpipe_buffer.h:102
struct net_buf_pool * nb_pool
net_buf pool associated with the buffer pool
Definition mpipe_buffer.h:91
struct mpipe_buffer_pool_config config
What the negotiation settled on, and what mpipe_buffer_pool::start allocates against.
Definition mpipe_buffer.h:89
struct mpipe_buffer_pool_config req_config
What this pool requires of its own accord, before any negotiation: the owner's hardware minimum,...
Definition mpipe_buffer.h:82
int(* configure)(struct mpipe_buffer_pool *pool, const struct mpipe_structure *config)
Configure the pool with the given caps structure.
Definition mpipe_buffer.h:94
bool started
Flag indicating if the pool has been started.
Definition mpipe_buffer.h:117
int(* stop)(struct mpipe_buffer_pool *pool)
Stop the pool and free resources.
Definition mpipe_buffer.h:107
int(* acquire_buffer)(struct mpipe_buffer_pool *pool, struct net_buf **buf)
Acquire a buffer from the pool.
Definition mpipe_buffer.h:109
int(* release_buffer)(struct mpipe_buffer_pool *pool, struct net_buf *buf)
Release a buffer back to the pool, automatically called when buffer refcount reaches 0.
Definition mpipe_buffer.h:114
int(* start)(struct mpipe_buffer_pool *pool)
Start the pool and allocate resources.
Definition mpipe_buffer.h:105
Fixed-size container holding the fields of one capability.
Definition mpipe_structure.h:179
Network buffer pool representation.
Definition net_buf.h:1190
Network buffer representation.
Definition net_buf.h:1054