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 it
  • length β€” 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 as offset and be aligned with the system page size. no cap, don't skip that part
  • fd β€” the file descriptor that the dma-buf is identified by
  • access β€” the desired memory protection attributes; either 0 or the bitwise OR of one or more of enum ibv_access_flags πŸ”₯
  • mlx5_access β€” a specific device access flags situation; either 0 or 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 of errno tells you the failure reason 😭 (that's your hint bestie, go read errno)
ngl, always check for NULL before you start celebrating. ask me how I know πŸ’€

🌈 SEE ALSO 🌈


πŸ‘‘ 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