mi-types.h - NVMe-MI wire protocol and messaging types
This file defines the wire protocol types for NVMe Management Interface (NVMe-MI) messaging and transport layer. These are the low-level message structures used for MCTP/MI communication between a host and NVMe devices.
Scope¶
MCTP message framing and headers
MI request/response message structures
MI command opcodes and protocol definitions
Admin command protocol over MI transport
Control primitives for MI communication
Asynchronous Event Messages (AEM)
Low-level transport and protocol details
This file is primarily used by the libnvme-mi library implementation and is internal to the MI transport layer.
Separation from nvme-types-mi.h¶
This file is separate from nvme-types-mi.h, which serves a different purpose:
mi-types.h (this file): Wire protocol, messaging, transport layer - Used by: mi.h (MI library internals) - Focus: How messages are sent/received over MCTP - Analogy: TCP/IP headers and framing
nvme-types-mi.h: NVMe-MI data structures from the MI specification - Used by: nvme-types.h (public API), applications - Focus: MI data payloads (controller info, health status, VPD) - Analogy: HTTP request/response bodies
-
NVME_MI_MSGTYPE_NVME¶
NVME_MI_MSGTYPE_NVME ()
MCTP message type for NVMe-MI messages.
Parameters
Description
This is defined by MCTP, but is referenced as part of the NVMe-MI message spec. This is the MCTP NVMe message type (0x4), with the message-integrity bit (0x80) set.
-
enum nvme_mi_message_type¶
NVMe-MI message type field.
Constants
NVME_MI_MT_CONTROLNVME-MI Control Primitive
NVME_MI_MT_MINVMe-MI command
NVME_MI_MT_ADMINNVMe Admin command
NVME_MI_MT_PCIEPCIe command
NVME_MI_MT_AEAsynchronous Event
Description
Used as byte 1 of both request and response messages (NMIMT bits of NMP byte). Not to be confused with the MCTP message type in byte 0.
-
enum nvme_mi_ror¶
Request or response field.
Constants
NVME_MI_ROR_REQrequest message
NVME_MI_ROR_RSPresponse message
-
enum nvme_mi_resp_status¶
values for the response status field
Constants
NVME_MI_RESP_SUCCESSsuccess
NVME_MI_RESP_MPRMore Processing Required
NVME_MI_RESP_INTERNAL_ERRInternal Error
NVME_MI_RESP_INVALID_OPCODEInvalid command opcode
NVME_MI_RESP_INVALID_PARAMInvalid command parameter
NVME_MI_RESP_INVALID_CMD_SIZEInvalid command size
NVME_MI_RESP_INVALID_INPUT_SIZEInvalid command input data size
NVME_MI_RESP_ACCESS_DENIEDAccess Denied
NVME_MI_RESP_VPD_UPDATES_EXCEEDEDMore VPD updates than allowed
NVME_MI_RESP_PCIE_INACCESSIBLEPCIe functionality currently unavailable
NVME_MI_RESP_MEB_SANITIZEDMEB has been cleared due to sanitize
NVME_MI_RESP_ENC_SERV_FAILUREEnclosure services process failed
NVME_MI_RESP_ENC_SERV_XFER_FAILURETransfer with enclosure services failed
NVME_MI_RESP_ENC_FAILUREUnreoverable enclosure failure
NVME_MI_RESP_ENC_XFER_REFUSEDEnclosure services transfer refused
NVME_MI_RESP_ENC_FUNC_UNSUPUnsupported enclosure services function
NVME_MI_RESP_ENC_SERV_UNAVAILEnclosure services unavailable
NVME_MI_RESP_ENC_DEGRADEDNoncritical failure detected by enc. services
NVME_MI_RESP_SANITIZE_IN_PROGRESSCommand prohibited during sanitize
-
struct nvme_mi_msg_hdr¶
General MI message header.
Definition
struct nvme_mi_msg_hdr {
__u8 type;
__u8 nmp;
__u8 meb;
__u8 rsvd0;
};
Members
typeMCTP message type, will always be NVME_MI_MSGTYPE_NVME
nmpNVMe-MI message parameters (including MI message type)
mebManagement Endpoint Buffer flag; unused for libnvme-mi implementation
rsvd0currently reserved
Description
Wire format shared by both request and response messages, per NVMe-MI section 3.1. This is used for all message types, MI and Admin.
-
struct nvme_mi_msg_resp¶
Generic response type.
Definition
struct nvme_mi_msg_resp {
struct nvme_mi_msg_hdr hdr;
__u8 status;
__u8 rsvd0[3];
};
Members
hdrthe general request/response message header
statusresponse status value (see
enum nvme_mi_resp_status)rsvd0reserved data, may be defined by specific response
Description
Every response will start with one of these; command-specific responses will define parts of the reserved data, and may add further fields.
-
enum nvme_mi_mi_opcode¶
Operation code for supported NVMe-MI commands.
Constants
nvme_mi_mi_opcode_mi_data_readRead NVMe-MI Data Structure
nvme_mi_mi_opcode_subsys_health_status_pollSubsystem Health Status Poll
nvme_mi_mi_opcode_configuration_setMI Configuration Set
nvme_mi_mi_opcode_configuration_getMI Configuration Get
-
struct nvme_mi_mi_req_hdr¶
MI request message header.
Definition
struct nvme_mi_mi_req_hdr {
struct nvme_mi_msg_hdr hdr;
__u8 opcode;
__u8 rsvd0[3];
__le32 cdw0, cdw1;
};
Members
hdrgeneric MI message header
opcodeopcode (OPC) for the specific MI command
rsvd0reserved bytes
cdw0Management Request Doubleword 0 - command specific usage
cdw1Management Request Doubleword 1 - command specific usage
Description
Wire format for MI request message headers, defined in section 5 of NVMe-MI.
-
struct nvme_mi_mi_resp_hdr¶
MI response message header.
Definition
struct nvme_mi_mi_resp_hdr {
struct nvme_mi_msg_hdr hdr;
__u8 status;
__u8 nmresp[3];
};
Members
hdrgeneric MI message header
statusgeneric response status from command; non-zero on failure.
nmrespNVMe Management Response: command-type-specific response data
Description
Wire format for MI response message header, defined in section 5 of NVMe-MI.
-
enum nvme_mi_dtyp¶
Data Structure Type field.
Constants
nvme_mi_dtyp_subsys_infoNVM Subsystem Information
nvme_mi_dtyp_port_infoPort information
nvme_mi_dtyp_ctrl_listController List
nvme_mi_dtyp_ctrl_infoController Information
nvme_mi_dtyp_opt_cmd_supportOptionally Supported Command List
nvme_mi_dtyp_meb_supportManagement Endpoint Buffer Command Support List
Description
Data Structure Type field for Read NVMe-MI Data Structure command, used to indicate the particular structure to query from the endpoint.
-
enum nvme_mi_config_id¶
NVMe-MI Configuration identifier.
Constants
NVME_MI_CONFIG_SMBUS_FREQCurrent SMBus/I2C frequency
NVME_MI_CONFIG_HEALTH_STATUS_CHANGEHealth Status change - used to clear health status bits in CCS bits of status poll. Only for Set ops.
NVME_MI_CONFIG_MCTP_MTUMCTP maximum transmission unit size of port specified in dw 0
NVME_MI_CONFIG_AEAsynchronous Events configuration Configuration parameters for the MI Get/Set Configuration commands.
Description
See :c:type:`nvme_mi_mi_config_get`() and :c:type:`nvme_mi_config_set`().
-
enum nvme_mi_config_smbus_freq¶
SMBus/I2C frequency values
Constants
NVME_MI_CONFIG_SMBUS_FREQ_100kHz100kHz
NVME_MI_CONFIG_SMBUS_FREQ_400kHz400kHz
NVME_MI_CONFIG_SMBUS_FREQ_1MHz1MHz
Description
Values used in the SMBus Frequency device configuration. See :c:type:`nvme_mi_mi_config_get_smbus_freq`() and :c:type:`nvme_mi_mi_config_set_smbus_freq`().
-
struct nvme_mi_aem_supported_list_header¶
Asynchronous Event Supported List Header.
Definition
struct nvme_mi_aem_supported_list_header {
__u8 numaes;
__u8 aeslver;
__le16 aest;
__u8 aeslhl;
};
Members
numaesNumber of AE supported data structures that follow the header
aeslverAE Supported List Version
aestAE Supported list length (including this header)
aeslhlAE Supported list header length
Description
This header preceeds a number, (numaes), of AE supported data structures
-
struct nvme_mi_aem_supported_item¶
AE Supported List Item
Definition
struct nvme_mi_aem_supported_item {
__u8 aesl;
__le16 aesi;
};
Members
aeslAE supported list item length
aesiAE supported info
Description
Following this header should be hdr.numaes entries of nvme_mi_aem_supported_item structures
-
bool nvme_mi_aem_aesi_get_aese(__le16 aesi)¶
return aese from aesi field
Parameters
__le16 aesiaesi field from nvme_mi_aem_supported_item
Return
A bool representing the aese value
-
__u8 nvme_mi_aem_aesi_get_aesid(__le16 aesi)¶
return aesid from aesi field
Parameters
__le16 aesiaesi field from nvme_mi_aem_supported_item
Return
aesid value
-
void nvme_mi_aem_aesi_set_aesid(struct nvme_mi_aem_supported_item *item, __u8 aesid)¶
set aesid in the aesi field
Parameters
struct nvme_mi_aem_supported_item *itemPointer to nvme_mi_aem_supported_item to update the aesi field
__u8 aesidaesid value to use
-
void nvme_mi_aem_aesi_set_aee(struct nvme_mi_aem_supported_item *item, bool enabled)¶
set aee in the aesi field
Parameters
struct nvme_mi_aem_supported_item *itemPointer to nvme_mi_aem_supported_item to update the aesi field
bool enabledaee value to use
-
struct nvme_mi_aem_supported_list¶
AE Supported List received with GET CONFIG Asynchronous Event
Definition
struct nvme_mi_aem_supported_list {
struct nvme_mi_aem_supported_list_header hdr;
};
Members
hdrAE supported list header
Description
Following this header should be hdr.numaes entries of nvme_mi_aem_supported_item structures
-
struct nvme_mi_aem_enable_item¶
AE Enabled item entry
Definition
struct nvme_mi_aem_enable_item {
__u8 aeel;
__le16 aeei;
};
Members
aeelAE Enable Length (length of this structure which is 3)
aeeiAE Enable Info
-
bool nvme_mi_aem_aeei_get_aee(__le16 aeei)¶
return aee from aeei field
Parameters
__le16 aeeiaeei field from nvme_mi_aem_enable_item
Return
aee value
-
__u8 nvme_mi_aem_aeei_get_aeeid(__le16 aeei)¶
return aeeid from aeei field
Parameters
__le16 aeeiaeei field from nvme_mi_aem_enable_item
Return
aeeid value
-
void nvme_mi_aem_aeei_set_aeeid(struct nvme_mi_aem_enable_item *item, __u8 aeeid)¶
set aeeid in the aeei field
Parameters
struct nvme_mi_aem_enable_item *itemPointer to nvme_mi_aem_enable_item to update the aeei field
__u8 aeeidaeeid value to use
-
void nvme_mi_aem_aeei_set_aee(struct nvme_mi_aem_enable_item *item, bool enabled)¶
set aee in the aeei field
Parameters
struct nvme_mi_aem_enable_item *itemPointer to nvme_mi_aem_enable_item to update the aee field
bool enabledaee value to use
-
struct nvme_mi_aem_enable_list_header¶
AE Enable list header
Definition
struct nvme_mi_aem_enable_list_header {
__u8 numaee;
__u8 aeelver;
__le16 aeetl;
__u8 aeelhl;
};
Members
numaeeNumber of AE enable items following the header
aeelverVersion of the AE enable list (zero)
aeetlTotal length of the AE enable list including header and items
aeelhlHeader length of this header (5)
-
struct nvme_mi_aem_enable_list¶
AE enable list sent with SET CONFIG Asyncronous Event
Definition
struct nvme_mi_aem_enable_list {
struct nvme_mi_aem_enable_list_header hdr;
};
Members
hdrAE enable list header
Description
Following this header should be hdr.numaee entries of nvme_mi_aem_enable_item structures
-
struct nvme_mi_aem_occ_data¶
AEM Message definition.
Definition
struct nvme_mi_aem_occ_data {
__u8 aelhlen;
__u8 aeosil;
__u8 aeovsil;
struct {
__u8 aeoi;
__le32 aeocidi;
__u8 aessi;
} aeoui;
};
Members
aelhlenAE Occurrence Header Length
aeosilAE Occurrence Specific Info Length
aeovsilAE Occurrence Vendor Specific Info Length
aeouiAE Occurrence Unique ID made up of other subfields
Description
A single entry of ae occurrence data that comes with an nvme_aem_msg. Following this structure is variable length AEOSI (occurrence specific info) and variable length AEVSI (vendor specific info). The length of AEOSI is specified by aeosil and the length of AEVSI is specified by AEVSI. Neither field is mandatory and shall be omitted if their length parameter is set to zero.
-
struct nvme_mi_aem_occ_list_hdr¶
AE occurrence list header
Definition
struct nvme_mi_aem_occ_list_hdr {
__u8 numaeo;
__u8 aelver;
__u8 aeolli[3];
__u8 aeolhl;
__u8 aemti;
};
Members
numaeoNumber of AE Occurrence Data Structures
aelverAE Occurrence List Version Number
aeolliAE Occurrence List Length Info (AEOLLI)
aeolhlAE Occurrence List Header Length (shall be set to 7)
aemtiAEM Transmission Info
Description
The header for the occurrence list. numaeo defines how many nvme_mi_aem_occ_data structures (including variable payaloads) are included. Following this header is each of the numaeo occurrence data structures.
-
__u8 nvme_mi_aem_aemti_get_aemgn(__u8 aemti)¶
return aemgn from aemti field
Parameters
__u8 aemtiaemti field from nvme_mi_aem_occ_list_hdr
Return
aemgn value
-
__u32 nvme_mi_aem_aeolli_get_aeoltl(__u8 *aeolli)¶
return aeoltl from aeolli field
Parameters
__u8 *aeolliPointer to 3 byte aeolli field from nvme_mi_aem_occ_list_hdr
Return
aeoltl value
-
void nvme_mi_aem_aeolli_set_aeoltl(struct nvme_mi_aem_occ_list_hdr *hdr, __u32 aeoltl)¶
set aeoltl in the aeolli field
Parameters
struct nvme_mi_aem_occ_list_hdr *hdrPointer to nvme_mi_aem_occ_list_hdr to set the aeolli field
__u32 aeoltlaeoltl value to use
-
struct nvme_mi_aem_msg¶
AEM Message definition.
Definition
struct nvme_mi_aem_msg {
struct nvme_mi_msg_hdr hdr;
struct nvme_mi_aem_occ_list_hdr occ_list_hdr;
};
Members
hdrthe general response message header
occ_list_hdrae occurrence list header.
Description
Every ae message will start with one of these. The occ_list_hder wil define information about how many ae occ data entries are included. Each entry is defined by the nvme_mi_aem_occ_data structure which will follow the occ_list_hdr. Each nvme_mi_aem_occ_data structure has a fixed length header but a variable length payload ude to occurrence specific and vendor specific info. For this reason, do not index the nvme_mi_ae_occ data structures by array or fixed offset.
-
struct nvme_mi_admin_req_hdr¶
Admin command request header.
Definition
struct nvme_mi_admin_req_hdr {
struct nvme_mi_msg_hdr hdr;
__u8 opcode;
__u8 flags;
__le16 ctrl_id;
__le32 cdw1, cdw2, cdw3, cdw4, cdw5;
__le32 doff;
__le32 dlen;
__le32 rsvd0, rsvd1;
__le32 cdw10, cdw11, cdw12, cdw13, cdw14, cdw15;
};
Members
hdrGeneric MI message header
opcodeAdmin command opcode (using enum nvme_admin_opcode)
flagsCommand Flags, indicating dlen and doff validity; Only defined in NVMe-MI version 1.1, no fields defined in 1.2 (where the dlen/doff are always considered valid).
ctrl_idController ID target of command
cdw1Submission Queue Entry doubleword 1
cdw2Submission Queue Entry doubleword 2
cdw3Submission Queue Entry doubleword 3
cdw4Submission Queue Entry doubleword 4
cdw5Submission Queue Entry doubleword 5
doffOffset of data to return from command
dlenLength of sent/returned data
rsvd0Reserved
rsvd1Reserved
cdw10Submission Queue Entry doubleword 10
cdw11Submission Queue Entry doubleword 11
cdw12Submission Queue Entry doubleword 12
cdw13Submission Queue Entry doubleword 13
cdw14Submission Queue Entry doubleword 14
cdw15Submission Queue Entry doubleword 15
Description
Wire format for Admin command message headers, defined in section 6 of NVMe-MI.
-
struct nvme_mi_admin_resp_hdr¶
Admin command response header.
Definition
struct nvme_mi_admin_resp_hdr {
struct nvme_mi_msg_hdr hdr;
__u8 status;
__u8 rsvd0[3];
__le32 cdw0, cdw1, cdw3;
};
Members
hdrGeneric MI message header
statusGeneric response code, non-zero on failure
rsvd0Reserved
cdw0Completion Queue Entry doubleword 0
cdw1Completion Queue Entry doubleword 1
cdw3Completion Queue Entry doubleword 3
Description
This is the generic response format with the three doublewords of completion queue data, plus optional response data.
-
enum nvme_mi_control_opcode¶
Operation code for Control Primitives.
Constants
nvme_mi_control_opcode_pauseSuspend response transmission/timeout
nvme_mi_control_opcode_resumeResume from a paused condition
nvme_mi_control_opcode_abortRe-initialize a Command Slot to the Idle state
nvme_mi_control_opcode_get_stateGet the state of a Command Slot
nvme_mi_control_opcode_replayRetransmit the Response Message
-
struct nvme_mi_control_req¶
The Control Primitive request.
Definition
struct nvme_mi_control_req {
struct nvme_mi_msg_hdr hdr;
__u8 opcode;
__u8 tag;
__le16 cpsp;
};
Members
hdrGeneric MI message header
opcodeControl Primitive Opcodes (using
enum nvme_mi_control_opcode)tagflag - Opaque value passed from request to response
cpspControl Primitive Specific Parameter