Lines Matching refs:packet

12 producer fills the data and commits it. Consuming a packet is also performed in
13 two steps: consumer claims the packet, gets pointer to it and length and later
14 on packet is freed. This approach reduces memory copying.
18 * Allocate, commit scheme used for packet producing.
19 * Claim, free scheme used for packet consuming.
24 be allocated. For each dropped packet user callback is called.
33 Each packet in the buffer contains ``MPSC_PBUF`` specific header which is used
39 * valid - bit set to one when packet contains valid user packet
40 * busy - bit set when packet is being consumed (claimed but not free)
49 | 1 | 0 | valid packet |
51 | 1 | 1 | claimed valid packet |
53 | 0 | 1 | internal skip packet |
65 wrapping of the write index, a skip packet is added to the end of buffer. If
74 header to ensure that currently consumed packet is not overwritten. In that case,
75 skip packet is added before busy packet and packets following the busy packet
76 are dropped. When busy packet is being freed, such situation is detected and
77 packet is converted to skip packet to avoid double processing.
87 are split to avoid include spam when declaring the packet.
104 callbacks. Following callbacks are used by the packet buffer:
106 * Drop notification - callback called whenever a packet is dropped due to
108 * Get packet length - callback to determine packet length
117 foo_packet *packet = mpsc_pbuf_alloc(buffer, len, K_NO_WAIT);
119 fill_data(packet);
121 mpsc_pbuf_commit(buffer, packet);
125 * 32 bit word packet
126 * 32 bit word with pointer packet
143 foo_packet *packet = mpsc_pbuf_claim(buffer);
145 process(packet);
147 mpsc_pbuf_free(buffer, packet);