Skip to content

Commit 3dc8554

Browse files
authored
Merge pull request #306 from jeffreyalien/nvme-2.0-2
Nvme 2.0 Changes
2 parents b0b1ca3 + 6dc4b7a commit 3dc8554

2 files changed

Lines changed: 83 additions & 5 deletions

File tree

src/nvme/ioctl.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,22 @@ static inline int nvme_get_log_fid_supported_effects(int fd, bool rae,
17361736
NVME_NSID_NONE, sizeof(*log), log);
17371737
}
17381738

1739+
/**
1740+
* nvme_get_log_mi_cmd_supported_effects() - displays the MI Commands Supported byt the controller
1741+
* @fd: File descriptor of nvme device
1742+
* @rae: Retain asynchronous events
1743+
* @log: MI Command Supported and Effects data structure
1744+
*
1745+
* Return: The nvme command status if a response was received (see
1746+
* &enum nvme_status_field) or -1 with errno set otherwise
1747+
*/
1748+
static inline int nvme_get_log_mi_cmd_supported_effects(int fd, bool rae,
1749+
struct nvme_mi_cmd_supported_effects_log *log)
1750+
{
1751+
return nvme_get_nsid_log(fd, rae, NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS,
1752+
NVME_NSID_NONE, sizeof(*log), log);
1753+
}
1754+
17391755
/**
17401756
* nvme_get_log_boot_partition() -
17411757
* @fd: File descriptor of nvme device

src/nvme/types.h

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
* device self test log
8484
* @NVME_LOG_FID_SUPPORTED_EFFECTS_MAX: The largest possible FID index in the
8585
* feature identifiers effects log.
86+
* @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX: The largest possible MI Command index
87+
* in the MI Command effects log.
88+
* @NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED: The reserved space in the MI Command
89+
* effects log.
8690
* @NVME_LOG_TELEM_BLOCK_SIZE: Specification defined size of Telemetry Data Blocks
8791
* @NVME_DSM_MAX_RANGES: The largest possible range index in a data-set
8892
* management command
@@ -115,6 +119,8 @@ enum nvme_constants {
115119
NVME_LOG_ST_MAX_RESULTS = 20,
116120
NVME_LOG_TELEM_BLOCK_SIZE = 512,
117121
NVME_LOG_FID_SUPPORTED_EFFECTS_MAX = 256,
122+
NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX = 256,
123+
NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED = 768,
118124
NVME_DSM_MAX_RANGES = 256,
119125
NVME_NQN_LENGTH = 256,
120126
NVMF_TRADDR_SIZE = 256,
@@ -2944,6 +2950,9 @@ enum nvme_cmd_get_log_telemetry_host_lsp {
29442950
* @dalb4: Telemetry Controller-Initiated Data Area 4 Last Block is
29452951
* the value of the last block in this area.
29462952
* @rsvd20: Reserved
2953+
* @hostdgn: Telemetry Host-Initiated Data Generation Number is a
2954+
* value that is incremented each time the host initiates a
2955+
* capture of its internal controller state in the controller .
29472956
* @ctrlavail: Telemetry Controller-Initiated Data Available, if cleared,
29482957
* then the controller telemetry log does not contain saved
29492958
* internal controller state. If this field is set to 1h, the
@@ -2971,7 +2980,8 @@ struct nvme_telemetry_log {
29712980
__le16 dalb3;
29722981
__u8 rsvd14[2];
29732982
__le32 dalb4;
2974-
__u8 rsvd20[362];
2983+
__u8 rsvd20[361];
2984+
__u8 hostdgn;
29752985
__u8 ctrlavail;
29762986
__u8 ctrldgn;
29772987
__u8 rsnident[128];
@@ -3205,21 +3215,23 @@ struct nvme_persistent_event_log {
32053215
* @etype: Event Type
32063216
* @etype_rev: Event Type Revision
32073217
* @ehl: Event Header Length
3208-
* @rsvd3: Reserved
3218+
* @ehai: Event Header Additional Info
32093219
* @cntlid: Controller Identifier
32103220
* @ets: Event Timestamp
3211-
* @rsvd14: Reserved
3221+
* @pelpid: Port Identifier
3222+
* @rsvd16: Reserved
32123223
* @vsil: Vendor Specific Information Length
32133224
* @el: Event Length
32143225
*/
32153226
struct nvme_persistent_event_entry {
32163227
__u8 etype;
32173228
__u8 etype_rev;
32183229
__u8 ehl;
3219-
__u8 rsvd3;
3230+
__u8 ehai;
32203231
__le16 cntlid;
32213232
__le64 ets;
3222-
__u8 rsvd14[6];
3233+
__le16 pelpid;
3234+
__u8 rsvd16[4];
32233235
__le16 vsil;
32243236
__le16 el;
32253237
} __attribute__((packed));
@@ -3538,6 +3550,51 @@ struct nvme_fid_supported_effects_log {
35383550
__le32 fid_support[NVME_LOG_FID_SUPPORTED_EFFECTS_MAX];
35393551
};
35403552

3553+
/**
3554+
* enum nvme_mi_cmd_supported_effects - bit field definitions
3555+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_CSUPP: Command Supported
3556+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_UDCC: User Data Conttent Change
3557+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_NCC: Namespace Capability Change
3558+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_NIC: Namespace Inventory Change
3559+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_CCC: Controller Capability Change
3560+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_SHIFT: 20 bit shift
3561+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_MASK: 12 bit mask - 0xfff
3562+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NS: Namespace Scope
3563+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_CTRL: Controller Scope
3564+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NVM_SET: NVM Set Scope
3565+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_ENDGRP: Endurance Group Scope
3566+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_DOMAIN: Domain Scope
3567+
* @NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NSS: NVM Subsystem Scope
3568+
*
3569+
* MI Command Supported and Effects Data Structure definitions
3570+
*/
3571+
enum nvme_mi_cmd_supported_effects {
3572+
NVME_MI_CMD_SUPPORTED_EFFECTS_CSUPP = 1 << 0,
3573+
NVME_MI_CMD_SUPPORTED_EFFECTS_UDCC = 1 << 1,
3574+
NVME_MI_CMD_SUPPORTED_EFFECTS_NCC = 1 << 2,
3575+
NVME_MI_CMD_SUPPORTED_EFFECTS_NIC = 1 << 3,
3576+
NVME_MI_CMD_SUPPORTED_EFFECTS_CCC = 1 << 4,
3577+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_SHIFT = 20,
3578+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_MASK = 0xfff,
3579+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NS = 1 << 0,
3580+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_CTRL = 1 << 1,
3581+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NVM_SET = 1 << 2,
3582+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_ENDGRP = 1 << 3,
3583+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_DOMAIN = 1 << 4,
3584+
NVME_MI_CMD_SUPPORTED_EFFECTS_SCOPE_NSS = 1 << 5,
3585+
};
3586+
3587+
/**
3588+
* struct nvme_mi_cmd_supported_effects_log -
3589+
* @mi_cmd_support: NVMe-MI Commands Supported
3590+
*
3591+
* NVMe-MI Commands Supported and Effects (Log Identifier 13h)
3592+
*/
3593+
struct nvme_mi_cmd_supported_effects_log {
3594+
__le32 mi_cmd_support[NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX];
3595+
__le32 reserved1[NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_RESERVED];
3596+
};
3597+
35413598
/**
35423599
* struct nvme_boot_partition -
35433600
* @lid: Boot Partition Identifier
@@ -6050,6 +6107,8 @@ enum nvme_admin_opcode {
60506107
* @NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID: Endurance Group List
60516108
* @NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST: I/O Command Set specific Allocated Namespace
60526109
* ID list
6110+
* @NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE: I/O Command Set specific ID Namespace
6111+
* Data Structure for Allocated Namespace ID
60536112
* @NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE: Base Specification 2.0a section 5.17.2.21
60546113
*/
60556114
enum nvme_identify_cns {
@@ -6075,6 +6134,7 @@ enum nvme_identify_cns {
60756134
NVME_IDENTIFY_CNS_DOMAIN_LIST = 0x18,
60766135
NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID = 0x19,
60776136
NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST = 0x1A,
6137+
NVME_IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE = 0x1B,
60786138
NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE = 0x1C,
60796139
};
60806140

@@ -6099,6 +6159,7 @@ enum nvme_identify_cns {
60996159
* @NVME_LOG_LID_MEDIA_UNIT_STATUS: Media Unit Status
61006160
* @NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST: Supported Capacity Configuration Lis
61016161
* @NVME_LOG_LID_FID_SUPPORTED_EFFECTS: Feature Identifiers Supported and Effects
6162+
* @NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS: NVMe-MI Commands Supported and Effects
61026163
* @NVME_LOG_LID_BOOT_PARTITION: Boot Partition
61036164
* @NVME_LOG_LID_DISCOVER: Discovery
61046165
* @NVME_LOG_LID_RESERVATION: Reservation Notification
@@ -6125,6 +6186,7 @@ enum nvme_cmd_get_log_lid {
61256186
NVME_LOG_LID_MEDIA_UNIT_STATUS = 0x10,
61266187
NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST = 0x11,
61276188
NVME_LOG_LID_FID_SUPPORTED_EFFECTS = 0x12,
6189+
NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS = 0x13,
61286190
NVME_LOG_LID_BOOT_PARTITION = 0x15,
61296191
NVME_LOG_LID_DISCOVER = 0x70,
61306192
NVME_LOG_LID_RESERVATION = 0x80,

0 commit comments

Comments
 (0)