.\" Automatically generated by Pandoc 2.0.6
.\"
.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[]
.fi
.SH DESCRIPTION
.PP
These functions enable cross\-process sharing of VAR objects.
.PP
\f[I]mlx5dv_var_export()\f[] 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[] in the
\f[I]var_attrs_size\f[] field.
.PP
\f[I]mlx5dv_var_import()\f[] returns a VAR that is associated with the
exported attributes in the given \f[I]context\f[].
.PP
The \f[I]context\f[] can be the original VAR allocating context or any
context sharing the same kernel resources (e.g., via
\f[I]ibv_import_device()\f[]).
.PP
\f[I]mlx5dv_var_unimport()\f[] unimports a VAR that was imported via
\f[I]mlx5dv_var_import()\f[].
Once the VAR usage has ended, either \f[I]mlx5dv_free_var()\f[] or
\f[I]mlx5dv_var_unimport()\f[] should be called.
\f[I]mlx5dv_free_var()\f[] destroys the kernel object, while
\f[I]mlx5dv_var_unimport()\f[] 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
.B \f[I]dv_var\f[]
The VAR object to export.
.RS
.RE
.TP
.B \f[I]data\f[]
Pointer to a buffer to be filled with the exported attributes.
The buffer must be at least \f[I]var_attrs_size\f[] bytes as returned by
\f[I]mlx5dv_get_export_sizes()\f[].
.RS
.RE
.SS mlx5dv_var_import
.TP
.B \f[I]context\f[]
RDMA device context to import the VAR into.
.RS
.RE
.TP
.B \f[I]data\f[]
Pointer to a buffer previously filled by \f[I]mlx5dv_var_export()\f[].
.RS
.RE
.SH RETURN VALUE
.PP
\f[I]mlx5dv_var_export()\f[] returns 0 on success, or the value of errno
on error.
.PP
\f[I]mlx5dv_var_import()\f[] returns a pointer to a \f[I]struct
mlx5dv_var\f[] on success, or NULL on error with errno set.
.SH SEE ALSO
.PP
\f[B]mlx5dv_alloc_var\f[], \f[B]mlx5dv_get_export_sizes\f[],
\f[B]mlx5dv_open_device\f[]
.SH AUTHOR
.PP
Maher Sanalla <msanalla@nvidia.com>
