Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io_uring: Update to kernel changes in 6.11 and 6.12 #23062

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions lib/std/os/linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5806,6 +5806,9 @@ pub const IORING_OP = enum(u8) {
FUTEX_WAITV,
FIXED_FD_INSTALL,
FTRUNCATE,
BIND,
LISTEN,
RECV_ZC,

_,
};
Expand Down Expand Up @@ -5930,6 +5933,8 @@ pub const IORING_CQE_F_MORE = 1 << 1;
pub const IORING_CQE_F_SOCK_NONEMPTY = 1 << 2;
/// Set for notification CQEs. Can be used to distinct them from sends.
pub const IORING_CQE_F_NOTIF = 1 << 3;
/// If set, the buffer ID set in the completion will get more completions.
pub const IORING_CQE_F_BUF_MORE = 1 << 4;

pub const IORING_CQE_BUFFER_SHIFT = 16;

Expand Down Expand Up @@ -6135,26 +6140,32 @@ pub const IO_URING_OP_SUPPORTED = 1 << 0;

pub const io_uring_probe_op = extern struct {
op: IORING_OP,

resv: u8,

/// IO_URING_OP_* flags
flags: u16,

resv2: u32,

pub fn is_supported(self: @This()) bool {
return self.flags & IO_URING_OP_SUPPORTED != 0;
}
};

pub const io_uring_probe = extern struct {
/// last opcode supported
/// Last opcode supported
last_op: IORING_OP,

/// Number of io_uring_probe_op following
/// Length of ops[] array below
ops_len: u8,

resv: u16,
resv2: [3]u32,

// Followed by up to `ops_len` io_uring_probe_op structures
ops: [256]io_uring_probe_op,

/// Is the operation supported on the running kernel.
pub fn is_supported(self: @This(), op: IORING_OP) bool {
const i = @intFromEnum(op);
if (i > @intFromEnum(self.last_op) or i >= self.ops_len)
return false;
return self.ops[i].is_supported();
}
};

pub const io_uring_restriction = extern struct {
Expand Down Expand Up @@ -6190,6 +6201,13 @@ pub const IORING_RESTRICTION = enum(u16) {
_,
};

pub const IO_URING_SOCKET_OP = enum(u16) {
SIOCIN = 0,
SIOCOUTQ = 1,
GETSOCKOPT = 2,
SETSOCKOPT = 3,
};

pub const io_uring_buf = extern struct {
addr: u64,
len: u32,
Expand All @@ -6209,8 +6227,15 @@ pub const io_uring_buf_reg = extern struct {
ring_addr: u64,
ring_entries: u32,
bgid: u16,
pad: u16,
flags: Flags,
resv: [3]u64,

pub const Flags = packed struct {
_0: u1 = 0,
/// Incremental buffer consumption.
inc: bool,
_: u14 = 0,
};
};

pub const io_uring_getevents_arg = extern struct {
Expand Down
Loading