io_uring: Update to kernel changes in 6.11 and 6.12 #23062
+443
−95
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
io_uring is in active development and each new kernel brings some new features. This is an update to the most important changes from kernels 6.11 and 6.12.
Bind/listen support
IoUring.bind and IoUring.listen functions are added. For listening sockets is it common to set some socket options, so I added generic IoUring.cmd_sock but also posix like IoUring.setsokopt and IoUring.getsockopt.
Probing capabilities
When app has to run on different kernels it is handy to check if some operation is supported on the running kernel.
Example:
Incremental provided buffer consumption
IoUring.BufferGroup will now use incremental consumption whenever kernel supports it.
Before, provided buffers were wholly consumed when picked. Now, each cqe points to a different buffer. With this, cqe points to the part of the buffer. Multiple cqes can reuse the same buffer. Appropriate buffer sizing becomes less important.
There are slight changes in BufferGroup interface (it now needs to track the current receive point for each buffer). Init requires an allocator instead of buffers slice, it will allocate buffers slice and head pointers slice. Get and put now requires cqe because there we have information will the buffer be reused.