Lines Matching refs:pb

127 static void packet_write(struct spsc_pbuf *pb,  in packet_write()  argument
137 rv = spsc_pbuf_alloc(pb, len, &buf); in packet_write()
150 spsc_pbuf_commit(pb, outlen); in packet_write()
156 static void packet_consume(struct spsc_pbuf *pb, in packet_consume() argument
164 rv = spsc_pbuf_claim(pb, &buf); in packet_consume()
175 spsc_pbuf_free(pb, rv); in packet_consume()
183 struct spsc_pbuf *pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST() local
184 uint32_t capacity = spsc_pbuf_capacity(pb); in ZTEST()
189 PACKET_WRITE(pb, 0, 0, 0, -EINVAL); in ZTEST()
190 spsc_pbuf_commit(pb, 0); in ZTEST()
192 PACKET_WRITE(pb, SPSC_PBUF_MAX_LEN, 0, 0, capacity - sizeof(uint32_t)); in ZTEST()
195 PACKET_WRITE(pb, len1, len1, 0, len1); in ZTEST()
200 PACKET_WRITE(pb, len2 + 1, 0, 1, len2); in ZTEST()
202 PACKET_WRITE(pb, len2, len2, 1, len2); in ZTEST()
205 PACKET_CONSUME(pb, len1, 0); in ZTEST()
206 PACKET_CONSUME(pb, len2, 1); in ZTEST()
209 PACKET_CONSUME(pb, 0, 0); in ZTEST()
215 struct spsc_pbuf *pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST() local
216 uint32_t capacity = spsc_pbuf_capacity(pb); in ZTEST()
221 PACKET_WRITE(pb, len1, len1 - 5, 0, len1); in ZTEST()
224 PACKET_WRITE(pb, len2, len2, 1, len2); in ZTEST()
227 PACKET_CONSUME(pb, len1 - 5, 0); in ZTEST()
228 PACKET_CONSUME(pb, len2, 1); in ZTEST()
229 PACKET_CONSUME(pb, 0, 0); in ZTEST()
235 struct spsc_pbuf *pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST() local
236 uint32_t capacity = spsc_pbuf_capacity(pb); in ZTEST()
240 PACKET_WRITE(pb, len1, len1, 0, len1); in ZTEST()
243 PACKET_WRITE(pb, len2, len2, 1, len2); in ZTEST()
246 PACKET_CONSUME(pb, len1, 0); in ZTEST()
249 PACKET_CONSUME(pb, len2, 1); in ZTEST()
252 PACKET_WRITE(pb, len1, 0, 0, len1); in ZTEST()
255 PACKET_CONSUME(pb, 0, 0); in ZTEST()
259 PACKET_WRITE(pb, len2, 0, 0, len2); in ZTEST()
265 struct spsc_pbuf *pb; in ZTEST() local
272 pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST()
273 capacity = spsc_pbuf_capacity(pb); in ZTEST()
277 PACKET_WRITE(pb, len1, len1, 0, len1); in ZTEST()
281 len2 = spsc_pbuf_alloc(pb, len2, &buf); in ZTEST()
287 len = spsc_pbuf_claim(pb, &buf); in ZTEST()
289 spsc_pbuf_free(pb, len); in ZTEST()
291 spsc_pbuf_commit(pb, len2); in ZTEST()
293 len = spsc_pbuf_claim(pb, &buf); in ZTEST()
295 spsc_pbuf_free(pb, len); in ZTEST()
301 struct spsc_pbuf *pb; in ZTEST() local
306 pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST()
307 capacity = spsc_pbuf_capacity(pb); in ZTEST()
311 PACKET_WRITE(pb, len1, len1, 0, len1); in ZTEST()
315 PACKET_WRITE(pb, len2, len2, 1, len2); in ZTEST()
318 PACKET_CONSUME(pb, len1, 0); in ZTEST()
322 PACKET_WRITE(pb, len1, len1, 2, len1); in ZTEST()
325 PACKET_WRITE(pb, 1, 0, 2, 0); in ZTEST()
328 PACKET_CONSUME(pb, len2, 1); in ZTEST()
335 PACKET_WRITE(pb, capacity, 0, 2, exp_len); in ZTEST()
341 struct spsc_pbuf *pb; in ZTEST() local
346 pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST()
347 capacity = spsc_pbuf_capacity(pb); in ZTEST()
350 PACKET_WRITE(pb, len1, len1, 0, len1); in ZTEST()
351 PACKET_CONSUME(pb, len1, 0); in ZTEST()
354 PACKET_WRITE(pb, len2, len2, 1, len2); in ZTEST()
356 PACKET_WRITE(pb, SPSC_PBUF_MAX_LEN, 0, 1, 12); in ZTEST()
358 PACKET_WRITE(pb, SPSC_PBUF_MAX_LEN - 1, 0, 1, 12); in ZTEST()
360 pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST()
361 capacity = spsc_pbuf_capacity(pb); in ZTEST()
364 PACKET_WRITE(pb, len1, len1, 0, len1); in ZTEST()
365 PACKET_CONSUME(pb, len1, 0); in ZTEST()
368 PACKET_WRITE(pb, len2, len2, 1, len2); in ZTEST()
370 PACKET_WRITE(pb, SPSC_PBUF_MAX_LEN - 1, 0, 1, 12); in ZTEST()
376 struct spsc_pbuf *pb; in ZTEST() local
381 pb = spsc_pbuf_init(buffer, sizeof(buffer), 0); in ZTEST()
384 zassert_equal(spsc_pbuf_get_utilization(pb), -ENOTSUP); in ZTEST()
387 capacity = spsc_pbuf_capacity(pb); in ZTEST()
390 PACKET_WRITE(pb, len1, len1, 0, len1); in ZTEST()
391 u = spsc_pbuf_get_utilization(pb); in ZTEST()
394 PACKET_CONSUME(pb, len1, 0); in ZTEST()
395 u = spsc_pbuf_get_utilization(pb); in ZTEST()
399 PACKET_WRITE(pb, len2, len2, 1, len2); in ZTEST()
400 PACKET_CONSUME(pb, len2, 1); in ZTEST()
401 u = spsc_pbuf_get_utilization(pb); in ZTEST()
405 PACKET_WRITE(pb, SPSC_PBUF_MAX_LEN, len3, 2, len3); in ZTEST()
406 PACKET_CONSUME(pb, len3, 2); in ZTEST()
408 u = spsc_pbuf_get_utilization(pb); in ZTEST()