1mlx5dv_wr_set_mkey_sig_block(3)                mlx5dv_wr_set_mkey_sig_block(3)
2
3
4

NAME

6       mlx5dv_wr_set_mkey_sig_block  -  Configure  a  MKEY for block signature
7       (data integrity) operation.
8

SYNOPSIS

10              #include <infiniband/mlx5dv.h>
11
12              static inline void mlx5dv_wr_set_mkey_sig_block(struct mlx5dv_qp_ex *mqp,
13                                                              const struct mlx5dv_sig_block_attr *attr)
14

DESCRIPTION

16       Configure a MKEY with block-level  data  protection  properties.   With
17       this,  the  device  can  add/modify/strip/validate integrity fields per
18       block when transmitting data from memory to network and when  receiving
19       data from network to memory.
20
21       This  setter  can  be optionally called after a MKEY configuration work
22       request posting has started using mlx5dv_wr_mkey_configure(3).  Config‐
23       uring  block  signature properties to a MKEY is done by describing what
24       kind of signature is required (or expected) in two  domains:  the  wire
25       domain and the memory domain.
26
27       The  MKEY  represents  a  virtually contiguous memory, by configuring a
28       layout to it.  The memory signature domain describes  whether  data  in
29       this  virtually contiguous memory includes integrity fields, and if so,
30       what kind and what block size.
31
32       The wire signature domain describes the same kind of properties for the
33       data as it is seen on the wire.  Now, depending on the actual operation
34       that happens (TX or RX), the device will do the “right thing” based  on
35       the signature configurations of the two domains.
36
37   Example 1:
38       Memory signature domain is configured for CRC32 every 512B block.
39
40       Wire signature domain is configured for no signature.
41
42       A SEND is issued using the MKEY as a local key.
43
44       Result: device will gather the data with the CRC32 fields from the MKEY
45       (using whatever layout configured to the MKEY to locate the actual mem‐
46       ory), validate each CRC32 against the previous 512 bytes of data, strip
47       the CRC32 field, and transmit only 512 bytes of data to the wire.
48
49   Example 1.1:
50       Same as above, but a RECV is issued with the same key, and RX happens.
51
52       Result: device will receive the data from the wire, scatter it  to  the
53       MKEY (using whatever layout configured to the MKEY to locate the actual
54       memory), generating and scattering additional CRC32 field  after  every
55       512 bytes that are scattered.
56
57   Example 2:
58       Memory signature domain is configured for no signature.
59
60       Wire signature domain is configured for T10DIF every 4K block.
61
62       The MKEY is sent to a remote node that issues a RDMA_READ to this MKEY.
63
64       Result:  device will gather the data from the MKEY (using whatever lay‐
65       out configured to the MKEY to locate the actual memory), transmit it to
66       the wire while generating an additional T10DIF field every 4K of data.
67
68   Example 2.1:
69       Same as above, but remote node issues a RDMA_WRITE to this MKEY.
70
71       Result:  Device  will  receive  the  data  from the wire, validate each
72       T10DIF field against the previous 4K of data, strip the  T10DIF  field,
73       and  scatter  the data alone to the MKEY (using whatever layout config‐
74       ured to the MKEY to locate the actual memory).
75

ARGUMENTS

