Skip to content

Commit 6dc4b7a

Browse files
jeff-lien-sndkdwsuse
authored andcommitted
types: Add support for get log - MI Command Supported
Add API to get NVMe-MI Commands Supported and Effects log page. Signed-off-by: Jeff Lien <[email protected]>
1 parent 5bcde30 commit 6dc4b7a

2 files changed

Lines changed: 69 additions & 0 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: 53 additions & 0 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,
@@ -3544,6 +3550,51 @@ struct nvme_fid_supported_effects_log {
35443550
__le32 fid_support[NVME_LOG_FID_SUPPORTED_EFFECTS_MAX];
35453551
};
35463552

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+
35473598
/**
35483599
* struct nvme_boot_partition -
35493600
* @lid: Boot Partition Identifier
@@ -6108,6 +6159,7 @@ enum nvme_identify_cns {
61086159
* @NVME_LOG_LID_MEDIA_UNIT_STATUS: Media Unit Status
61096160
* @NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST: Supported Capacity Configuration Lis
61106161
* @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
61116163
* @NVME_LOG_LID_BOOT_PARTITION: Boot Partition
61126164
* @NVME_LOG_LID_DISCOVER: Discovery
61136165
* @NVME_LOG_LID_RESERVATION: Reservation Notification
@@ -6134,6 +6186,7 @@ enum nvme_cmd_get_log_lid {
61346186
NVME_LOG_LID_MEDIA_UNIT_STATUS = 0x10,
61356187
NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST = 0x11,
61366188
NVME_LOG_LID_FID_SUPPORTED_EFFECTS = 0x12,
6189+
NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS = 0x13,
61376190
NVME_LOG_LID_BOOT_PARTITION = 0x15,
61386191
NVME_LOG_LID_DISCOVER = 0x70,
61396192
NVME_LOG_LID_RESERVATION = 0x80,

0 commit comments

Comments
 (0)