DoxigAlpha

BufferGroup

Group of application provided buffers. Uses newer type, called ring mapped buffers, supported since kernel 5.19. Buffers are identified by a buffer group ID, and within that group, a buffer ID. IO_Uring can have multiple buffer groups, each with unique group ID.

In init application provides contiguous block of memory buffers for buffers_count buffers of size buffers_size. Application can then submit recv operation without providing buffer upfront. Once the operation is ready to receive data, a buffer is picked automatically and the resulting CQE will contain the buffer ID in cqe.buffer_id(). Use get method to get buffer for buffer ID identified by CQE. Once the application has processed the buffer, it may hand ownership back to the kernel, by calling put allowing the cycle to repeat.

Depending on the rate of arrival of data, it is possible that a given buffer group will run out of buffers before those in CQEs can be put back to the kernel. If this happens, a cqe.err() will have ENOBUFS as the error value.

Fields of this type

Fields

#
ring:*IoUring
Parent ring for which this group is registered.
br:*align(page_size_min) linux.io_uring_buf_ring
Pointer to the memory shared by the kernel.
buffers:[]u8
Contiguous block of memory of size (buffers_count * buffer_size).
buffer_size:u32
Size of each buffer in buffers.
buffers_count:u16
Number of buffers in `buffers`, number of `io_uring_buf structures` in br.
heads:[]u32
Head of unconsumed part of each buffer, if incremental consumption is enabled
group_id:u16
ID of this group, must be unique in ring.

Functions in this namespace

Functions

#