77       mqp
78
79              The QP where an MKEY configuration work request was created by
80
81              mlx5dv_wr_mkey_configure().
82
83       attr   Block signature attributes to set for the MKEY.
84
85   Block signature attributes
86       Block signature attributes describe the input and  output  data  struc‐
87       tures in memory and wire domains.
88
89              struct mlx5dv_sig_block_attr {
90                  const struct mlx5dv_sig_block_domain *mem;
91                  const struct mlx5dv_sig_block_domain *wire;
92                  uint32_t flags;
93                  uint8_t check_mask;
94                  uint8_t copy_mask;
95                  uint64_t comp_mask;
96              };
97
98       mem    A  pointer  to the signature configuration for the memory domain
99              or NULL if the domain does not have a signature.
100
101       wire   A pointer to the signature configuration for the wire domain  or
102              NULL if the domain does not have a signature.
103
104       flags  A bitwise OR of the various values described below.
105
106              MLX5DV_SIG_BLOCK_ATTR_FLAG_COPY_MASK
107                     If the bit is not set then copy_mask is ignored.  See de‐
108                     tails in the copy_mask description.
109
110       check_mask
111              Each bit of check_mask corresponds to a byte  of  the  signature
112              field  in  input domain.  Byte of the input signature is checked
113              if corresponding bit in check_mask is set.  Bits not relevant to
114              the signature type are ignored.
115
116              Layout of check_mask.
117
118              check_mask        7          6          5         4         3         2        1         0
119              (bits)
120              ─────────────────────────────────────────────────────────────────────────────────────────────────
121              T10-DIF (bytes)   GUARD[1]   GUARD[0]   APP[1]    APP[0]    REF[3]    REF[2]   REF[1]    REF[0]
122              CRC32C/CRC32      3          2          1         0
123              (bytes)
124              CRC64_XP10        7          6          5         4         3         2        1         0
125              (bytes)
126
127              Common used masks are defined in  enum  mlx5dv_sig_mask.   Other
128              masks  are  also  supported.  Follow the above table to define a
129              custom mask.  For example, this can be useful for  the  applica‐
130              tion  tag  field of the T10DIF signature.  Using the application
131              tag is out of the scope of the T10DIF specification and  depends
132              on  the  implementation.  check_mask allows validating a part of
133              the application tag if needed.
134
135       copy_mask
136              A mask to specify what part of the signature is copied from  the
137              source  domain to the destination domain.  The copy mask is usu‐
138              ally calculated automatically.  The signature is copied  if  the
139              same  signature  type is configurted on both domains.  The parts
140              of the T10-DIF are compared and handled independetly.
141
142              If MLX5DV_SIG_BLOCK_ATTR_FLAG_COPY_MASK is set the copy_mask at‐
143              tribute overrides the calculated value of the copy mask.  Other‐
144              wise, copy_mask is ignored.
145
146              Each bit of copy_mask corresponds to a  byte  of  the  signature
147              field.   If  corresponding  bit in copy_mask is set, byte of the
148              signature is copied from the input domain to the output  domain.
149              Calculation  according to the output domain configuration is not
150              performed in this case.  Bits not relevant to the signature type
151              are ignored.  copy_mask may be used only if input and output do‐
152              mains have the same structure, i.e. same block size  and  signa‐
153              ture    type.     The    MKEY   configuration   will   fail   if
154              MLX5DV_SIG_BLOCK_ATTR_FLAG_COPY_MASK is set but the domains have
155              different signature structures.
156
157              The  predefined masks are available in enum mlx5dv_sig_mask.  It
158              is also supported to specify a user-defined  mask.   Follow  the
159              table in check_mask description to define a custom mask.
160
161              copy_mask can be useful when some bytes of the signature are not
162              known in advance, hence can’t be  checked,  but  shall  be  pre‐
163              served.   In  this  case corresponding bits should be cleared in
164              check_mask and set in copy_mask.
165
166       comp_mask
167              Reserved for future extension, must be 0 now.
168
169   Block signature domain
170              struct mlx5dv_sig_block_domain {
171                  enum mlx5dv_sig_type sig_type;
172                  union {
173                      const struct mlx5dv_sig_t10dif *dif;
174                      const struct mlx5dv_sig_crc *crc;
175                  } sig;
176                  enum mlx5dv_block_size block_size;
177                  uint64_t comp_mask;
178              };
179
180       sig_type
181              The signature type for this domain, one of the following
182
183              MLX5DV_SIG_TYPE_T10DIF
184                     The block-level data protection defined in the T10 speci‐
185                     fications (T10 SBC-3).
186
187              MLX5DV_SIG_TYPE_CRC
188                     The block-level data protection based on cyclic redundan‐
189                     cy check (CRC).  The specific type of CRC is  defined  in
190                     sig.
191
192       sig    Depending  on  sig_type, this is the per signature type specific
193              configuration.
194
195       block_size
196              The   block   size   for    this    domain,    one    of    enum
197              mlx5dv_sig_block_size.
198
199       comp_mask
200              Reserved for future extension, must be 0 now.
201
202   CRC signature
203              struct mlx5dv_sig_crc {
204                  enum mlx5dv_sig_crc_type type;
205                  uint64_t seed;
206              };
207
208       type   The specific CRC type, one of the following.
209
210              MLX5DV_SIG_CRC_TYPE_CRC32
211                     CRC32  signature  is  created by calculating a 32-bit CRC
212                     defined in Fibre Channel Physical and Signaling Interface
213                     (FC-PH), ANSI X3.230:1994.
214
215              MLX5DV_SIG_CRC_TYPE_CRC32C
216                     CRC32C  signature  is created by calculating a 32-bit CRC
217                     called the Castagnoli CRC, defined in the Internet  Small
218                     Computer Systems Interface (iSCSI) rfc3720.
219
220              MLX5DV_SIG_CRC_TYPE_CRC64_XP10
221                     CRC64_XP10  signature  is created by calculating a 64-bit
222                     CRC defined in Microsoft XP10 compression standard.
223
224       seed   A seed for the CRC calculation per block.  Bits not relevant  to
225              the  CRC  type  are ignored.  For example, all bits are used for
226              CRC64_XP10, but only the 32 least significant bits are used  for
227              CRC32/CRC32C.
228
229              Only  the following values are supported as a seed: CRC32/CRC32C
230              -     0,     0xFFFFFFFF(UINT32_MAX);     CRC64_XP10     -     0,
231              0xFFFFFFFFFFFFFFFF(UINT64_MAX).
232
233   T10DIF signature
234       T10DIF  signature  is defined in the T10 specifications (T10 SBC-3) for
235       block-level data protection.  The  size  of  data  block  protected  by
236       T10DIF  must be modulo 8bytes as required in the T10DIF specifications.
237       Note that when setting the initial LBA value to ref_tag, it  should  be
238       the value of the first block to be transmitted.
239
240              struct mlx5dv_sig_t10dif {
241                  enum mlx5dv_sig_t10dif_bg_type bg_type;
242                  uint16_t bg;
243                  uint16_t app_tag;
244                  uint32_t ref_tag;
245                  uint16_t flags;
246              };
247
248       bg_type
249              The block guard type to be used, one of the following.
250
251              MLX5DV_SIG_T10DIF_CRC
252                     Use  CRC  in  the  block  guard  field as required in the
253                     T10DIF specifications.
254
255              MLX5DV_SIG_T10DIF_CSUM
256                     Use IP checksum instead of CRC in the block guard field.
257
258       bg     A seed for the block guard calculation per block.
259
260              The   following   values   are   supported   as   a   seed:   0,
261              0xFFFF(UINT16_MAX).
262
263       app_tag
264              An application tag to generate or validate.
265
266       ref_tag
267              A reference tag to generate or validate.
268
269       flags  Flags for the T10DIF attributes, one of the following.
270
271              MLX5DV_SIG_T10DIF_FLAG_REF_REMAP
272                     Increment reference tag per block.
273
274              MLX5DV_SIG_T10DIF_FLAG_APP_ESCAPE
275                     Do not check block guard if application tag is 0xFFFF.
276
277              MLX5DV_SIG_T10DIF_FLAG_APP_REF_ESCAPE
278                     Do not check block guard if application tag is 0xFFFF and
279                     reference tag is 0xFFFFFFFF.
280

