.\" Automatically generated by Pandoc 1.16.0.2
.\"
.TH "mlx5dv_mkey_check" "3" "" "" ""
.hy
.SH NAME
.PP
mlx5dv_mkey_check \- Check a MKEY for errors
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <infiniband/mlx5dv.h>

int\ mlx5dv_mkey_check(struct\ mlx5dv_mkey\ *mkey,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ mlx5dv_mkey_err\ *err_info);
\f[]
.fi
.SH DESCRIPTION
.PP
Checks \f[I]mkey\f[] for errors and provides the result in
\f[I]err_info\f[] on success.
.PP
This should be called after using a MKEY configured with signature
validation in a transfer operation.
While the transfer operation itself may be completed successfully (i.e.
no transport related errors occurred), there still may be errors related
to the integrity of the data.
The first of these errors is reported to the MKEY and kept there until
application software queries it by calling this API.
.PP
The type of error indicates which part of the signature was bad (guard,
reftag or apptag).
Also provided is the actual calculated value based on the transferred
data, and the expected value based on the signature fields.
Last part provided is the offset in the transfer that caused the error.
.SH ARGUMENTS
.TP
.B \f[I]mkey\f[]
The MKEY to check for errors.
.RS
.RE
.TP
.B \f[I]err_info\f[]
The result of the MKEY check, information about the errors detected, if
any.
.RS
.IP
.nf
\f[C]
struct\ mlx5dv_mkey_err\ {
\ \ \ \ enum\ mlx5dv_mkey_err_type\ err_type;
\ \ \ \ union\ {
\ \ \ \ \ \ \ \ struct\ mlx5dv_sig_err\ sig;
\ \ \ \ }\ err;
};
\f[]
.fi
.TP
.B \f[I]err_type\f[]
What kind of error happened.
If several errors exist in one block verified by the device, only the
first of them is reported, according to the order specified in T10DIF
specification, which is: \f[B]MLX5DV_MKEY_SIG_BLOCK_BAD_GUARD\f[],
\f[B]MLX5DV_MKEY_SIG_BLOCK_BAD_APPTAG\f[],
\f[B]MLX5DV_MKEY_SIG_BLOCK_BAD_REFTAG\f[].
.RS
.TP
.B \f[B]MLX5DV_MKEY_NO_ERR\f[]
No error is detected for the MKEY.
.RS
.RE
.TP
.B \f[B]MLX5DV_MKEY_SIG_BLOCK_BAD_GUARD\f[]
A signature error was detected in CRC/CHECKSUM for T10\-DIF or
CRC32/CRC32C/CRC64_XP10 (depends on the configured signature type).
Additional information about the error is provided in \f[B]struct
mlx5dv_sig_err\f[] of \f[I]err\f[].
.RS
.RE
.TP
.B \f[B]MLX5DV_MKEY_SIG_BLOCK_BAD_REFTAG\f[]
A signature error was detected in the reference tag.
This kind of signature error is relevant for T10\-DIF only.
Additional information about the error is provided in \f[B]struct
mlx5dv_sig_err\f[] of \f[I]err\f[].
.RS
.RE
.TP
.B \f[B]MLX5DV_MKEY_SIG_BLOCK_BAD_APPTAG\f[]
A signature error was detected in the application tag.
This kind of signature error is relevant for T10\-DIF only.
Additional information about the error is provided in \f[B]struct
mlx5dv_sig_err\f[] of \f[I]err\f[].
.RS
.RE
.RE
.TP
.B \f[I]err\f[]
Information about the detected error if \f[I]err_type\f[] is not
\f[B]MLX5DV_MKEY_NO_ERR\f[].
Otherwise, its value is not defined.
.RS
.RE
.RE
.SS Signature error
.IP
.nf
\f[C]
struct\ mlx5dv_sig_err\ {
\ \ \ \ uint64_t\ actual_value;
\ \ \ \ uint64_t\ expected_value;
\ \ \ \ uint64_t\ offset;
};
\f[]
.fi
.TP
.B \f[I]actual_value\f[]
The actual value that was calculated from the transferred data.
.RS
.RE
.TP
.B \f[I]expected_value\f[]
The expected value based on what appears in the signature respected
field.
.RS
.RE
.TP
.B \f[I]offset\f[]
The offset within the transfer where the error happened.
In block signature, this is guaranteed to be a block boundary offset.
.RS
.RE
.SH RETURN VALUE
.PP
0 on success or the value of errno on failure (which indicates the
failure reason).
.SH NOTES
.PP
A DEVX context should be opened by using \f[B]mlx5dv_open_device\f[](3).
.PP
Checking the MKEY for errors should be done after the application knows
the data transfer that was using the MKEY has finished.
Application should wait for the respected completion (if this was a
local MKEY) or wait for a received message from a peer (if this was a
remote MKEY).
.SH SEE ALSO
.PP
\f[B]mlx5dv_wr_mkey_configure\f[](3),
\f[B]mlx5dv_wr_set_mkey_sig_block\f[](3),
\f[B]mlx5dv_create_mkey\f[](3), \f[B]mlx5dv_destroy_mkey\f[](3)
.SH AUTHORS
.PP
Oren Duer <oren@nvidia.com>
.PP
Sergey Gorenko <sergeygo@nvidia.com>
