diff --git a/src/nvme/mi.h b/src/nvme/mi.h index 3377b73fe..da3b410b9 100644 --- a/src/nvme/mi.h +++ b/src/nvme/mi.h @@ -1605,6 +1605,47 @@ static inline int nvme_mi_admin_get_nsid_log(nvme_mi_ctrl_t ctrl, bool rae, 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 @@ -1665,8 +1706,8 @@ static inline int nvme_mi_admin_get_log_error(nvme_mi_ctrl_t ctrl, 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); } /** @@ -1691,7 +1732,7 @@ static inline int nvme_mi_admin_get_log_smart(nvme_mi_ctrl_t ctrl, __u32 nsid, 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); } /** @@ -1711,7 +1752,7 @@ static inline int nvme_mi_admin_get_log_fw_slot(nvme_mi_ctrl_t ctrl, bool rae, 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); } /** @@ -1732,7 +1773,7 @@ static inline int nvme_mi_admin_get_log_changed_ns_list(nvme_mi_ctrl_t ctrl, 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); } /** @@ -1799,8 +1840,8 @@ static inline int nvme_mi_admin_get_log_device_self_test(nvme_mi_ctrl_t ctrl, * &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, @@ -2203,7 +2244,7 @@ static inline int nvme_mi_admin_get_log_mi_cmd_supported_effects(nvme_mi_ctrl_t 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); } /** @@ -2241,6 +2282,43 @@ static inline int nvme_mi_admin_get_log_boot_partition(nvme_mi_ctrl_t ctrl, 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) +{ + 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 @@ -2291,6 +2369,93 @@ static inline int nvme_mi_admin_get_log_phy_rx_eom(nvme_mi_ctrl_t ctrl, 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 @@ -2327,6 +2492,74 @@ static inline int nvme_mi_admin_get_log_discovery(nvme_mi_ctrl_t ctrl, bool rae, 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