.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "mlx5dv_var_export / mlx5dv_var_import / mlx5dv_var_unimport" "3" "" "" ""
.hy
.SH NAME
.PP
mlx5dv_var_export - Export VAR attributes for cross-process sharing
.PP
mlx5dv_var_import - Import a VAR from exported attributes
.PP
mlx5dv_var_unimport - Unimport a VAR
.SH SYNOPSIS
.IP
.nf
\f[C]
#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);
\f[R]
.fi
.SH DESCRIPTION
.PP
These functions enable cross-process sharing of VAR objects.
.PP
\f[I]mlx5dv_var_export()\f[R] exports a VAR attributes into a data
buffer.
The buffer must be allocated by the caller with at least the size
returned by \f[I]mlx5dv_get_export_sizes()\f[R] in the
\f[I]var_attrs_size\f[R] field.
.PP
\f[I]mlx5dv_var_import()\f[R] returns a VAR that is associated with the
exported attributes in the given \f[I]context\f[R].
.PP
The \f[I]context\f[R] can be the original VAR allocating context or any
context sharing the same kernel resources (e.g., via
\f[I]ibv_import_device()\f[R]).
.PP
\f[I]mlx5dv_var_unimport()\f[R] unimports a VAR that was imported via
\f[I]mlx5dv_var_import()\f[R].
Once the VAR usage has ended, either \f[I]mlx5dv_free_var()\f[R] or
\f[I]mlx5dv_var_unimport()\f[R] should be called.
\f[I]mlx5dv_free_var()\f[R] destroys the kernel object, while
\f[I]mlx5dv_var_unimport()\f[R] only cleans up local resources without
affecting the kernel object.
.PP
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.
.SH ARGUMENTS
.SS mlx5dv_var_export
.TP
\f[I]dv_var\f[R]
The VAR object to export.
.TP
\f[I]data\f[R]
Pointer to a buffer to be filled with the exported attributes.
The buffer must be at least \f[I]var_attrs_size\f[R] bytes as returned
by \f[I]mlx5dv_get_export_sizes()\f[R].
.SS mlx5dv_var_import
.TP
\f[I]context\f[R]
RDMA device context to import the VAR into.
.TP
\f[I]data\f[R]
Pointer to a buffer previously filled by \f[I]mlx5dv_var_export()\f[R].
.SH RETURN VALUE
.PP
\f[I]mlx5dv_var_export()\f[R] returns 0 on success, or the value of
errno on error.
.PP
\f[I]mlx5dv_var_import()\f[R] returns a pointer to a \f[I]struct
mlx5dv_var\f[R] on success, or NULL on error with errno set.
.SH SEE ALSO
.PP
\f[B]mlx5dv_alloc_var\f[R], \f[B]mlx5dv_get_export_sizes\f[R],
\f[B]mlx5dv_open_device\f[R]
.SH AUTHOR
.PP
Maher Sanalla <msanalla@nvidia.com>
