From 19464c3aaf354dde7e80458833169cb1a229869e Mon Sep 17 00:00:00 2001 From: arctic-alpaca <67190338+arctic-alpaca@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:10:43 +0100 Subject: [PATCH] move changes to `src/unix/linux_like/linux/mod.rs` (backport ) (cherry picked from commit 88aa42a2c6a7addf3ab66dd77cbd014e0af6181c) --- libc-test/semver/linux-gnu.txt | 5 ----- libc-test/semver/linux-musl.txt | 5 ----- libc-test/semver/linux.txt | 5 +++++ src/unix/linux_like/linux/gnu/mod.rs | 27 ---------------------- src/unix/linux_like/linux/mod.rs | 32 +++++++++++++++++++++++++++ src/unix/linux_like/linux/musl/mod.rs | 27 ---------------------- 6 files changed, 37 insertions(+), 64 deletions(-) diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 87fb4e480f7f2..83dd825584cd0 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -489,17 +489,12 @@ XDP_RING_NEED_WAKEUP XDP_RX_RING XDP_SHARED_UMEM XDP_STATISTICS -XDP_TXMD_FLAGS_CHECKSUM -XDP_TXMD_FLAGS_TIMESTAMP -XDP_TX_METADATA XDP_TX_RING XDP_UMEM_COMPLETION_RING XDP_UMEM_FILL_RING XDP_UMEM_PGOFF_COMPLETION_RING XDP_UMEM_PGOFF_FILL_RING XDP_UMEM_REG -XDP_UMEM_TX_METADATA_LEN -XDP_UMEM_TX_SW_CSUM XDP_UMEM_UNALIGNED_CHUNK_FLAG XDP_USE_NEED_WAKEUP XDP_USE_SG diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index 802e1477ca470..62b188dac8288 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -48,17 +48,12 @@ XDP_RING_NEED_WAKEUP XDP_RX_RING XDP_SHARED_UMEM XDP_STATISTICS -XDP_TXMD_FLAGS_CHECKSUM -XDP_TXMD_FLAGS_TIMESTAMP -XDP_TX_METADATA XDP_TX_RING XDP_UMEM_COMPLETION_RING XDP_UMEM_FILL_RING XDP_UMEM_PGOFF_COMPLETION_RING XDP_UMEM_PGOFF_FILL_RING XDP_UMEM_REG -XDP_UMEM_TX_METADATA_LEN -XDP_UMEM_TX_SW_CSUM XDP_UMEM_UNALIGNED_CHUNK_FLAG XDP_USE_NEED_WAKEUP XDP_USE_SG diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 78dccdfb72e72..b9b20c596280f 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -3388,6 +3388,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 0f92ac110feae..7b9d84f967fd2 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -436,15 +436,6 @@ s! { pub options: ::__u32, } - pub struct xsk_tx_metadata_completion { - pub tx_timestamp: ::__u64, - } - - pub struct xsk_tx_metadata_request { - pub csum_start: ::__u16, - pub csum_offset: ::__u16, - } - pub struct iocb { pub aio_data: ::__u64, #[cfg(target_endian = "little")] @@ -666,18 +657,6 @@ s_no_extra_traits! { pub ut_addr_v6: [i32; 4], __glibc_reserved: [::c_char; 20], } - - #[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! { @@ -1109,8 +1088,6 @@ pub const XDP_USE_NEED_WAKEUP: ::__u16 = 1 << 3; pub const XDP_USE_SG: ::__u16 = 1 << 4; pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: ::__u32 = 1 << 0; -pub const XDP_UMEM_TX_SW_CSUM: ::__u32 = 1 << 1; -pub const XDP_UMEM_TX_METADATA_LEN: ::__u32 = 1 << 2; pub const XDP_RING_NEED_WAKEUP: ::__u32 = 1 << 0; @@ -1133,11 +1110,7 @@ pub const XDP_UMEM_PGOFF_COMPLETION_RING: ::c_ulonglong = 0x180000000; pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: ::c_int = 48; pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; -pub const XDP_TXMD_FLAGS_TIMESTAMP: ::__u32 = 1 << 0; -pub const XDP_TXMD_FLAGS_CHECKSUM: ::__u32 = 1 << 1; - pub const XDP_PKT_CONTD: ::__u32 = 1 << 0; -pub const XDP_TX_METADATA: ::__u32 = 1 << 1; pub const ELFOSABI_ARM_AEABI: u8 = 64; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index b1df6ebef07cb..fe1f32a907a10 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! { @@ -1654,6 +1664,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! { @@ -5632,6 +5655,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 82d319ff08649..ec295aa57deb3 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -346,15 +346,6 @@ s! { pub options: ::__u32, } - pub struct xsk_tx_metadata_completion { - pub tx_timestamp: ::__u64, - } - - pub struct xsk_tx_metadata_request { - pub csum_start: ::__u16, - pub csum_offset: ::__u16, - } - // netinet/tcp.h pub struct tcp_info { @@ -492,18 +483,6 @@ s_no_extra_traits! { pub ut_addr_v6: [::c_uint; 4], __unused: [::c_char; 20], } - - #[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! { @@ -909,8 +888,6 @@ pub const XDP_USE_NEED_WAKEUP: ::__u16 = 1 << 3; pub const XDP_USE_SG: ::__u16 = 1 << 4; pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: ::__u32 = 1 << 0; -pub const XDP_UMEM_TX_SW_CSUM: ::__u32 = 1 << 1; -pub const XDP_UMEM_TX_METADATA_LEN: ::__u32 = 1 << 2; pub const XDP_RING_NEED_WAKEUP: ::__u32 = 1 << 0; @@ -933,11 +910,7 @@ pub const XDP_UMEM_PGOFF_COMPLETION_RING: ::c_ulonglong = 0x180000000; pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: ::c_int = 48; pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; -pub const XDP_TXMD_FLAGS_TIMESTAMP: ::__u32 = 1 << 0; -pub const XDP_TXMD_FLAGS_CHECKSUM: ::__u32 = 1 << 1; - pub const XDP_PKT_CONTD: ::__u32 = 1 << 0; -pub const XDP_TX_METADATA: ::__u32 = 1 << 1; pub const _CS_V6_ENV: ::c_int = 1148; pub const _CS_V7_ENV: ::c_int = 1149;