Skip to content

Commit b030081

Browse files
authored
Update linux-raw-sys to 0.6 (#1061)
* Update linux-raw-sys to 0.6 release * Add tx_metadata_len field to XdpUmemReg This field is introduced in kernel version 6.8.
1 parent 7355af2 commit b030081

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ once_cell = { version = "1.5.2", optional = true }
3636
# libc backend can be selected via adding `--cfg=rustix_use_libc` to
3737
# `RUSTFLAGS` or enabling the `use-libc` cargo feature.
3838
[target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", any(target_endian = "little", target_arch = "s390x"), any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "s390x"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"))))'.dependencies]
39-
linux-raw-sys = { version = "0.4.14", default-features = false, features = ["general", "errno", "ioctl", "no_std", "elf"] }
39+
linux-raw-sys = { version = "0.6", default-features = false, features = ["general", "errno", "ioctl", "no_std", "elf"] }
4040
libc_errno = { package = "errno", version = "0.3.10", default-features = false, optional = true }
4141
libc = { version = "0.2.161", default-features = false, optional = true }
4242

@@ -53,7 +53,7 @@ libc = { version = "0.2.161", default-features = false }
5353
# Some syscalls do not have libc wrappers, such as in `io_uring`. For these,
5454
# the libc backend uses the linux-raw-sys ABI and `libc::syscall`.
5555
[target.'cfg(all(any(target_os = "android", target_os = "linux"), any(rustix_use_libc, miri, not(all(target_os = "linux", any(target_endian = "little", target_arch = "s390x"), any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "s390x"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies]
56-
linux-raw-sys = { version = "0.4.14", default-features = false, features = ["general", "ioctl", "no_std"] }
56+
linux-raw-sys = { version = "0.6", default-features = false, features = ["general", "ioctl", "no_std"] }
5757

5858
# For the libc backend on Windows, use the Winsock API in windows-sys.
5959
[target.'cfg(windows)'.dependencies.windows-sys]

src/io_uring.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,9 @@ pub struct io_uring_sync_cancel_reg {
12111211
pub fd: i32,
12121212
pub flags: IoringAsyncCancelFlags,
12131213
pub timeout: Timespec,
1214-
pub pad: [u64; 4],
1214+
pub opcode: u8,
1215+
pub pad: [u8; 7],
1216+
pub pad2: [u64; 3],
12151217
}
12161218

12171219
impl Default for io_uring_sync_cancel_reg {
@@ -1225,7 +1227,9 @@ impl Default for io_uring_sync_cancel_reg {
12251227
tv_sec: 0,
12261228
tv_nsec: 0,
12271229
},
1230+
opcode: Default::default(),
12281231
pad: Default::default(),
1232+
pad2: Default::default(),
12291233
}
12301234
}
12311235
}
@@ -1291,7 +1295,7 @@ pub struct io_sqring_offsets {
12911295
pub dropped: u32,
12921296
pub array: u32,
12931297
pub resv1: u32,
1294-
pub resv2: u64,
1298+
pub user_addr: u64,
12951299
}
12961300

12971301
#[allow(missing_docs)]
@@ -1306,7 +1310,7 @@ pub struct io_cqring_offsets {
13061310
pub cqes: u32,
13071311
pub flags: u32,
13081312
pub resv1: u32,
1309-
pub resv2: u64,
1313+
pub user_addr: u64,
13101314
}
13111315

13121316
#[allow(missing_docs)]
@@ -1419,7 +1423,7 @@ pub struct io_uring_buf_reg {
14191423
pub ring_addr: u64,
14201424
pub ring_entries: u32,
14211425
pub bgid: u16,
1422-
pub pad: u16,
1426+
pub flags: u16,
14231427
pub resv: [u64; 3_usize],
14241428
}
14251429

@@ -1605,7 +1609,7 @@ mod tests {
16051609
dropped,
16061610
array,
16071611
resv1,
1608-
resv2
1612+
user_addr
16091613
);
16101614
check_struct!(
16111615
io_cqring_offsets,
@@ -1617,7 +1621,7 @@ mod tests {
16171621
cqes,
16181622
flags,
16191623
resv1,
1620-
resv2
1624+
user_addr
16211625
);
16221626
check_struct!(io_uring_recvmsg_out, namelen, controllen, payloadlen, flags);
16231627
check_struct!(io_uring_probe, last_op, ops_len, resv, resv2, ops);
@@ -1629,9 +1633,18 @@ mod tests {
16291633
check_struct!(io_uring_getevents_arg, sigmask, sigmask_sz, pad, ts);
16301634
check_struct!(iovec, iov_base, iov_len);
16311635
check_struct!(open_how, flags, mode, resolve);
1632-
check_struct!(io_uring_buf_reg, ring_addr, ring_entries, bgid, pad, resv);
1636+
check_struct!(io_uring_buf_reg, ring_addr, ring_entries, bgid, flags, resv);
16331637
check_struct!(io_uring_buf, addr, len, bid, resv);
1634-
check_struct!(io_uring_sync_cancel_reg, addr, fd, flags, timeout, pad);
1638+
check_struct!(
1639+
io_uring_sync_cancel_reg,
1640+
addr,
1641+
fd,
1642+
flags,
1643+
timeout,
1644+
opcode,
1645+
pad,
1646+
pad2
1647+
);
16351648

16361649
check_renamed_type!(tail_or_bufs_struct, io_uring_buf_ring__bindgen_ty_1);
16371650
check_renamed_type!(

src/net/types.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ pub mod xdp {
16581658
/// XDP umem registration.
16591659
///
16601660
/// `struct xdp_umem_reg`
1661-
// https://github.com/torvalds/linux/blob/v6.6/include/uapi/linux/if_xdp.h#L73-L79
1661+
// https://github.com/torvalds/linux/blob/v6.8/include/uapi/linux/if_xdp.h#L79-L86
16621662
#[repr(C)]
16631663
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
16641664
pub struct XdpUmemReg {
@@ -1674,6 +1674,10 @@ pub mod xdp {
16741674
///
16751675
/// Requires kernel version 5.4.
16761676
pub flags: XdpUmemRegFlags,
1677+
/// AF_XDP TX metadata length
1678+
///
1679+
/// Requires kernel version 6.8.
1680+
pub tx_metadata_len: u32,
16771681
}
16781682

16791683
/// XDP statistics.

tests/io_uring/register.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn io_uring_buf_ring_can_be_registered() {
157157
ring_addr: br_ptr as u64,
158158
ring_entries: ENTRIES as u32,
159159
bgid: BGID,
160-
pad: 0,
160+
flags: 0,
161161
resv: [0u64; 3],
162162
};
163163

0 commit comments

Comments
 (0)