Debian Codegraph @

src/nvme/api-types.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /*
3 * Types used as part of the libnvme/libnvme-mi API, rather than specified
4 * by the NVM Express specification.
5 *
6 * These are shared across both libnvme and libnvme-mi interfaces.
7 *
8 * This file is part of libnvme.
9 * Copyright (c) 2022 Code Construct
10 *
11 * Authors: Jeremy Kerr <[email protected]>
12 */
13 #ifndef _LIBNVME_API_TYPES_H
14 #define _LIBNVME_API_TYPES_H
15
16 #include <stdbool.h>
17
18 #include <nvme/types.h>
19
20 /*
21 * _args struct definitions. These are used by both the ioctl-based and
22 * MI-based interfaces, as the call interface for (admin/io/etc) NVMe commands,
23 * passed to the nvme_*() and nvme_mi_*() functions.
24 *
25 * On MI-based interfaces, the fd and timeout members are unused, and should
26 * be set to zero.
27 */
28
29 /**
30 * struct nvme_identify_args - Arguments for the NVMe Identify command
31 * @result: The command completion result from CQE dword0
32 * @data: User space destination address to transfer the data
33 * @args_size: Size of &struct nvme_identify_args
34 * @fd: File descriptor of nvme device
35 * @timeout: Timeout in ms (0 for default timeout)
36 * @cns: The Controller or Namespace structure, see @enum nvme_identify_cns
37 * @csi: Command Set Identifier
38 * @nsid: Namespace identifier, if applicable
39 * @cntid: The Controller Identifier, if applicable
40 * @cns_specific_id: Identifier that is required for a particular CNS value
41 * @uuidx: UUID Index if controller supports this id selection method
42 */
43 struct nvme_identify_args {
44 __u32 *result;
45 void *data;
46 int args_size;
47 int fd;
48 __u32 timeout;
49 enum nvme_identify_cns cns;
50 enum nvme_csi csi;
51 __u32 nsid;
52 __u16 cntid;
53 __u16 cns_specific_id;
54 __u8 uuidx;
55 };
56
57 /**
58 * struct nvme_get_log_args - Arguments for the NVMe Admin Get Log command
59 * @lpo: Log page offset for partial log transfers
60 * @result: The command completion result from CQE dword0
61 * @log: User space destination address to transfer the data
62 * @args_size: Length of the structure
63 * @fd: File descriptor of nvme device
64 * @timeout: Timeout in ms
65 * @lid: Log page identifier, see &enum nvme_cmd_get_log_lid for known
66 * values
67 * @len: Length of provided user buffer to hold the log data in bytes
68 * @nsid: Namespace identifier, if applicable
69 * @csi: Command set identifier, see &enum nvme_csi for known values
70 * @lsi: Log Specific Identifier
71 * @lsp: Log specific field
72 * @uuidx: UUID selection, if supported
73 * @rae: Retain asynchronous events
74 * @ot: Offset Type; if set @lpo specifies the index into the list
75 * of data structures, otherwise @lpo specifies the byte offset
76 * into the log page.
77 */
78 struct nvme_get_log_args {
79 __u64 lpo;
80 __u32 *result;
81 void *log;
82 int args_size;
83 int fd;
84 __u32 timeout;
85 enum nvme_cmd_get_log_lid lid;
86 __u32 len;
87 __u32 nsid;
88 enum nvme_csi csi;
89 __u16 lsi;
90 __u8 lsp;
91 __u8 uuidx;
92 bool rae;
93 bool ot;
94 };
95
96 /**
97 * struct nvme_set_features_args - Arguments for the NVMe Admin Set Feature command
98 * @result: The command completion result from CQE dword0
99 * @data: User address of feature data, if applicable
100 * @args_size: Size of &struct nvme_set_features_args
101 * @fd: File descriptor of nvme device
102 * @timeout: Timeout in ms
103 * @nsid: Namespace ID, if applicable
104 * @cdw11: Value to set the feature to
105 * @cdw12: Feature specific command dword12 field
106 * @cdw13: Feature specific command dword13 field
107 * @cdw15: Feature specific command dword15 field
108 * @data_len: Length of feature data, if applicable, in bytes
109 * @save: Save value across power states
110 * @uuidx: UUID Index for differentiating vendor specific encoding
111 * @fid: Feature identifier
112 */
113 struct nvme_set_features_args {
114 __u32 *result;
115 void *data;
116 int args_size;
117 int fd;
118 __u32 timeout;
119 __u32 nsid;
120 __u32 cdw11;
121 __u32 cdw12;
122 __u32 cdw13;
123 __u32 cdw15;
124 __u32 data_len;
125 bool save;
126 __u8 uuidx;
127 __u8 fid;
128 };
129
130 /**
131 * struct nvme_get_features_args - Arguments for the NVMe Admin Get Feature command
132 * @args_size: Size of &struct nvme_get_features_args
133 * @fd: File descriptor of nvme device
134 * @result: The command completion result from CQE dword0
135 * @timeout: Timeout in ms
136 * @nsid: Namespace ID, if applicable
137 * @sel: Select which type of attribute to return,
138 * see &enum nvme_get_features_sel
139 * @cdw11: Feature specific command dword11 field
140 * @data_len: Length of feature data, if applicable, in bytes
141 * @data: User address of feature data, if applicable
142 * @fid: Feature identifier, see &enum nvme_features_id
143 * @uuidx: UUID Index for differentiating vendor specific encoding
144 */
145 struct nvme_get_features_args {
146 __u32 *result;
147 void *data;
148 int args_size;
149 int fd;
150 __u32 timeout;
151 __u32 nsid;
152 enum nvme_get_features_sel sel;
153 __u32 cdw11;
154 __u32 data_len;
155 __u8 fid;
156 __u8 uuidx;
157 };
158
159 /**
160 * struct nvme_format_nvm_args - Arguments for the Format Nvme Namespace command
161 * @result: The command completion result from CQE dword0
162 * @args_size: Size of &struct nvme_format_nvm_args
163 * @fd: File descriptor of nvme device
164 * @timeout: Set to override default timeout to this value in milliseconds;
165 * useful for long running formats. 0 will use system default.
166 * @nsid: Namespace ID to format
167 * @mset: Metadata settings (extended or separated), true if extended
168 * @pi: Protection information type
169 * @pil: Protection information location (beginning or end), true if end
170 * @ses: Secure erase settings
171 * @lbaf: Logical block address format least significant 4 bits
172 * @rsvd1: Reserved
173 * @lbafu: Logical block address format most significant 2 bits
174 */
175 struct nvme_format_nvm_args {
176 __u32 *result;
177 int args_size;
178 int fd;
179 __u32 timeout;
180 __u32 nsid;
181 enum nvme_cmd_format_mset mset;
182 enum nvme_cmd_format_pi pi;
183 enum nvme_cmd_format_pil pil;
184 enum nvme_cmd_format_ses ses;
185 __u8 lbaf;
186 __u8 rsvd1[7];
187 __u8 lbafu;
188 };
189
190 /**
191 * struct nvme_ns_mgmt_args - Arguments for NVMe Namespace Management command
192 * @result: NVMe command result
193 * @ns: Namespace identification descriptors
194 * @args_size: Size of &struct nvme_ns_mgmt_args
195 * @fd: File descriptor of nvme device
196 * @timeout: Timeout in ms
197 * @nsid: Namespace identifier
198 * @sel: Type of management operation to perform
199 * @csi: Command Set Identifier
200 * @rsvd1: Reserved
201 * @rsvd2: Reserved
202 * @data: Host Software Specified Fields
203 */
204 struct nvme_ns_mgmt_args {
205 __u32 *result;
206 struct nvme_id_ns *ns;
207 int args_size;
208 int fd;
209 __u32 timeout;
210 __u32 nsid;
211 enum nvme_ns_mgmt_sel sel;
212 __u8 csi;
213 __u8 rsvd1[3];
214 void *rsvd2;
215 struct nvme_ns_mgmt_host_sw_specified *data;
216 };
217
218 /**
219 * struct nvme_ns_attach_args - Arguments for Nvme Namespace Management command
220 * @result: NVMe command result
221 * @ctrlist: Controller list to modify attachment state of nsid
222 * @args_size: Size of &struct nvme_ns_attach_args
223 * @fd: File descriptor of nvme device
224 * @timeout: Timeout in ms
225 * @nsid: Namespace ID to execute attach selection
226 * @sel: Attachment selection, see &enum nvme_ns_attach_sel
227 */
228 struct nvme_ns_attach_args {
229 __u32 *result;
230 struct nvme_ctrl_list *ctrlist;
231 int args_size;
232 int fd;
233 __u32 timeout;
234 __u32 nsid;
235 enum nvme_ns_attach_sel sel;
236 };
237
238 /**
239 * struct nvme_fw_download_args - Arguments for the NVMe Firmware Download command
240 * @args_size: Size of &struct nvme_fw_download_args
241 * @fd: File descriptor of nvme device
242 * @result: The command completion result from CQE dword0
243 * @timeout: Timeout in ms
244 * @offset: Offset in the firmware data
245 * @data: Userspace address of the firmware data
246 * @data_len: Length of data in this command in bytes
247 */
248 struct nvme_fw_download_args {
249 __u32 *result;
250 void *data;
251 int args_size;
252 int fd;
253 __u32 timeout;
254 __u32 offset;
255 __u32 data_len;
256 };
257
258 /**
259 * struct nvme_fw_commit_args - Arguments for the NVMe Firmware Commit command
260 * @args_size: Size of &struct nvme_fw_commit_args
261 * @fd: File descriptor of nvme device
262 * @action: Action to use for the firmware image, see &enum nvme_fw_commit_ca
263 * @timeout: Timeout in ms
264 * @result: The command completion result from CQE dword0
265 * @slot: Firmware slot to commit the downloaded image
266 * @bpid: Set to true to select the boot partition id
267 */
268 struct nvme_fw_commit_args {
269 __u32 *result;
270 int args_size;
271 int fd;
272 __u32 timeout;
273 enum nvme_fw_commit_ca action;
274 __u8 slot;
275 bool bpid;
276 };
277
278 /**
279 * struct nvme_security_send_args - Arguments for the NVMe Security Send command
280 * @result: The command completion result from CQE dword0
281 * @data: Security data payload to send
282 * @args_size: Size of &struct nvme_security_send_args
283 * @fd: File descriptor of nvme device
284 * @timeout: Timeout in ms
285 * @nsid: Namespace ID to issue security command on
286 * @tl: Protocol specific transfer length
287 * @data_len: Data length of the payload in bytes
288 * @nssf: NVMe Security Specific field
289 * @spsp0: Security Protocol Specific field
290 * @spsp1: Security Protocol Specific field
291 * @secp: Security Protocol
292 */
293 struct nvme_security_send_args {
294 __u32 *result;
295 void *data;
296 int args_size;
297 int fd;
298 __u32 timeout;
299 __u32 nsid;
300 __u32 tl;
301 __u32 data_len;
302 __u8 nssf;
303 __u8 spsp0;
304 __u8 spsp1;
305 __u8 secp;
306 };
307
308 /**
309 * struct nvme_security_receive_args - Arguments for the NVMe Security Receive command
310 * @result: The command completion result from CQE dword0
311 * @data: Security data payload to send
312 * @args_size: Size of &struct nvme_security_receive_args
313 * @fd: File descriptor of nvme device
314 * @timeout: Timeout in ms
315 * @nsid: Namespace ID to issue security command on
316 * @al: Protocol specific allocation length
317 * @data_len: Data length of the payload in bytes
318 * @nssf: NVMe Security Specific field
319 * @spsp0: Security Protocol Specific field
320 * @spsp1: Security Protocol Specific field
321 * @secp: Security Protocol
322 */
323 struct nvme_security_receive_args {
324 __u32 *result;
325 void *data;
326 int args_size;
327 int fd;
328 __u32 timeout;
329 __u32 nsid;
330 __u32 al;
331 __u32 data_len;
332 __u8 nssf;
333 __u8 spsp0;
334 __u8 spsp1;
335 __u8 secp;
336 };
337
338 /**
339 * struct nvme_get_lba_status_args - Arguments for the NVMe Get LBA Status command
340 * @lbas: Data payload to return status descriptors
341 * @result: The command completion result from CQE dword0
342 * @slba: Starting logical block address to check statuses
343 * @args_size: Size of &struct nvme_get_lba_status_args
344 * @fd: File descriptor of nvme device
345 * @timeout: Timeout in ms
346 * @nsid: Namespace ID to retrieve LBA status
347 * @mndw: Maximum number of dwords to return
348 * @atype: Action type mechanism to determine LBA status descriptors to
349 * return, see &enum nvme_lba_status_atype
350 * @rl: Range length from slba to perform the action
351 */
352 struct nvme_get_lba_status_args {
353 __u64 slba;
354 __u32 *result;
355 struct nvme_lba_status *lbas;
356 int args_size;
357 int fd;
358 __u32 timeout;
359 __u32 nsid;
360 __u32 mndw;
361 enum nvme_lba_status_atype atype;
362 __u16 rl;
363 };
364
365 /**
366 * struct nvme_directive_send_args - Arguments for the NVMe Directive Send command
367 * @result: If successful, the CQE dword0 value
368 * @data: Data payload to be send
369 * @args_size: Size of &struct nvme_directive_send_args
370 * @fd: File descriptor of nvme device
371 * @timeout: Timeout in ms
372 * @nsid: Namespace ID, if applicable
373 * @doper: Directive send operation, see &enum nvme_directive_send_doper
374 * @dtype: Directive type, see &enum nvme_directive_dtype
375 * @cdw12: Directive specific command dword12
376 * @data_len: Length of data payload in bytes
377 * @dspec: Directive specific field
378 */
379 struct nvme_directive_send_args {
380 __u32 *result;
381 void *data;
382 int args_size;
383 int fd;
384 __u32 timeout;
385 __u32 nsid;
386 enum nvme_directive_send_doper doper;
387 enum nvme_directive_dtype dtype;
388 __u32 cdw12;
389 __u32 data_len;
390 __u16 dspec;
391 };
392
393 /**
394 * struct nvme_directive_recv_args - Arguments for the NVMe Directive Receive command
395 * @result: If successful, the CQE dword0 value
396 * @data: Userspace address of data payload
397 * @args_size: Size of &struct nvme_directive_recv_args
398 * @fd: File descriptor of nvme device
399 * @timeout: Timeout in ms
400 * @nsid: Namespace ID, if applicable
401 * @doper: Directive send operation, see &enum nvme_directive_send_doper
402 * @dtype: Directive type, see &enum nvme_directive_dtype
403 * @cdw12: Directive specific command dword12
404 * @data_len: Length of data payload in bytes
405 * @dspec: Directive specific field
406 */
407 struct nvme_directive_recv_args {
408 __u32 *result;
409 void *data;
410 int args_size;
411 int fd;
412 __u32 timeout;
413 __u32 nsid;
414 enum nvme_directive_receive_doper doper;
415 enum nvme_directive_dtype dtype;
416 __u32 cdw12;
417 __u32 data_len;
418 __u16 dspec;
419 };
420
421 /**
422 * struct nvme_capacity_mgmt_args - Arguments for the NVMe Capacity Management command
423 * @result: If successful, the CQE dword0 value
424 * @args_size: Size of &struct nvme_capacity_mgmt_args
425 * @fd: File descriptor of nvme device
426 * @cdw11: Least significant 32 bits of the capacity in bytes of the
427 * Endurance Group or NVM Set to be created
428 * @cdw12: Most significant 32 bits of the capacity in bytes of the
429 * Endurance Group or NVM Set to be created
430 * @timeout: Timeout in ms
431 * @element_id: Value specific to the value of the Operation field
432 * @op: Operation to be performed by the controller
433 */
434 struct nvme_capacity_mgmt_args {
435 __u32 *result;
436 int args_size;
437 int fd;
438 __u32 timeout;
439 __u32 cdw11;
440 __u32 cdw12;
441 __u16 element_id;
442 __u8 op;
443 };
444
445 /**
446 * struct nvme_lockdown_args - Arguments for the NVME Lockdown command
447 * @args_size: Size of &struct nvme_lockdown_args
448 * @fd: File descriptor of nvme device
449 * @result: The command completion result from CQE dword0
450 * @timeout: Timeout in ms (0 for default timeout)
451 * @scp: Scope of the command
452 * @prhbt: Prohibit or allow the command opcode or Set Features command
453 * @ifc: Affected interface
454 * @ofi: Opcode or Feature Identifier
455 * @uuidx: UUID Index if controller supports this id selection method
456 */
457 struct nvme_lockdown_args {
458 __u32 *result;
459 int args_size;
460 int fd;
461 __u32 timeout;
462 __u8 scp;
463 __u8 prhbt;
464 __u8 ifc;
465 __u8 ofi;
466 __u8 uuidx;
467 };
468
469 /**
470 * struct nvme_set_property_args - Arguments for NVMe Set Property command
471 * @args_size: Size of &struct nvme_set_property_args
472 * @fd: File descriptor of nvme device
473 * @result: The command completion result from CQE dword0
474 * @timeout: Timeout in ms
475 * @offset: Property offset from the base to set
476 * @value: The value to set the property
477 */
478 struct nvme_set_property_args {
479 __u64 value;
480 __u32 *result;
481 int args_size;
482 int fd;
483 __u32 timeout;
484 int offset;
485 };
486
487 /**
488 * struct nvme_get_property_args - Arguments for NVMe Get Property command
489 * @value: Where the property's value will be stored on success
490 * @args_size: Size of &struct nvme_get_property_args
491 * @fd: File descriptor of nvme device
492 * @offset: Property offset from the base to retrieve
493 * @timeout: Timeout in ms
494 */
495 struct nvme_get_property_args {
496 __u64 *value;
497 int args_size;
498 int fd;
499 __u32 timeout;
500 int offset;
501 };
502
503 /**
504 * struct nvme_sanitize_nvm_args - Arguments for the NVMe Sanitize NVM command
505 * @result: The command completion result from CQE dword0
506 * @args_size: Size of &struct nvme_sanitize_nvm_args
507 * @fd: File descriptor of nvme device
508 * @timeout: Timeout in ms
509 * @ovrpat: Overwrite pattern
510 * @sanact: Sanitize action, see &enum nvme_sanitize_sanact
511 * @ause: Set to allow unrestricted sanitize exit
512 * @owpass: Overwrite pass count
513 * @oipbp: Set to overwrite invert pattern between passes
514 * @nodas: Set to not deallocate blocks after sanitizing
515 * @emvs: Set to enter media verification state
516 */
517 struct nvme_sanitize_nvm_args {
518 __u32 *result;
519 int args_size;
520 int fd;
521 __u32 timeout;
522 enum nvme_sanitize_sanact sanact;
523 __u32 ovrpat;
524 bool ause;
525 __u8 owpass;
526 bool oipbp;
527 bool nodas;
528 bool emvs;
529 };
530
531 /**
532 * struct nvme_dev_self_test_args - Arguments for the NVMe Device Self Test command
533 * @result: The command completion result from CQE dword0
534 * @args_size: Size of &struct nvme_dev_self_test_args
535 * @fd: File descriptor of nvme device
536 * @nsid: Namespace ID to test
537 * @stc: Self test code, see &enum nvme_dst_stc
538 * @timeout: Timeout in ms
539 */
540 struct nvme_dev_self_test_args {
541 __u32 *result;
542 int args_size;
543 int fd;
544 __u32 timeout;
545 __u32 nsid;
546 enum nvme_dst_stc stc;
547 };
548
549 /**
550 * struct nvme_virtual_mgmt_args - Arguments for the NVMe Virtualization
551 * resource management command
552 * @args_size: Size of &struct nvme_virtual_mgmt_args
553 * @fd: File descriptor of nvme device
554 * @result: If successful, the CQE dword0
555 * @timeout: Timeout in ms
556 * @act: Virtual resource action, see &enum nvme_virt_mgmt_act
557 * @rt: Resource type to modify, see &enum nvme_virt_mgmt_rt
558 * @cntlid: Controller id for which resources are bing modified
559 * @nr: Number of resources being allocated or assigned
560 */
561 struct nvme_virtual_mgmt_args {
562 __u32 *result;
563 int args_size;
564 int fd;
565 __u32 timeout;
566 enum nvme_virt_mgmt_act act;
567 enum nvme_virt_mgmt_rt rt;
568 __u16 cntlid;
569 __u16 nr;
570 };
571
572 /**
573 * struct nvme_io_args - Arguments for NVMe I/O commands
574 * @slba: Starting logical block
575 * @storage_tag: This filed specifies Variable Sized Expected Logical Block
576 * Storage Tag (ELBST) or Logical Block Storage Tag (LBST)
577 * @result: The command completion result from CQE dword0
578 * @data: Pointer to user address of the data buffer
579 * @metadata: Pointer to user address of the metadata buffer
580 * @args_size: Size of &struct nvme_io_args
581 * @fd: File descriptor of nvme device
582 * @timeout: Timeout in ms
583 * @nsid: Namespace ID
584 * @data_len: Length of user buffer, @data, in bytes
585 * @metadata_len:Length of user buffer, @metadata, in bytes
586 * @nlb: Number of logical blocks to send (0's based value)
587 * @control: Command control flags, see &enum nvme_io_control_flags.
588 * @apptag: This field specifies the Application Tag Mask expected value.
589 * Used only if the namespace is formatted to use end-to-end
590 * protection information.
591 * @appmask: This field specifies the Application Tag expected value. Used
592 * only if the namespace is formatted to use end-to-end protection
593 * information.
594 * @reftag: This field specifies the variable sized Expected Initial
595 * Logical Block Reference Tag (EILBRT) or Initial Logical Block
596 * Reference Tag (ILBRT). Used only if the namespace is formatted
597 * to use end-to-end protection information.
598 * @dspec: Directive specific value
599 * @dsm: Data set management attributes, see &enum nvme_io_dsm_flags
600 * @rsvd1: Reserved
601 * @reftag_u64: This field specifies the variable sized Expected Initial
602 * Logical Block Reference Tag (EILBRT) or Initial Logical Block
603 * Reference Tag (ILBRT). It is the 8 byte version required for
604 * enhanced protection information. Used only if the namespace is
605 * formatted to use end-to-end protection information.
606 * @sts: Storage tag size in bits, set by namespace Extended LBA Format
607 * @pif: Protection information format, determines how variable sized
608 * storage_tag and reftag are put into dwords 2, 3, and 14. Set by
609 * namespace Extended LBA Format.
610 */
611 struct nvme_io_args {
612 __u64 slba;
613 __u64 storage_tag;
614 __u32 *result;
615 void *data;
616 void *metadata;
617 int args_size;
618 int fd;
619 __u32 timeout;
620 __u32 nsid;
621 __u32 reftag;
622 __u32 data_len;
623 __u32 metadata_len;
624 __u16 nlb;
625 __u16 control;
626 __u16 apptag;
627 __u16 appmask;
628 __u16 dspec;
629 __u8 dsm;
630 __u8 rsvd1[1];
631 __u64 reftag_u64;
632 __u8 sts;
633 __u8 pif;
634 };
635
636 /**
637 * struct nvme_dsm_args - Arguments for the NVMe Dataset Management command
638 * @result: The command completion result from CQE dword0
639 * @dsm: The data set management attributes
640 * @args_size: Size of &struct nvme_dsm_args
641 * @fd: File descriptor of nvme device
642 * @timeout: Timeout in ms
643 * @nsid: Namespace identifier
644 * @attrs: DSM attributes, see &enum nvme_dsm_attributes
645 * @nr_ranges: Number of block ranges in the data set management attributes
646 */
647 struct nvme_dsm_args {
648 __u32 *result;
649 struct nvme_dsm_range *dsm;
650 int args_size;
651 int fd;
652 __u32 timeout;
653 __u32 nsid;
654 __u32 attrs;
655 __u16 nr_ranges;
656 };
657
658 /**
659 * struct nvme_copy_args - Arguments for the NVMe Copy command
660 * @sdlba: Start destination LBA
661 * @result: The command completion result from CQE dword0
662 * @copy: Range description
663 * @args_size: Size of &struct nvme_copy_args
664 * @fd: File descriptor of the nvme device
665 * @timeout: Timeout in ms
666 * @nsid: Namespace identifier
667 * @ilbrt: Initial logical block reference tag
668 * @lr: Limited retry
669 * @fua: Force unit access
670 * @nr: Number of ranges
671 * @dspec: Directive specific value
672 * @lbatm: Logical block application tag mask
673 * @lbat: Logical block application tag
674 * @prinfor: Protection information field for read
675 * @prinfow: Protection information field for write
676 * @dtype: Directive type
677 * @format: Descriptor format
678 * @ilbrt_u64: Initial logical block reference tag - 8 byte
679 * version required for enhanced protection info
680 */
681 struct nvme_copy_args {
682 __u64 sdlba;
683 __u32 *result;
684 struct nvme_copy_range *copy;
685 int args_size;
686 int fd;
687 __u32 timeout;
688 __u32 nsid;
689 __u32 ilbrt;
690 int lr;
691 int fua;
692 __u16 nr;
693 __u16 dspec;
694 __u16 lbatm;
695 __u16 lbat;
696 __u8 prinfor;
697 __u8 prinfow;
698 __u8 dtype;
699 __u8 format;
700 __u64 ilbrt_u64;
701 };
702
703 /**
704 * struct nvme_resv_acquire_args - Arguments for the NVMe Reservation Acquire Command
705 * @nrkey: The reservation key to be unregistered from the namespace if
706 * the action is preempt
707 * @iekey: Set to ignore the existing key
708 * @result: The command completion result from CQE dword0
709 * @args_size: Size of &struct nvme_resv_acquire_args
710 * @fd: File descriptor of nvme device
711 * @timeout: Timeout in ms
712 * @nsid: Namespace identifier
713 * @rtype: The type of reservation to be create, see &enum nvme_resv_rtype
714 * @racqa: The action that is performed by the command, see &enum nvme_resv_racqa
715 * @crkey: The current reservation key associated with the host
716 */
717 struct nvme_resv_acquire_args {
718 __u64 crkey;
719 __u64 nrkey;
720 __u32 *result;
721 int args_size;
722 int fd;
723 __u32 timeout;
724 __u32 nsid;
725 enum nvme_resv_rtype rtype;
726 enum nvme_resv_racqa racqa;
727 bool iekey;
728 };
729
730 /**
731 * struct nvme_resv_register_args - Arguments for the NVMe Reservation Register command
732 * @crkey: The current reservation key associated with the host
733 * @nrkey: The new reservation key to be register if action is register or
734 * replace
735 * @result: The command completion result from CQE dword0
736 * @args_size: Size of &struct nvme_resv_register_args
737 * @fd: File descriptor of nvme device
738 * @nsid: Namespace identifier
739 * @rrega: The registration action, see &enum nvme_resv_rrega
740 * @cptpl: Change persist through power loss, see &enum nvme_resv_cptpl
741 * @iekey: Set to ignore the existing key
742 * @timeout: Timeout in ms
743 */
744 struct nvme_resv_register_args {
745 __u64 crkey;
746 __u64 nrkey;
747 __u32 *result;
748 int args_size;
749 int fd;
750 __u32 timeout;
751 __u32 nsid;
752 enum nvme_resv_rrega rrega;
753 enum nvme_resv_cptpl cptpl;
754 bool iekey;
755 };
756
757 /**
758 * struct nvme_resv_release_args - Arguments for the NVMe Reservation Release Command
759 * @crkey: The current reservation key to release
760 * @result: The command completion result from CQE dword0
761 * @args_size: Size of &struct nvme_resv_release_args
762 * @fd: File descriptor of nvme device
763 * @timeout: Timeout in ms
764 * @nsid: Namespace identifier
765 * @rtype: The type of reservation to be create, see &enum nvme_resv_rtype
766 * @rrela: Reservation release action, see &enum nvme_resv_rrela
767 * @iekey: Set to ignore the existing key
768 */
769 struct nvme_resv_release_args {
770 __u64 crkey;
771 __u32 *result;
772 int args_size;
773 int fd;
774 __u32 timeout;
775 __u32 nsid;
776 enum nvme_resv_rtype rtype;
777 enum nvme_resv_rrela rrela;
778 bool iekey;
779 };
780
781 /**
782 * struct nvme_resv_report_args - Arguments for the NVMe Reservation Report command
783 * @result: The command completion result from CQE dword0
784 * @report: The user space destination address to store the reservation
785 * report
786 * @args_size: Size of &struct nvme_resv_report_args
787 * @fd: File descriptor of nvme device
788 * @timeout: Timeout in ms
789 * @nsid: Namespace identifier
790 * @len: Number of bytes to request transferred with this command
791 * @eds: Request extended Data Structure
792 */
793 struct nvme_resv_report_args {
794 __u32 *result;
795 struct nvme_resv_status *report;
796 int args_size;
797 int fd;
798 __u32 timeout;
799 __u32 nsid;
800 __u32 len;
801 bool eds;
802 };
803
804 /**
805 * struct nvme_io_mgmt_recv_args - Arguments for the NVMe I/O Management Receive command
806 * @data: Userspace address of the data
807 * @args_size: Size of &struct nvme_io_mgmt_recv_args
808 * @fd: File descriptor of nvme device
809 * @nsid: Namespace identifier
810 * @data_len: Length of @data
811 * @timeout: Timeout in ms
812 * @mos: Management Operation Specific
813 * @mo: Management Operation
814 */
815 struct nvme_io_mgmt_recv_args {
816 void *data;
817 int args_size;
818 int fd;
819 __u32 nsid;
820 __u32 data_len;
821 __u32 timeout;
822 __u16 mos;
823 __u8 mo;
824 };
825
826 /**
827 * struct nvme_io_mgmt_send_args - Arguments for the NVMe I/O Management Send command
828 * @data: Userspace address of the data
829 * @args_size: Size of &struct nvme_io_mgmt_send_args
830 * @fd: File descriptor of nvme device
831 * @nsid: Namespace identifier
832 * @data_len: Length of @data
833 * @timeout: Timeout in ms
834 * @mos: Management Operation Specific
835 * @mo: Management Operation
836 */
837 struct nvme_io_mgmt_send_args {
838 void *data;
839 int args_size;
840 int fd;
841 __u32 nsid;
842 __u32 data_len;
843 __u32 timeout;
844 __u16 mos;
845 __u8 mo;
846 };
847
848 /**
849 * struct nvme_zns_mgmt_send_args - Arguments for the NVMe ZNS Management Send command
850 * @slba: Starting logical block address
851 * @result: The command completion result from CQE dword0
852 * @data: Userspace address of the data
853 * @args_size: Size of &struct nvme_zns_mgmt_send_args
854 * @fd: File descriptor of nvme device
855 * @timeout: timeout in ms
856 * @nsid: Namespace ID
857 * @zsa: Zone send action
858 * @data_len: Length of @data
859 * @select_all: Select all flag
860 * @zsaso: Zone Send Action Specific Option
861 */
862 struct nvme_zns_mgmt_send_args {
863 __u64 slba;
864 __u32 *result;
865 void *data;
866 int args_size;
867 int fd;
868 __u32 timeout;
869 __u32 nsid;
870 enum nvme_zns_send_action zsa;
871 __u32 data_len;
872 bool select_all;
873 __u8 zsaso;
874 };
875
876 /**
877 * struct nvme_zns_mgmt_recv_args - Arguments for the NVMe ZNS Management Receive command
878 * @slba: Starting logical block address
879 * @result: The command completion result from CQE dword0
880 * @data: Userspace address of the data
881 * @args_size: Size of &struct nvme_zns_mgmt_recv_args
882 * @fd: File descriptor of nvme device
883 * @timeout: timeout in ms
884 * @nsid: Namespace ID
885 * @zra: zone receive action
886 * @data_len: Length of @data
887 * @zrasf: Zone receive action specific field
888 * @zras_feat: Zone receive action specific features
889 */
890 struct nvme_zns_mgmt_recv_args {
891 __u64 slba;
892 __u32 *result;
893 void *data;
894 int args_size;
895 int fd;
896 __u32 timeout;
897 __u32 nsid;
898 enum nvme_zns_recv_action zra;
899 __u32 data_len;
900 __u16 zrasf;
901 bool zras_feat;
902 };
903
904 /**
905 * struct nvme_zns_append_args - Arguments for the NVMe ZNS Append command
906 * @zslba: Zone start logical block address
907 * @result: The command completion result from CQE dword0
908 * @data: Userspace address of the data
909 * @metadata: Userspace address of the metadata
910 * @args_size: Size of &struct nvme_zns_append_args
911 * @fd: File descriptor of nvme device
912 * @timeout: Timeout in ms
913 * @nsid: Namespace ID
914 * @ilbrt: Initial logical block reference tag
915 * @data_len: Length of @data
916 * @metadata_len: Length of @metadata
917 * @nlb: Number of logical blocks
918 * @control:
919 * @lbat: Logical block application tag
920 * @lbatm: Logical block application tag mask
921 * @rsvd1: Reserved
922 * @ilbrt_u64: Initial logical block reference tag - 8 byte
923 * version required for enhanced protection info
924 *
925 */
926 struct nvme_zns_append_args {
927 __u64 zslba;
928 __u64 *result;
929 void *data;
930 void *metadata;
931 int args_size;
932 int fd;
933 __u32 timeout;
934 __u32 nsid;
935 __u32 ilbrt;
936 __u32 data_len;
937 __u32 metadata_len;
938 __u16 nlb;
939 __u16 control;
940 __u16 lbat;
941 __u16 lbatm;
942 __u8 rsvd1[4];
943 __u64 ilbrt_u64;
944 };
945
946 /**
947 * struct nvme_dim_args - Arguments for the Discovery Information Management (DIM) command
948 * @result: Set on completion to the command's CQE DWORD 0 controller response.
949 * @data: Pointer to the DIM data
950 * @args_size: Length of the structure
951 * @fd: File descriptor of nvme device
952 * @timeout: Timeout in ms
953 * @data_len: Length of @data
954 * @tas: Task field of the Command Dword 10 (cdw10)
955 */
956 struct nvme_dim_args {
957 __u32 *result;
958 void *data;
959 int args_size;
960 int fd;
961 __u32 timeout;
962 __u32 data_len;
963 __u8 tas;
964 };
965
966 /**
967 * struct nvme_lm_cdq_args - Arguments for Controller Data Queue (CDQ) command
968 * @result: Set on completion to the command's CQE DWORD 0 controller response
969 * @data: Pointer to data
970 * @args_size: Length of structure
971 * @fd: File descriptor of nvme device
972 * @timeout: Timeout in ms
973 * @mos: Management Operation Specific (MOS): This field is specific to the SEL type
974 * @cntlid: Controller ID: For Create CDQ, specifies the target migratable controller
975 * @cdqid: Controller Data Queue ID (CDQID): For Create CDQ, this field is the CDQID created
976 * by the controller if no error is present. For Delete CDQ, this field is the CDQID
977 * to delete.
978 * @sel: Select (SEL): This field specifies the type of management operation to perform.
979 * @sz_u8: For Create CDQ, specifies the size of CDQ, in dwords - 1 byte
980 * @rsvd1: Reserved
981 * @sz: For Create CDQ, specifies the size of CDQ, in dwords - 4 byte
982 */
983 struct nvme_lm_cdq_args {
984 __u32 *result;
985 void *data;
986 int args_size;
987 int fd;
988 __u32 timeout;
989 __u16 mos;
990 __u16 cntlid;
991 __u16 cdqid;
992 __u8 sel;
993 __u8 sz_u8;
994 __u8 rsvd1[4];
995 __u32 sz;
996 };
997
998 /**
999 * struct nvme_lm_track_send_args - Arguments for the Track Send command
1000 * @result: Set on completion to the command's CQE DWORD 0 controller response
1001 * @args_size: Length of structure
1002 * @fd: File descriptor of nvme device
1003 * @timeout: Timeout in ms
1004 * @mos: Management Operation Specific (MOS): This field is specific to the SEL type
1005 * @cdqid: Controller Data Queue ID (CDQID)
1006 * @sel: Select (SEL): This field specifies the type of management operation to perform
1007 */
1008 struct nvme_lm_track_send_args {
1009 __u32 *result;
1010 int args_size;
1011 int fd;
1012 __u32 timeout;
1013 __u16 mos;
1014 __u16 cdqid;
1015 __u8 sel;
1016 };
1017
1018 /**
1019 * struct nvme_lm_migration_send_args - Arguments for the Migration Send command
1020 * @offset: Offset: This field specifies the offset, in bytes, within the data available to be
1021 * returned and specifies the starting point for that data for what is actually
1022 * returned to the host.
1023 * @result: Set on completion to the command's CQE DWORD 0 controller response
1024 * @data: Pointer to data
1025 * @args_size: Length of structure
1026 * @fd: File descriptor of nvme device
1027 * @timeout: Timeout in ms
1028 * @numd: Number of Dwords (NUMD): This field specifies the number of dwords being transferred
1029 * @mos: Management Operation Specific (MOS): This field is specific to the SEL type
1030 * @cntlid: Controller ID: This field specifies the identifier of the controller to which the
1031 * operation is performed.
1032 * @csuuidi: Controller State UUID Index (CSUUIDI): A non-zero value in this field specifies the
1033 * index to a specific entry in the Vendor Specific Controller State UUID Supported.
1034 * list of the Supported Controller State Formats data structure.
1035 * @sel: Select (SEL): This field specifies the type of management operation to perform.
1036 * @uidx: UUID Index (UIDX): If this field is set to a non-zero value, then the value of this
1037 * field is the index of a UUID in the UUID List (refer to Figure 320) that is used by
1038 * the command.
1039 * @stype: Suspend Type (STYPE): This field specifies the type of suspend.
1040 * @seqind: Sequence Identifier (SEQIND): This field identified the sequences of this Migration
1041 * Send command in relation to other Migration Send commands.
1042 * @csvi: Controller State Version Index (CSVI): A non-zero value in this field specifies the
1043 * index to a specific entry in the NVMe Controller State Version list of the Supported
1044 * Controller State Formats data structure.
1045 * @dudmq: Delete User Data Migration Queue (DUDMQ): If set, the migration queue is deleted
1046 * is deleted as part of the Suspend operation. If cleared, it is retained.
1047 */
1048 struct nvme_lm_migration_send_args {
1049 __u64 offset;
1050 __u32 *result;
1051 void *data;
1052 int args_size;
1053 int fd;
1054 __u32 timeout;
1055 __u32 numd;
1056 __u16 mos;
1057 __u16 cntlid;
1058 __u16 csuuidi;
1059 __u8 sel;
1060 __u8 uidx;
1061 __u8 stype;
1062 __u8 seqind;
1063 __u8 csvi;
1064 bool dudmq;
1065 };
1066
1067 /**
1068 * struct nvme_lm_migration_recv_args - Arguments for the Migration Receive command
1069 * @offset: Offset: This field specifies the offset, in bytes, within the data available to be
1070 * returned and specifies the starting point for that data for what is actually
1071 * returned to the host.
1072 * @result: Set on completion to the command's CQE DWORD 0 controller response
1073 * @data: Pointer to data
1074 * @args_size: Length of structure
1075 * @fd: File descriptor of nvme device
1076 * @timeout: Timeout in ms
1077 * @numd: Number of Dwords (NUMD): This field specifies the number of dwords to return. This
1078 * is a 0's based value.
1079 * @mos: Management Operation Specific (MOS): This field is specific to the SEL type
1080 * @cntlid: Controller ID: This field specifies the identifier of the controller to which the
1081 * operation is performed.
1082 * @csuuidi: Controller State UUID Index (CSUUIDI): A non-zero value in this field specifies the
1083 * index to a specific entry in the Vendor Specific Controller State UUID Supported.
1084 * list of the Supported Controller State Formats data structure.
1085 * @sel: Select (SEL): This field specifies the type of management operation to perform
1086 * @uidx: UUID Index (UIDX): If this field is set to a non-zero value, then the value of this
1087 * field is the index of a UUID in the UUID List (refer to Figure 320) that is used by
1088 * the command.
1089 * @csuidxp: Controller State UUID Index Parameter (CSUIDXP): This field is vendor specific.
1090 */
1091 struct nvme_lm_migration_recv_args {
1092 __u64 offset;
1093 __u32 *result;
1094 void *data;
1095 int args_size;
1096 int fd;
1097 __u32 timeout;
1098 __u32 numd;
1099 __u16 mos;
1100 __u16 cntlid;
1101 __u16 csuuidi;
1102 __u8 sel;
1103 __u8 uidx;
1104 __u8 csuidxp;
1105 };
1106
1107 #endif /* _LIBNVME_API_TYPES_H */