From e7d797d02ab9e0eba5e1c9bc9e21cd26a64d620b Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Wed, 10 Dec 2025 18:31:16 -0800 Subject: [PATCH 1/2] : bindgen no longer generating ibv_wc_flags and ibv_access_flags Summary: `buck2 build fbcode//monarch/rdmaxcel-sys:rdmaxcel-sys` is currently broken. remove the `--bitfield-enum` flags from BUCK for `ibv_wc_flags` and `ibv_access_flags` - they aren't C enums anymore, they are `static const` values in rdma-core v60. manually define the wrapper types in lib.rs. Differential Revision: D88911049 --- rdmaxcel-sys/src/lib.rs | 50 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/rdmaxcel-sys/src/lib.rs b/rdmaxcel-sys/src/lib.rs index f493273ba..849450d3f 100644 --- a/rdmaxcel-sys/src/lib.rs +++ b/rdmaxcel-sys/src/lib.rs @@ -15,14 +15,60 @@ mod inner { #![allow(non_snake_case)] #![allow(unused_attributes)] #[cfg(not(cargo))] - use crate::ibv_wc_flags; - #[cfg(not(cargo))] use crate::ibv_wc_opcode; #[cfg(not(cargo))] use crate::ibv_wc_status; #[cfg(cargo)] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); + // Manually define ibv_wc_flags as a bitfield (bindgen can't generate it from static const) + #[repr(transparent)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] + pub struct ibv_wc_flags(pub u32); + + impl ibv_wc_flags { + pub const IBV_WC_GRH: Self = Self(1 << 0); + pub const IBV_WC_WITH_IMM: Self = Self(1 << 1); + pub const IBV_WC_IP_CSUM_OK: Self = Self(1 << 2); + pub const IBV_WC_WITH_INV: Self = Self(1 << 3); + pub const IBV_WC_TM_SYNC_REQ: Self = Self(1 << 4); + pub const IBV_WC_TM_MATCH: Self = Self(1 << 5); + pub const IBV_WC_TM_DATA_VALID: Self = Self(1 << 6); + } + + impl std::ops::BitAnd for ibv_wc_flags { + type Output = Self; + fn bitand(self, rhs: Self) -> Self { + Self(self.0 & rhs.0) + } + } + + // Manually define ibv_access_flags as a bitfield (bindgen can't generate it from static const) + #[repr(transparent)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] + pub struct ibv_access_flags(pub u32); + + impl ibv_access_flags { + pub const IBV_ACCESS_LOCAL_WRITE: Self = Self(1 << 0); + pub const IBV_ACCESS_REMOTE_WRITE: Self = Self(1 << 1); + pub const IBV_ACCESS_REMOTE_READ: Self = Self(1 << 2); + pub const IBV_ACCESS_REMOTE_ATOMIC: Self = Self(1 << 3); + pub const IBV_ACCESS_MW_BIND: Self = Self(1 << 4); + pub const IBV_ACCESS_ZERO_BASED: Self = Self(1 << 5); + pub const IBV_ACCESS_ON_DEMAND: Self = Self(1 << 6); + pub const IBV_ACCESS_HUGETLB: Self = Self(1 << 7); + pub const IBV_ACCESS_RELAXED_ORDERING: Self = Self(1 << 8); + pub const IBV_ACCESS_FLUSH_GLOBAL: Self = Self(1 << 9); + pub const IBV_ACCESS_FLUSH_PERSISTENT: Self = Self(1 << 10); + } + + impl std::ops::BitOr for ibv_access_flags { + type Output = Self; + fn bitor(self, rhs: Self) -> Self { + Self(self.0 | rhs.0) + } + } + #[repr(C, packed(1))] #[derive(Debug, Default, Clone, Copy)] pub struct mlx5_wqe_ctrl_seg { From a72c4a475e9834eb4d895b719574b192f93b1eb3 Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Wed, 10 Dec 2025 18:31:16 -0800 Subject: [PATCH 2/2] : project/monarch/job: local-job Differential Revision: D88913464 --- rdmaxcel-sys/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rdmaxcel-sys/src/lib.rs b/rdmaxcel-sys/src/lib.rs index 849450d3f..d07154114 100644 --- a/rdmaxcel-sys/src/lib.rs +++ b/rdmaxcel-sys/src/lib.rs @@ -21,7 +21,7 @@ mod inner { #[cfg(cargo)] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); - // Manually define ibv_wc_flags as a bitfield (bindgen can't generate it from static const) + // Manually define ibv_wc_flags as a bitfield (bindgen isn't generating it) #[repr(transparent)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] pub struct ibv_wc_flags(pub u32); @@ -43,7 +43,7 @@ mod inner { } } - // Manually define ibv_access_flags as a bitfield (bindgen can't generate it from static const) + // Manually define ibv_access_flags as a bitfield (bindgen isn't generating it) #[repr(transparent)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] pub struct ibv_access_flags(pub u32);