mlx5dv_dev...j_unimport(3)
π 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 stylemlx5dv_devx_obj_importβ imports a DEVX object using those exported attributesmlx5dv_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, obviouslydataβ pointer to the buffer that gets filled with the exported attributes. and it must be at leastdevx_obj_attrs_sizebytes, as returned bymlx5dv_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 intodataβ pointer to a buffer that was previously filled bymlx5dv_devx_obj_export()
β RETURN VALUE β
mlx5dv_devx_obj_export()β returns0on success, or the value oferrnoon errormlx5dv_devx_obj_import()β returns a pointer to astruct mlx5dv_devx_objon success, orNULLon error witherrnoset π
π 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