MLX5DV_VAR_UNIMPORT(3)

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

πŸ’… 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 earlier
  • mlx5dv_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 least var_attrs_size bytes as returned by mlx5dv_get_export_sizes().

mlx5dv_var_import

  • context β€” the RDMA device context to import the VAR into 🫢
  • data β€” pointer to a buffer previously filled by mlx5dv_var_export(). (yes, previously. this is a hand-me-down situation, not a make-it-fresh situation.)
πŸ™ˆ heads up: mlx5dv_var_unimport doesn't get its own arguments subsection here β€” it's just dv_var in the synopsis. that's the source page's choice, not mine, we're respecting the canon.

⭐ RETURN VALUE ⭐

  • mlx5dv_var_export() returns 0 on success, or the value of errno on error.
  • mlx5dv_var_import() returns a pointer to a struct mlx5dv_var on success, or NULL on error with errno set. (so like… check it, bestie. NULL is not a personality.)

🌈 SEE ALSO 🌈

  • mlx5dv_alloc_var
  • mlx5dv_get_export_sizes
  • mlx5dv_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