Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
xmakro committed Jan 29, 2025
1 parent 795901e commit 5d7844a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ibverbs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn main() {
.header("vendor/rdma-core/libibverbs/verbs.h")
.clang_arg(format!("-I{built_in}/include/"))
.allowlist_function("ibv_.*")
.allowlist_function("_ibv_.*")
.allowlist_type("ibv_.*")
.allowlist_var("IBV_LINK_LAYER_.*")
.bitfield_enum("ibv_access_flags")
Expand All @@ -77,7 +78,6 @@ fn main() {
.derive_debug(true)
.prepend_enum_name(false)
.blocklist_type("ibv_wc")
.wrap_static_fns(true)
.size_t_is_usize(true)
.generate()
.expect("Unable to generate bindings");
Expand Down
13 changes: 10 additions & 3 deletions ibverbs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,16 @@ impl Context {
}

let mut gid_table = vec![ffi::ibv_gid_entry::default(); port_attr.gid_tbl_len as usize];
let num_entries =
unsafe { ffi::ibv_query_gid_table(ctx, gid_table.as_mut_ptr(), gid_table.len(), 0) };
assert_eq!(num_entries as usize, gid_table.len());
let num_entries = unsafe {
ffi::_ibv_query_gid_table(
ctx,
gid_table.as_mut_ptr(),
gid_table.len(),
0,
size_of::<ffi::ibv_gid_entry>(),
)
};
gid_table.truncate(num_entries as usize);
let gid_table = gid_table.into_iter().map(GidEntry::from).collect();

Ok(Context {
Expand Down

0 comments on commit 5d7844a

Please sign in to comment.