Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mpipe_buffer.h
Go to the documentation of this file.
1/*
2 * Copyright 2025-2026 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_MPIPE_MPIPE_BUFFER_H_
14#define ZEPHYR_INCLUDE_MPIPE_MPIPE_BUFFER_H_
15
50
51#include <stdbool.h>
52#include <stdint.h>
53
54#include <zephyr/net_buf.h>
55
69
70struct mpipe_structure;
71
92
94 int (*configure)(struct mpipe_buffer_pool *pool, const struct mpipe_structure *config);
102 int (*set_config)(struct mpipe_buffer_pool *pool,
103 const struct mpipe_buffer_pool_config *cfg);
105 int (*start)(struct mpipe_buffer_pool *pool);
107 int (*stop)(struct mpipe_buffer_pool *pool);
109 int (*acquire_buffer)(struct mpipe_buffer_pool *pool, struct net_buf **buf);
114 int (*release_buffer)(struct mpipe_buffer_pool *pool, struct net_buf *buf);
115
118};
119
140
151static inline struct mpipe_buffer_meta *mpipe_buffer_get_meta(const struct net_buf *buf)
152{
153 return (struct mpipe_buffer_meta *)net_buf_user_data(buf);
154}
155
164
174 const struct mpipe_structure *config);
175
197 const struct mpipe_buffer_pool_config *cfg);
198
219 const struct mpipe_buffer_pool_config *cfg);
220
229
243
250
252
253#endif /* 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
Buffer management.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Common buffer metadata stored in net_buf user_data.
Definition mpipe_buffer.h:123
uint32_t timestamp
Timestamp in milliseconds.
Definition mpipe_buffer.h:134
void * priv
Opaque pointer for plugin-specific usage.
Definition mpipe_buffer.h:138
struct mpipe_buffer_pool * pool
Buffer pool this buffer belongs to.
Definition mpipe_buffer.h:125
uint32_t bytes_used
Valid payload in bytes.
Definition mpipe_buffer.h:132
void * driver_buf
Pointer to the real driver-owned buffer.
Definition mpipe_buffer.h:136
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