mlx5dv_reg_dmabuf_mr(3)
π mlx5dv_reg_dmabuf_mr β bestie's guide to registering dma-buf MRs β¨
okay so first things first, this is the mlx5dv_reg_dmabuf_mr(3) manual page (section 3, library functions, iykyk) and we're about to get you so comfy with dma-buf memory regions π
πΈ SYNOPSIS πΈ
like, here's the vibe:
#include <infiniband/mlx5dv.h>
struct ibv_mr *mlx5dv_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset,
size_t length, uint64_t iova, int fd,
int access, int mlx5_access)
π¦ DESCRIPTION π¦
So this function registers a dma-buf based memory region (MR). Fr fr, it does the same thing as ibv_reg_dmabuf_mr() β like, the exact same functionality β but with a lil glow-up: you also get to supply specific mlx5 access flags π
β¨
that's the whole pitch. iconic behavior honestly.
π ARGUMENTS π
pdβ the protection domain this MR is associated with π«Άoffsetβ where the MR starts inside the dma-buf, like the offset into itlengthβ the length of the MR πiovaβ specifies the virtual base address of the MR when you access it through a lkey or rkey. β οΈ lowkey important: it must have the same page offset asoffsetand be aligned with the system page size. no cap, don't skip that partfdβ the file descriptor that the dma-buf is identified byaccessβ the desired memory protection attributes; either0or the bitwise OR of one or more ofenum ibv_access_flagsπ₯mlx5_accessβ a specific device access flags situation; either0or the below:MLX5DV_REG_DMABUF_ACCESS_DATA_DIRECTβ if set, this MR will be accessed through the Data Direct engine bonded with that RDMA device π
β RETURN VALUE β
- On success? you get a pointer to the registered MR π
- If the request fails, you get
NULLβ and in that case the value oferrnotells you the failure reason π (that's your hint bestie, go readerrno)
ngl, always check for NULL before you start celebrating. ask me how I know π
π SEE ALSO π
ibv_reg_dmabuf_mr(3)mlx5dv_get_data_direct_sysfs_path(3)
π AUTHOR π
Yishai Hadas <yishaih@nvidia.com>
and that's the whole page bestie π this little beauty is the mlx5dv_reg_dmabuf_mr(3) manual page from section 3, dated as it appears on that page β mwah, go register some MRs β¨π§π
π¦ 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
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms