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