ibv_impo...import_mr(3)
π ibv_import_mr(3) β bestie edition
okay so this page is from the Libibverbs Programmer's Manual, and it's about two lil functions that let you pull a Memory Region into your process from a handle, and then yeet it back out when you're done. no cap, it's giving "shared custody but for kernel objects" π
β¨ NAME β¨
ibv_import_mr β import an MR from a given ibv_pd
ibv_unimport_mr β unimport an MR
πΈ SYNOPSIS πΈ
#include <infiniband/verbs.h>
struct ibv_mr *ibv_import_mr(struct ibv_pd *pd, uint32_t mr_handle);
void ibv_unimport_mr(struct ibv_mr *mr)
π¦ DESCRIPTION π¦
so ibv_import_mr() hands you back a Memory region (MR) that's associated with the given mr_handle, inside the RDMA context that's associated with the given pd. literally that simple π
the input mr_handle value must be a valid kernel handle for an MR object in the associated RDMA context. and like, how do you even get one of those? easy β grab it from the original MR by reading its ibv_mr->handle member value. iykyk π«Ά
ibv_unimport_mr() is the opposite vibe β it unimports the MR. once you're done using the MR, you should call either ibv_dereg_mr() or ibv_unimport_mr(). here's the tea on the difference β:
- the first one (
ibv_dereg_mr()) goes to the kernel to destroy the object - the second one (
ibv_unimport_mr()) just cleans up whatever is needed / the opposite of the import β without calling the kernel
β οΈ okay this part is important, don't skip it: it is the responsibility of the application to coordinate between all the ibv_context(s) that use this MR. once destroy is done, no other process can touch the object except for unimport. all users of the context must collaborate to ensure this. fr fr, no main character energy here β this is a team effort π
π RETURN VALUE π
ibv_import_mr() returns a pointer to the allocated MR, or NULL if the request fails. (yes bestie, always check for NULL π)
π₯ NOTES π₯
the addr field in the imported MR is not applicable β a NULL value is expected. don't come for it, it's just how it is π
π SEE ALSO π
ibv_reg_mr(3), ibv_reg_dm_mr(3), ibv_reg_mr_iova(3), ibv_reg_mr_iova2(3), ibv_dereg_mr(3),
π AUTHOR π
Yishai Hadas <yishaih@mellanox.com>
and that's the whole page, bestie. this icon was brought to you by libibverbs, dated 2020-5-3 β go forth and import responsibly π§ββοΈπ
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- ubuntu jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms