Lines Matching full:item

118 static inline bool is_valid(union mpsc_pbuf_generic *item)  in is_valid()  argument
120 return item->hdr.valid; in is_valid()
123 static inline bool is_invalid(union mpsc_pbuf_generic *item) in is_invalid() argument
125 return !item->hdr.valid && !item->hdr.busy; in is_invalid()
140 static inline uint32_t get_skip(union mpsc_pbuf_generic *item) in get_skip() argument
142 if (item->hdr.busy && !item->hdr.valid) { in get_skip()
143 return item->skip.len; in get_skip()
180 union mpsc_pbuf_generic *item; in drop_item_locked() local
183 item = (union mpsc_pbuf_generic *)&buffer->buf[buffer->rd_idx]; in drop_item_locked()
184 skip_wlen = get_skip(item); in drop_item_locked()
202 uint32_t rd_wlen = buffer->get_wlen(item); in drop_item_locked()
205 if (!is_valid(item)) { in drop_item_locked()
207 } else if (item->hdr.busy) { in drop_item_locked()
208 MPSC_PBUF_DBG(buffer, "no space: Found busy packet %p (len:%d)", item, rd_wlen); in drop_item_locked()
252 item->hdr.valid = 0; in drop_item_locked()
253 *item_to_drop = item; in drop_item_locked()
255 item, rd_wlen); in drop_item_locked()
291 const union mpsc_pbuf_generic item) in mpsc_pbuf_put_word() argument
313 buffer->buf[buffer->tmp_wr_idx] = item.raw; in mpsc_pbuf_put_word()
327 /* Notify about item being dropped. */ in mpsc_pbuf_put_word()
339 union mpsc_pbuf_generic *item = NULL; in mpsc_pbuf_alloc() local
366 item = in mpsc_pbuf_alloc()
368 item->hdr.valid = 0; in mpsc_pbuf_alloc()
369 item->hdr.busy = 0; in mpsc_pbuf_alloc()
391 /* Notify about item being dropped. */ in mpsc_pbuf_alloc()
400 MPSC_PBUF_DBG(buffer, "allocated %p", item); in mpsc_pbuf_alloc()
402 if (IS_ENABLED(CONFIG_MPSC_CLEAR_ALLOCATED) && item) { in mpsc_pbuf_alloc()
404 memset(item, 0, sizeof(int) * wlen); in mpsc_pbuf_alloc()
407 return item; in mpsc_pbuf_alloc()
411 union mpsc_pbuf_generic *item) in mpsc_pbuf_commit() argument
413 uint32_t wlen = buffer->get_wlen(item); in mpsc_pbuf_commit()
417 item->hdr.valid = 1; in mpsc_pbuf_commit()
421 MPSC_PBUF_DBG(buffer, "committed %p", item); in mpsc_pbuf_commit()
425 const union mpsc_pbuf_generic item, in mpsc_pbuf_put_word_ext() argument
429 (sizeof(item) + sizeof(data)) / sizeof(uint32_t); in mpsc_pbuf_put_word_ext()
450 buffer->buf[buffer->tmp_wr_idx] = item.raw; in mpsc_pbuf_put_word_ext()
471 /* Notify about item being dropped. */ in mpsc_pbuf_put_word_ext()
521 /* Notify about item being dropped. */ in mpsc_pbuf_put_data()
533 union mpsc_pbuf_generic *item; in mpsc_pbuf_claim() local
543 item = (union mpsc_pbuf_generic *) in mpsc_pbuf_claim()
546 if (!a || is_invalid(item)) { in mpsc_pbuf_claim()
547 MPSC_PBUF_DBG(buffer, "invalid claim %d: %p", a, item); in mpsc_pbuf_claim()
548 item = NULL; in mpsc_pbuf_claim()
550 uint32_t skip = get_skip(item); in mpsc_pbuf_claim()
552 if (skip || !is_valid(item)) { in mpsc_pbuf_claim()
554 skip ? skip : buffer->get_wlen(item); in mpsc_pbuf_claim()
561 item->hdr.busy = 1; in mpsc_pbuf_claim()
564 buffer->get_wlen(item)); in mpsc_pbuf_claim()
569 MPSC_PBUF_DBG(buffer, ">>claimed %d: %p", a, item); in mpsc_pbuf_claim()
574 return item; in mpsc_pbuf_claim()
578 const union mpsc_pbuf_generic *item) in mpsc_pbuf_free() argument
580 uint32_t wlen = buffer->get_wlen(item); in mpsc_pbuf_free()
582 union mpsc_pbuf_generic *witem = (union mpsc_pbuf_generic *)item; in mpsc_pbuf_free()
586 ((uint32_t *)item == &buffer->buf[buffer->rd_idx])) { in mpsc_pbuf_free()
591 * at claimed item. In that case tmp_rd_idx points at in mpsc_pbuf_free()
603 MPSC_PBUF_DBG(buffer, "<<freed: %p", item); in mpsc_pbuf_free()