MLX5DV_VAR_IMPORT(3)
π mlx5dv_var_export, mlx5dv_var_import, mlx5dv_var_unimport π
okay bestie, buckle up β this page lives in the Library Functions Manual (yes, that's the whole manual name, we're being fancy today β¨). It's the three-function girlie squad for sharing VARs across processes, and honestly? iconic behavior.
β¨ NAME β¨
mlx5dv_var_exportβ exports a VAR's attributes so another process can get in on the fun π«Άmlx5dv_var_importβ imports a VAR from attributes that were exported earliermlx5dv_var_unimportβ unimports a VAR (cleanup era π )
πΈ SYNOPSIS πΈ
#include <infiniband/mlx5dv.h>
int mlx5dv_var_export(struct mlx5dv_var *dv_var, void *data);
struct mlx5dv_var *mlx5dv_var_import(struct ibv_context *context,
void *data);
void mlx5dv_var_unimport(struct mlx5dv_var *dv_var);
π¦ DESCRIPTION π¦
So these three functions are literally the whole "cross-process sharing of VAR objects" pipeline. That's the vibe. VAR goes out of one process, comes into another. slay.
mlx5dv_var_export() exports a VAR attributes into a data buffer. β οΈ important: you, the caller, have to allocate that buffer, and it has to be at least the size that mlx5dv_get_export_sizes() returned in the var_attrs_size field. No shortcuts, bestie, allocate the right amount.
mlx5dv_var_import() returns a VAR that's associated with the exported attributes in the given context.
And here's the cute part β the context can be the original VAR-allocating context or any context that shares the same kernel resources (like, for example, via ibv_import_device()). iykyk.
mlx5dv_var_unimport() unimports a VAR that got imported via mlx5dv_var_import(). Once you're done using the VAR, you should call either mlx5dv_free_var() or mlx5dv_var_unimport(). And no, they are NOT the same thing:
mlx5dv_free_var()destroys the kernel object πmlx5dv_var_unimport()only cleans up local resources and does not affect the kernel object π§
BIG WARNING: it is the responsibility of the application to coordinate between all contexts that use this VAR. Once destroy/free is done, no other process can use the object except for unimport. All users must collaborate to ensure this. fr fr, do not skip the coordination meeting, this is the one thing you cannot fumble. π
π ARGUMENTS π
mlx5dv_var_export
dv_varβ the VAR object to export. the main character of this call β¨dataβ pointer to a buffer to be filled with the exported attributes. This buffer must be at leastvar_attrs_sizebytes as returned bymlx5dv_get_export_sizes().
mlx5dv_var_import
contextβ the RDMA device context to import the VAR into π«Άdataβ pointer to a buffer previously filled bymlx5dv_var_export(). (yes, previously. this is a hand-me-down situation, not a make-it-fresh situation.)
π heads up:mlx5dv_var_unimportdoesn't get its own arguments subsection here β it's justdv_varin the synopsis. that's the source page's choice, not mine, we're respecting the canon.
β RETURN VALUE β
mlx5dv_var_export()returns0on success, or the value oferrnoon error.mlx5dv_var_import()returns a pointer to astruct mlx5dv_varon success, orNULLon error witherrnoset. (so like⦠check it, bestie.NULLis not a personality.)
π SEE ALSO π
mlx5dv_alloc_varmlx5dv_get_export_sizesmlx5dv_open_device
go read those too, they're literally the supporting cast π
π AUTHOR π
Maher Sanalla msanalla@nvidia.com β thank you for your service, legend π«‘
and that's the page!! this whole glow-up lives under the footer mlx5dv_var...ar_unimport(3) in the Library Functions Manual β no date stamp on this one, so I can't give you a timestamp, but hey, the manual name is right there and the page name is right here. periodt. π
ππ¦
π¦ 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