mlx5dv_dev...j_unimport(3)

πŸ“¦
version 65.0 Β· 3 versions
, in arch rolling

πŸ’– mlx5dv_devx_obj_export, mlx5dv_devx_obj_import, mlx5dv_devx_obj_unimport πŸ’–

okay so bestie, gather round, because this trio lives in the Library Functions Manual and they're literally the group chat of cross-process DEVX object sharing. three functions, one job: getting a DEVX object from one process into another process's hands without breaking anything. no cap, it's iconic. πŸŽ€


✨ NAME ✨

  • mlx5dv_devx_obj_export β€” exports the attributes of a DEVX object so other processes can get a look at them, cross-process sharing style
  • mlx5dv_devx_obj_import β€” imports a DEVX object using those exported attributes
  • mlx5dv_devx_obj_unimport β€” unimports that DEVX object when you're done

🌸 SYNOPSIS 🌸

#include <infiniband/mlx5dv.h>

int mlx5dv_devx_obj_export(struct mlx5dv_devx_obj *obj, void *data);

struct mlx5dv_devx_obj *mlx5dv_devx_obj_import(struct ibv_context *context,
                                               void *data);

void mlx5dv_devx_obj_unimport(struct mlx5dv_devx_obj *obj);

πŸ¦‹ DESCRIPTION πŸ¦‹

so these three functions? they enable cross-process sharing of DEVX objects. that's the whole vibe. πŸ’…

mlx5dv_devx_obj_export() exports the DEVX object attributes into a buffer. and listen β€” you, the caller, have to allocate that buffer yourself, and it needs to be at least the size returned by mlx5dv_get_export_sizes() in the devx_obj_attrs_size field. don't skimp on the buffer, she needs room to breathe. ✨

mlx5dv_devx_obj_import() returns a DEVX object that's associated with those exported attributes, but in the given context. important: the data buffer must have already been filled by mlx5dv_devx_obj_export() first β€” no filling it in after, that's not the assignment. πŸ™ˆ

and the context? it can be the original object-creating context, or any context that shares the same kernel resources (like, say, via ibv_import_device()). iykyk. 🫢

mlx5dv_devx_obj_unimport() unimports a DEVX object that was imported via mlx5dv_devx_obj_import(). once the object's usage has ended, you should call either mlx5dv_devx_obj_destroy() or mlx5dv_devx_obj_unimport(). and here's the distinction that actually matters, bestie, write it down:

  • mlx5dv_devx_obj_destroy() β€” destroys the kernel object πŸ’€
  • mlx5dv_devx_obj_unimport() β€” only cleans up local resources, doesn't touch the kernel object at all 🧚
⚠️ okay this part is serious so no jokes: it is the responsibility of the application to coordinate between all contexts that use this object. once destroy is done, no other process can use the object except for unimport. all users must collaborate to make sure that holds. literally all of them. don't be the one who ruins it. 😭

🌈 ARGUMENTS 🌈

πŸ’œ mlx5dv_devx_obj_export

  • obj β€” the DEVX object you're exporting, obviously
  • data β€” pointer to the buffer that gets filled with the exported attributes. and it must be at least devx_obj_attrs_size bytes, as returned by mlx5dv_get_export_sizes(). (yes, we said that already, but it's important enough to say twice ✨)

πŸ“ mlx5dv_devx_obj_import

  • context β€” the RDMA device context you're importing the DEVX object into
  • data β€” pointer to a buffer that was previously filled by mlx5dv_devx_obj_export()

⭐ RETURN VALUE ⭐

  • mlx5dv_devx_obj_export() β€” returns 0 on success, or the value of errno on error
  • mlx5dv_devx_obj_import() β€” returns a pointer to a struct mlx5dv_devx_obj on success, or NULL on error with errno set 😭

πŸŽ€ SEE ALSO πŸŽ€

mlx5dv_devx_obj_create, mlx5dv_get_export_sizes, mlx5dv_open_device


πŸ‘‘ AUTHOR πŸ‘‘

Maher Sanalla msanalla@nvidia.com β€” thank you for your service πŸ«‘πŸ’–


and that's the whole page, bestie! you just read mlx5dv_dev...j_unimport(3) from the Library Functions Manual, top to bottom, no skimming, and honestly? proud of you. now go forth and share those DEVX objects responsibly. mwah πŸ’…βœ¨πŸ”₯

πŸ“¦ where this page comes from
  • arch rolling: rdma-core 65.0-1 Β· GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-MIT AND GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-FreeBSD AND GPL-2.0-or-later OR LicenseRef-Intel-BSD-3-Clause AND GPL-2.0-or-later OR LicenseRef-PathScale-BSD-Patent-License AND CC0-1.0 AND MIT AND BSD-2-Clause AND CPL-1.0 OR BSD-2-Clause OR GPL-2.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms