Lines Matching +full:buffer +full:- +full:size

4  * SPDX-License-Identifier: Apache-2.0
20 * @brief Multi producer, single consumer packet buffer API
21 * @defgroup mpsc_buf MPSC (Multi producer, single consumer) packet buffer API
27 * Multi producer, single consumer packet buffer allows to allocate variable
33 * If buffer is full and packet cannot be allocated then null is returned unless
40 * returns pointer to the packet within the buffer. Packet is freed when no
44 /**@defgroup MPSC_PBUF_FLAGS MPSC packet buffer flags
48 /** @brief Flag indicating that buffer size is power of 2.
50 * When buffer size is power of 2 then optimizations are applied.
54 /** @brief Flag indicating buffer full policy.
56 * If flag is set then when allocating from a full buffer oldest packets are
61 /** @brief Flag indicating that maximum buffer usage is tracked. */
64 /** @brief Flag indicated that buffer is currently full. */
76 * @return Size of the packet in 32 bit words.
82 * @param buffer Packet buffer.
86 typedef void (*mpsc_pbuf_notify_drop)(const struct mpsc_pbuf_buffer *buffer,
89 /** @brief MPSC packet buffer structure. */
118 /* Buffer. */
121 /* Buffer size in 32 bit words. */
122 uint32_t size; member
124 /* Store max buffer usage. */
130 /** @brief MPSC packet buffer configuration. */
135 /* Buffer size in 32 bit words. */
136 uint32_t size; member
146 /** @brief Initialize a packet buffer.
148 * @param buffer Buffer.
152 void mpsc_pbuf_init(struct mpsc_pbuf_buffer *buffer,
157 * If a buffer is configured to overwrite mode then if there is no space to
158 * allocate a new buffer, oldest packets are dropped. Otherwise allocation
161 * @param buffer Buffer.
171 union mpsc_pbuf_generic *mpsc_pbuf_alloc(struct mpsc_pbuf_buffer *buffer,
176 * @param buffer Buffer.
180 void mpsc_pbuf_commit(struct mpsc_pbuf_buffer *buffer,
183 /** @brief Put single word packet into a buffer.
186 * Note that 2 bits of that word is used by the buffer.
188 * @param buffer Buffer.
193 void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer,
199 * Note that 2 bits of a first word is used by the buffer.
201 * @param buffer Buffer.
208 void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
212 /** @brief Put a packet into a buffer.
214 * Copy data into a buffer.
215 * Note that 2 bits of a first word is used by the buffer.
217 * @param buffer Buffer.
221 * @param wlen Packet size in words.
223 void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer,
228 * @param buffer Buffer.
232 const union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer);
236 * @param buffer Buffer.
240 void mpsc_pbuf_free(struct mpsc_pbuf_buffer *buffer,
245 * @param buffer Buffer.
250 bool mpsc_pbuf_is_pending(struct mpsc_pbuf_buffer *buffer);
254 * @param[in, out] buffer Buffer.
255 * @param[out] size Buffer size in bytes.
256 * @param[out] now Current buffer usage in bytes.
258 void mpsc_pbuf_get_utilization(struct mpsc_pbuf_buffer *buffer,
259 uint32_t *size, uint32_t *now);
263 * @param[in, out] buffer Buffer.
264 * @param[out] max Maximum buffer usage in bytes.
267 * retval -ENOTSUP if Collecting utilization data is not supported.
269 int mpsc_pbuf_get_max_utilization(struct mpsc_pbuf_buffer *buffer, uint32_t *max);