RETURN VALUE

282       This function does not return a value.
283
284       In case of error, user will be notified later when  completing  the  DV
285       WRs chain.
286

Notes

288       A DEVX context should be opened by using mlx5dv_open_device(3).
289
290       MKEY  must  be created with MLX5DV_MKEY_INIT_ATTR_FLAGS_BLOCK_SIGNATURE
291       flag.
292
293       The  last   operation   posted   on   the   supplied   QP   should   be
294       mlx5dv_wr_mkey_configure(3), or one of its related setters, and the op‐
295       eration must still be open (no doorbell issued).
296
297       In case of ibv_wr_complete() failure or calling to ibv_wr_abort(),  the
298       MKey  may  be  left  in an unknown state.  The next configuration of it
299       should not assume any previous state of the MKey, i.e. signature/crypto
300       should  be  re-configured or reset, as required.  For example, assuming
301       mlx5dv_wr_set_mkey_sig_block() and  then  ibv_wr_abort()  were  called,
302       then on the next configuration of the MKey, if signature is not needed,
303       it should be reset using MLX5DV_MKEY_CONF_FLAG_RESET_SIG_ATTR.
304

SEE ALSO

306       mlx5dv_wr_mkey_configure(3),     mlx5dv_create_mkey(3),      mlx5dv_de‐
307       stroy_mkey(3)
308

AUTHORS

310       Oren Duer <oren@nvidia.com>
311
312       Sergey Gorenko <sergeygo@nvidia.com>
313
314
315
316                                               mlx5dv_wr_set_mkey_sig_block(3)
Impressum