diff --git a/libc-test/build.rs b/libc-test/build.rs index 982e060f97cb7..b352add16b327 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3817,12 +3817,25 @@ fn test_linux(target: &str) { // FIXME: Requires >= 5.4 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. - "xdp_umem_reg" | "xdp_ring_offset" | "xdp_mmap_offsets" if musl => true, + "xdp_ring_offset" | "xdp_mmap_offsets" if musl => true, + + // FIXME: Requires >= 6.8 kernel headers. + // A field was added in 6.8. + // https://github.com/torvalds/linux/commit/341ac980eab90ac1f6c22ee9f9da83ed9604d899 + // The previous version of the struct was removed in 6.11 due to a bug. + // https://github.com/torvalds/linux/commit/32654bbd6313b4cfc82297e6634fa9725c3c900f + "xdp_umem_reg" => true, // FIXME: Requires >= 5.9 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. "xdp_statistics" if musl => true, + // FIXME: Requires >= 6.8 kernel headers. + "xsk_tx_metadata" + | "__c_anonymous_xsk_tx_metadata_union" + | "xsk_tx_metadata_request" + | "xsk_tx_metadata_completion" => true, + // A new field was added in kernel 5.4, this is the old version for backwards compatibility. // https://github.com/torvalds/linux/commit/77cd0d7b3f257fd0e3096b4fdcff1a7d38e99e10 "xdp_ring_offset_v1" | "xdp_mmap_offsets_v1" => true, @@ -4267,6 +4280,23 @@ fn test_linux(target: &str) { true } + // FIXME: Requires >= 6.8 kernel headers. + "XDP_UMEM_TX_SW_CSUM" + | "XDP_TXMD_FLAGS_TIMESTAMP" + | "XDP_TXMD_FLAGS_CHECKSUM" + | "XDP_TX_METADATA" + => + { + true + } + + // FIXME: Requires >= 6.11 kernel headers. + "XDP_UMEM_TX_METADATA_LEN" + => + { + true + } + // FIXME: Requires >= 6.6 kernel headers. "SYS_fchmodat2" => true, @@ -4524,7 +4554,9 @@ fn test_linux(target: &str) { (musl && struct_ == "mcontext_t" && field == "__extcontext" && loongarch64) || // FIXME(#4121): a new field was added from `f_spare` (struct_ == "statvfs" && field == "__f_spare") || - (struct_ == "statvfs64" && field == "__f_spare") + (struct_ == "statvfs64" && field == "__f_spare") || + // the `xsk_tx_metadata_union` field is an anonymous union + (struct_ == "xsk_tx_metadata" && field == "xsk_tx_metadata_union") }); cfg.skip_roundtrip(move |s| match s { diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 655bfce4e1fa8..a983d62341dcf 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -3387,6 +3387,11 @@ W_EXITCODE W_STOPCODE XATTR_CREATE XATTR_REPLACE +XDP_TXMD_FLAGS_CHECKSUM +XDP_TXMD_FLAGS_TIMESTAMP +XDP_TX_METADATA +XDP_UMEM_TX_METADATA_LEN +XDP_UMEM_TX_SW_CSUM XTABS YESEXPR YESSTR diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 79aa59a59f38b..2f1bef1ddb4af 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -401,6 +401,7 @@ s! { pub chunk_size: ::__u32, pub headroom: ::__u32, pub flags: ::__u32, + pub tx_metadata_len: ::__u32, } pub struct xdp_umem_reg_v1 { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 9ce4e50c019fb..2bfd2fc145a97 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1194,6 +1194,16 @@ s! { pub chan: ::c_uint, pub rsv: [::c_uint; 5], } + + // linux/if_xdp.h + pub struct xsk_tx_metadata_completion { + pub tx_timestamp: ::__u64, + } + + pub struct xsk_tx_metadata_request { + pub csum_start: ::__u16, + pub csum_offset: ::__u16, + } } cfg_if! { @@ -1648,6 +1658,19 @@ s_no_extra_traits! { pub flags: ::c_uint, pub anonymous_2: __c_anonymous_ptp_perout_request_2, } + + // linux/if_xdp.h + #[allow(missing_debug_implementations)] + pub struct xsk_tx_metadata { + pub flags: ::__u64, + pub xsk_tx_metadata_union: __c_anonymous_xsk_tx_metadata_union, + } + + #[allow(missing_debug_implementations)] + pub union __c_anonymous_xsk_tx_metadata_union { + pub request: xsk_tx_metadata_request, + pub completion: xsk_tx_metadata_completion, + } } cfg_if! { @@ -5592,6 +5615,15 @@ pub const SCHED_FLAG_KEEP_PARAMS: ::c_int = 0x10; pub const SCHED_FLAG_UTIL_CLAMP_MIN: ::c_int = 0x20; pub const SCHED_FLAG_UTIL_CLAMP_MAX: ::c_int = 0x40; +// linux/if_xdp.h +pub const XDP_UMEM_TX_SW_CSUM: ::__u32 = 1 << 1; +pub const XDP_UMEM_TX_METADATA_LEN: ::__u32 = 1 << 2; + +pub const XDP_TXMD_FLAGS_TIMESTAMP: ::__u32 = 1 << 0; +pub const XDP_TXMD_FLAGS_CHECKSUM: ::__u32 = 1 << 1; + +pub const XDP_TX_METADATA: ::__u32 = 1 << 1; + // elf.h pub const NT_PRSTATUS: ::c_int = 1; pub const NT_PRFPREG: ::c_int = 2; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 3c13e3a3d131a..ec295aa57deb3 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -311,6 +311,7 @@ s! { pub chunk_size: ::__u32, pub headroom: ::__u32, pub flags: ::__u32, + pub tx_metadata_len: ::__u32, } pub struct xdp_umem_reg_v1 {