Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mi ns list #950

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
249 changes: 241 additions & 8 deletions src/nvme/mi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,47 @@
return nvme_mi_admin_get_log(ctrl, &args);
}

/**
* nvme_mi_admin_get_endgid_log() - Helper for Get Endurance Group ID Log Page functions
* @ctrl: Controller to query
* @rae: Retain Asynchronous Events
* @lid: Log identifier
* @endgid: Endurance Group ID
* @len: length of log buffer
* @log: pointer for resulting log data
*
* Performs a Get Log Page Admin command for a specific log ID @lid and
* endurance group ID @endgid. Log data is expected to be @len bytes, and is stored
* in @log on success. The @rae flag is passed as-is to the Get Log Page
* command, and is specific to the Log Page requested.
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
static inline int nvme_mi_admin_get_endgid_log(nvme_mi_ctrl_t ctrl, bool rae,
enum nvme_cmd_get_log_lid lid, __u16 endgid,
__u32 len, void *log)
{
struct nvme_get_log_args args = {
.lpo = 0,
.result = NULL,
.log = log,
.args_size = sizeof(args),
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = lid,
.len = len,
.nsid = NVME_NSID_NONE,
.csi = NVME_CSI_NVM,
.lsi = endgid,
.lsp = NVME_LOG_LSP_NONE,
.uuidx = NVME_LOG_LSP_NONE,
.rae = rae,
.ot = false,
};

return nvme_mi_admin_get_log(ctrl, &args);
}

/**
* nvme_mi_admin_get_log_simple() - Helper for Get Log Page functions with no
* NSID or RAE requirements
Expand Down Expand Up @@ -1665,8 +1706,8 @@
struct nvme_error_log_page *err_log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_ERROR,
NVME_NSID_ALL, sizeof(*err_log) * nr_entries,
err_log);
NVME_NSID_ALL, sizeof(*err_log) * nr_entries,
err_log);
}

/**
Expand All @@ -1691,7 +1732,7 @@
struct nvme_smart_log *smart_log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_SMART,
nsid, sizeof(*smart_log), smart_log);
nsid, sizeof(*smart_log), smart_log);
}

/**
Expand All @@ -1711,7 +1752,7 @@
struct nvme_firmware_slot *fw_log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_FW_SLOT,
NVME_NSID_ALL, sizeof(*fw_log), fw_log);
NVME_NSID_ALL, sizeof(*fw_log), fw_log);
}

/**
Expand All @@ -1732,7 +1773,7 @@
struct nvme_ns_list *ns_log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_CHANGED_NS,
NVME_NSID_ALL, sizeof(*ns_log), ns_log);
NVME_NSID_ALL, sizeof(*ns_log), ns_log);
}

/**
Expand Down Expand Up @@ -1799,8 +1840,8 @@
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
static inline int nvme_mi_admin_get_log_create_telemetry_host_mcda(nvme_mi_ctrl_t ctrl,
enum nvme_telemetry_da mcda,
struct nvme_telemetry_log *log)
enum nvme_telemetry_da mcda,
struct nvme_telemetry_log *log)
{
struct nvme_get_log_args args = {
.lpo = 0,
Expand Down Expand Up @@ -2203,7 +2244,7 @@
struct nvme_mi_cmd_supported_effects_log *log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS,
NVME_NSID_NONE, sizeof(*log), log);
NVME_NSID_NONE, sizeof(*log), log);
}

/**
Expand Down Expand Up @@ -2241,6 +2282,43 @@
return nvme_mi_admin_get_log(ctrl, &args);
}

/**
* nvme_mi_admin_get_log_rotational_media_info() - Retrieve Rotational Media Information Log
* @ctrl: Controller to query
* @endgid: Endurance Group Identifier
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_rotational_media_info(nvme_mi_ctrl_t ctrl, __u16 endgid,
__u32 len,
struct nvme_rotational_media_info_log *log)
{
return nvme_mi_admin_get_endgid_log(ctrl, false, NVME_LOG_LID_ROTATIONAL_MEDIA_INFO, endgid,
len, log);
}

/**
* nvme_mi_admin_get_log_dispersed_ns_participating_nss() - Retrieve Dispersed Namespace
* Participating NVM Subsystems Log
* @ctrl: Controller to query
* @nsid: Namespace Identifier
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_dispersed_ns_participating_nss(nvme_mi_ctrl_t ctrl,
__u32 nsid, __u32 len,
struct nvme_dispersed_ns_participating_nss_log *log)

Check failure on line 2316 in src/nvme/mi.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 123 exceeds 120 columns
{
return nvme_mi_admin_get_nsid_log(ctrl, false, NVME_LOG_LID_DISPERSED_NS_PARTICIPATING_NSS,
nsid, len, log);
}

/**
* nvme_mi_admin_get_log_mgmt_addr_list() - Retrieve Management Address List Log
* @ctrl: Controller to query
Expand Down Expand Up @@ -2291,6 +2369,93 @@
return nvme_mi_admin_get_log(ctrl, &args);
}

/**
* nvme_mi_admin_get_log_reachability_groups() - Retrieve Reachability Groups Log
* @ctrl: Controller to query
* @rgo: Return groups only
* @rae: Retain asynchronous events
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_reachability_groups(nvme_mi_ctrl_t ctrl, __u32 len,
bool rgo, bool rae,
struct nvme_reachability_groups_log *log)
{
struct nvme_get_log_args args = {
.lpo = 0,
.result = NULL,
.log = log,
.args_size = sizeof(args),
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = NVME_LOG_LID_REACHABILITY_GROUPS,
.len = len,
.nsid = NVME_NSID_ALL,
.csi = NVME_CSI_NVM,
.lsi = NVME_LOG_LSI_NONE,
.lsp = rgo,
.uuidx = NVME_LOG_LSP_NONE,
.rae = rae,
.ot = false,
};

return nvme_mi_admin_get_log_page(ctrl, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_mi_admin_get_log_reachability_associations() - Retrieve Reachability Associations Log
* @ctrl: Controller to query
* @rao: Return associations only
* @rae: Retain asynchronous events
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_reachability_associations(nvme_mi_ctrl_t ctrl, bool rao,
bool rae, __u32 len,
struct nvme_reachability_associations_log *log)
{
struct nvme_get_log_args args = {
.lpo = 0,
.result = NULL,
.log = log,
.args_size = sizeof(args),
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = NVME_LOG_LID_REACHABILITY_ASSOCIATIONS,
.len = len,
.nsid = NVME_NSID_ALL,
.csi = NVME_CSI_NVM,
.lsi = NVME_LOG_LSI_NONE,
.lsp = rao,
.uuidx = NVME_LOG_LSP_NONE,
.rae = rae,
.ot = false,
};

return nvme_mi_admin_get_log_page(ctrl, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_mi_admin_get_log_changed_alloc_ns_list() - Retrieve Changed Allocated Namespace List Log
* @ctrl: Controller to query
* @rae: Retain asynchronous events
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_changed_alloc_ns_list(nvme_mi_ctrl_t ctrl, bool rae,
__u32 len, struct nvme_ns_list *log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_CHANGED_ALLOC_NS_LIST,
NVME_NSID_ALL, len, log);
}

/**
* nvme_mi_admin_get_log_discovery() - Retrieve Discovery log page
* @ctrl: Controller to query
Expand Down Expand Up @@ -2327,6 +2492,74 @@
return nvme_mi_admin_get_log(ctrl, &args);
}

/**
* nvme_mi_admin_get_log_host_discover() - Retrieve Host Discovery Log
* @ctrl: Controller to query
* @allhoste: All host entries
* @rae: Retain asynchronous events
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_host_discover(nvme_mi_ctrl_t ctrl, bool allhoste, bool rae,
__u32 len, struct nvme_host_discover_log *log)
{
struct nvme_get_log_args args = {
.lpo = 0,
.result = NULL,
.log = log,
.args_size = sizeof(args),
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = NVME_LOG_LID_HOST_DISCOVER,
.len = len,
.nsid = NVME_NSID_ALL,
.csi = NVME_CSI_NVM,
.lsi = NVME_LOG_LSI_NONE,
.lsp = allhoste,
.uuidx = NVME_LOG_LSP_NONE,
.rae = rae,
.ot = false,
};

return nvme_mi_admin_get_log_page(ctrl, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_mi_admin_get_log_ave_discover() - Retrieve AVE Discovery Log
* @ctrl: Controller to query
* @rae: Retain asynchronous events
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_ave_discover(nvme_mi_ctrl_t ctrl, bool rae, __u32 len,
struct nvme_ave_discover_log *log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_AVE_DISCOVER, NVME_NSID_ALL, len,
log);
}

/**
* nvme_mi_admin_get_log_pull_model_ddc_req() - Retrieve Pull Model DDC Request Log
* @ctrl: Controller to query
* @rae: Retain asynchronous events
* @len: The allocated length of the log page
* @log: User address to store the log page
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
static inline int nvme_mi_admin_get_log_pull_model_ddc_req(nvme_mi_ctrl_t ctrl, bool rae, __u32 len,
struct nvme_pull_model_ddc_req_log *log)
{
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_PULL_MODEL_DDC_REQ, NVME_NSID_ALL,
len, log);
}

/**
* nvme_mi_admin_get_log_media_unit_stat() - Retrieve Media Unit Status
* @ctrl: Controller to query
Expand Down