---
name: "mlx5dv_var_export"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mlx5dv_var_export"
---

# mlx5dv\_var\_export(3)

Export VAR attributes for cross-process sharing mlx5dv\_var\_import - Import a VAR from exported attributes mlx5dv\_var\_unimport - Unimport a VAR

## NAME

mlx5dv\_var\_export - Export VAR attributes for cross-process sharing

mlx5dv\_var\_import - Import a VAR from exported attributes

mlx5dv\_var\_unimport - Unimport a VAR

## 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

These functions enable cross-process sharing of VAR objects.

*mlx5dv\_var\_export()* exports a VAR attributes into a data buffer. The buffer must be allocated by the caller with at least the size returned by *mlx5dv\_get\_export\_sizes()* in the *var\_attrs\_size* field.

*mlx5dv\_var\_import()* returns a VAR that is associated with the exported attributes in the given *context*.

The *context* can be the original VAR allocating context or any context sharing the same kernel resources (e.g., via *ibv\_import\_device()*).

*mlx5dv\_var\_unimport()* unimports a VAR that was imported via *mlx5dv\_var\_import()*. Once the VAR usage has ended, either *mlx5dv\_free\_var()* or *mlx5dv\_var\_unimport()* should be called. *mlx5dv\_free\_var()* destroys the kernel object, while *mlx5dv\_var\_unimport()* only cleans up local resources without affecting the kernel object.

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.

## ARGUMENTS

### mlx5dv\_var\_export

- *dv\_var*

  The VAR object to export.

- *data*

  Pointer to a buffer to be filled with the exported attributes. The buffer must be at least *var\_attrs\_size* bytes as returned by *mlx5dv\_get\_export\_sizes()*.

### mlx5dv\_var\_import

- *context*

  RDMA device context to import the VAR into.

- *data*

  Pointer to a buffer previously filled by *mlx5dv\_var\_export()*.

## 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.

## SEE ALSO

**mlx5dv\_alloc\_var**, **mlx5dv\_get\_export\_sizes**, **mlx5dv\_open\_device**

## AUTHOR

Maher Sanalla ⟨msanalla@nvidia.com⟩\\c
