From: Rodrigo R. Galvao Date: Tue, 20 Mar 2018 19:10:46 +0000 (-0300) Subject: nvme-cli: Add friendly status messages X-Git-Tag: v1.6~62^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d7995f35b14720243977886f188c8601139dd40e;p=users%2Fhch%2Fnvme-cli.git nvme-cli: Add friendly status messages Additional messages were added on nvme_status_to_string(), in order to make the returned status easier to understand. The messages were based in the Description of those statuses in the NVMe Specification (v1.3), from the figures 31-36. Signed-off-by: Rodrigo R. Galvao --- diff --git a/nvme-print.c b/nvme-print.c index 13e26d2..d63f58d 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -1354,63 +1354,63 @@ char* nvme_select_to_string(int sel) char *nvme_status_to_string(__u32 status) { switch (status & 0x3ff) { - case NVME_SC_SUCCESS: return "SUCCESS"; - case NVME_SC_INVALID_OPCODE: return "INVALID_OPCODE"; - case NVME_SC_INVALID_FIELD: return "INVALID_FIELD"; - case NVME_SC_CMDID_CONFLICT: return "CMDID_CONFLICT"; - case NVME_SC_DATA_XFER_ERROR: return "DATA_XFER_ERROR"; - case NVME_SC_POWER_LOSS: return "POWER_LOSS"; - case NVME_SC_INTERNAL: return "INTERNAL"; - case NVME_SC_ABORT_REQ: return "ABORT_REQ"; - case NVME_SC_ABORT_QUEUE: return "ABORT_QUEUE"; - case NVME_SC_FUSED_FAIL: return "FUSED_FAIL"; - case NVME_SC_FUSED_MISSING: return "FUSED_MISSING"; - case NVME_SC_INVALID_NS: return "INVALID_NS"; - case NVME_SC_CMD_SEQ_ERROR: return "CMD_SEQ_ERROR"; - case NVME_SC_SANITIZE_FAILED: return "SANITIZE_FAILED"; - case NVME_SC_SANITIZE_IN_PROGRESS: return "SANITIZE_IN_PROGRESS"; - case NVME_SC_LBA_RANGE: return "LBA_RANGE"; - case NVME_SC_CAP_EXCEEDED: return "CAP_EXCEEDED"; - case NVME_SC_NS_NOT_READY: return "NS_NOT_READY"; - case NVME_SC_RESERVATION_CONFLICT: return "RESERVATION_CONFLICT"; - case NVME_SC_CQ_INVALID: return "CQ_INVALID"; - case NVME_SC_QID_INVALID: return "QID_INVALID"; - case NVME_SC_QUEUE_SIZE: return "QUEUE_SIZE"; - case NVME_SC_ABORT_LIMIT: return "ABORT_LIMIT"; - case NVME_SC_ABORT_MISSING: return "ABORT_MISSING"; - case NVME_SC_ASYNC_LIMIT: return "ASYNC_LIMIT"; - case NVME_SC_FIRMWARE_SLOT: return "FIRMWARE_SLOT"; - case NVME_SC_FIRMWARE_IMAGE: return "FIRMWARE_IMAGE"; - case NVME_SC_INVALID_VECTOR: return "INVALID_VECTOR"; - case NVME_SC_INVALID_LOG_PAGE: return "INVALID_LOG_PAGE"; - case NVME_SC_INVALID_FORMAT: return "INVALID_FORMAT"; - case NVME_SC_FW_NEEDS_CONV_RESET: return "FW_NEEDS_CONVENTIONAL_RESET"; - case NVME_SC_INVALID_QUEUE: return "INVALID_QUEUE"; - case NVME_SC_FEATURE_NOT_SAVEABLE: return "FEATURE_NOT_SAVEABLE"; - case NVME_SC_FEATURE_NOT_CHANGEABLE: return "FEATURE_NOT_CHANGEABLE"; - case NVME_SC_FEATURE_NOT_PER_NS: return "FEATURE_NOT_PER_NS"; - case NVME_SC_FW_NEEDS_SUBSYS_RESET: return "FW_NEEDS_SUBSYSTEM_RESET"; - case NVME_SC_FW_NEEDS_RESET: return "FW_NEEDS_RESET"; - case NVME_SC_FW_NEEDS_MAX_TIME: return "FW_NEEDS_MAX_TIME_VIOLATION"; - case NVME_SC_FW_ACIVATE_PROHIBITED: return "FW_ACTIVATION_PROHIBITED"; - case NVME_SC_OVERLAPPING_RANGE: return "OVERLAPPING_RANGE"; - case NVME_SC_NS_INSUFFICENT_CAP: return "NS_INSUFFICIENT_CAPACITY"; - case NVME_SC_NS_ID_UNAVAILABLE: return "NS_ID_UNAVAILABLE"; - case NVME_SC_NS_ALREADY_ATTACHED: return "NS_ALREADY_ATTACHED"; - case NVME_SC_NS_IS_PRIVATE: return "NS_IS_PRIVATE"; - case NVME_SC_NS_NOT_ATTACHED: return "NS_NOT_ATTACHED"; - case NVME_SC_THIN_PROV_NOT_SUPP: return "THIN_PROVISIONING_NOT_SUPPORTED"; - case NVME_SC_CTRL_LIST_INVALID: return "CONTROLLER_LIST_INVALID"; - case NVME_SC_BP_WRITE_PROHIBITED: return "BOOT PARTITION WRITE PROHIBITED"; - case NVME_SC_BAD_ATTRIBUTES: return "BAD_ATTRIBUTES"; - case NVME_SC_WRITE_FAULT: return "WRITE_FAULT"; - case NVME_SC_READ_ERROR: return "READ_ERROR"; - case NVME_SC_GUARD_CHECK: return "GUARD_CHECK"; - case NVME_SC_APPTAG_CHECK: return "APPTAG_CHECK"; - case NVME_SC_REFTAG_CHECK: return "REFTAG_CHECK"; - case NVME_SC_COMPARE_FAILED: return "COMPARE_FAILED"; - case NVME_SC_ACCESS_DENIED: return "ACCESS_DENIED"; - case NVME_SC_UNWRITTEN_BLOCK: return "UNWRITTEN_BLOCK"; + case NVME_SC_SUCCESS: return "SUCCESS: The command completed successfully"; + case NVME_SC_INVALID_OPCODE: return "INVALID_OPCODE: The associated command opcode field is not valid"; + case NVME_SC_INVALID_FIELD: return "INVALID_FIELD: A reserved coded value or an unsupported value in a defined field"; + case NVME_SC_CMDID_CONFLICT: return "CMDID_CONFLICT: The command identifier is already in use"; + case NVME_SC_DATA_XFER_ERROR: return "DATA_XFER_ERROR: Error while trying to transfer the data or metadata"; + case NVME_SC_POWER_LOSS: return "POWER_LOSS: Command aborted due to power loss notification"; + case NVME_SC_INTERNAL: return "INTERNAL: The command was not completed successfully due to an internal error"; + case NVME_SC_ABORT_REQ: return "ABORT_REQ: The command was aborted due to a Command Abort request"; + case NVME_SC_ABORT_QUEUE: return "ABORT_QUEUE: The command was aborted due to a Delete I/O Submission Queue request"; + case NVME_SC_FUSED_FAIL: return "FUSED_FAIL: The command was aborted due to the other command in a fused operation failing"; + case NVME_SC_FUSED_MISSING: return "FUSED_MISSING: The command was aborted due to a Missing Fused Command"; + case NVME_SC_INVALID_NS: return "INVALID_NS: The namespace or the format of that namespace is invalid"; + case NVME_SC_CMD_SEQ_ERROR: return "CMD_SEQ_ERROR: The command was aborted due to a protocol violation in a multicommand sequence"; + case NVME_SC_SANITIZE_FAILED: return "SANITIZE_FAILED: The most recent sanitize operation failed and no recovery actions has been successfully completed"; + case NVME_SC_SANITIZE_IN_PROGRESS: return "SANITIZE_IN_PROGRESS: The requested function is prohibited while a sanitize operation is in progress"; + case NVME_SC_LBA_RANGE: return "LBA_RANGE: The command references a LBA that exceeds the size of the namespace"; + case NVME_SC_CAP_EXCEEDED: return "CAP_EXCEEDED: The execution of the command has caused the capacity of the namespace to be exceeded"; + case NVME_SC_NS_NOT_READY: return "NS_NOT_READY: The namespace is not ready to be accessed"; + case NVME_SC_RESERVATION_CONFLICT: return "RESERVATION_CONFLICT: The command was aborted due to a conflict with a reservation held on the accessed namespace"; + case NVME_SC_CQ_INVALID: return "CQ_INVALID: The Completion Queue identifier specified in the command does not exist"; + case NVME_SC_QID_INVALID: return "QID_INVALID: The creation of the I/O Completion Queue failed due to an invalid queue identifier specified as part of the command. An invalid queue identifier is one that is currently in use or one that is outside the range supported by the controller"; + case NVME_SC_QUEUE_SIZE: return "QUEUE_SIZE: The host attempted to create an I/O Completion Queue with an invalid number of entries"; + case NVME_SC_ABORT_LIMIT: return "ABORT_LIMIT: The number of concurrently outstanding Abort commands has exceeded the limit indicated in the Identify Controller data structure"; + case NVME_SC_ABORT_MISSING: return "ABORT_MISSING: The abort command is missing"; + case NVME_SC_ASYNC_LIMIT: return "ASYNC_LIMIT: The number of concurrently outstanding Asynchronous Event Request commands has been exceeded"; + case NVME_SC_FIRMWARE_SLOT: return "FIRMWARE_SLOT: The firmware slot indicated is invalid or read only. This error is indicated if the firmware slot exceeds the number supported"; + case NVME_SC_FIRMWARE_IMAGE: return "FIRMWARE_IMAGE: The firmware image specified for activation is invalid and not loaded by the controller"; + case NVME_SC_INVALID_VECTOR: return "INVALID_VECTOR: The creation of the I/O Completion Queue failed due to an invalid interrupt vector specified as part of the command"; + case NVME_SC_INVALID_LOG_PAGE: return "INVALID_LOG_PAGE: The log page indicated is invalid. This error condition is also returned if a reserved log page is requested"; + case NVME_SC_INVALID_FORMAT: return "INVALID_FORMAT: The LBA Format specified is not supported. This may be due to various conditions"; + case NVME_SC_FW_NEEDS_CONV_RESET: return "FW_NEEDS_CONVENTIONAL_RESET: The firmware commit was successful, however, activation of the firmware image requires a conventional reset"; + case NVME_SC_INVALID_QUEUE: return "INVALID_QUEUE: This error indicates that it is invalid to delete the I/O Completion Queue specified. The typical reason for this error condition is that there is an associated I/O Submission Queue that has not been deleted."; + case NVME_SC_FEATURE_NOT_SAVEABLE: return "FEATURE_NOT_SAVEABLE: The Feature Identifier specified does not support a saveable value"; + case NVME_SC_FEATURE_NOT_CHANGEABLE: return "FEATURE_NOT_CHANGEABLE: The Feature Identifier is not able to be changed"; + case NVME_SC_FEATURE_NOT_PER_NS: return "FEATURE_NOT_PER_NS: The Feature Identifier specified is not namespace specific. The Feature Identifier settings apply across all namespaces"; + case NVME_SC_FW_NEEDS_SUBSYS_RESET: return "FW_NEEDS_SUBSYSTEM_RESET: The firmware commit was successful, however, activation of the firmware image requires an NVM Subsystem"; + case NVME_SC_FW_NEEDS_RESET: return "FW_NEEDS_RESET: The firmware commit was successful; however, the image specified does not support being activated without a reset"; + case NVME_SC_FW_NEEDS_MAX_TIME: return "FW_NEEDS_MAX_TIME_VIOLATION: The image specified if activated immediately would exceed the Maximum Time for Firmware Activation (MTFA) value reported in Identify Controller. To activate the firmware, the Firmware Commit command needs to be re-issued and the image activated using a reset"; + case NVME_SC_FW_ACIVATE_PROHIBITED: return "FW_ACTIVATION_PROHIBITED: The image specified is being prohibited from activation by the controller for vendor specific reasons"; + case NVME_SC_OVERLAPPING_RANGE: return "OVERLAPPING_RANGE: This error is indicated if the firmware image has overlapping ranges"; + case NVME_SC_NS_INSUFFICENT_CAP: return "NS_INSUFFICIENT_CAPACITY: Creating the namespace requires more free space than is currently available. The Command Specific Information field of the Error Information Log specifies the total amount of NVM capacity required to create the namespace in bytes"; + case NVME_SC_NS_ID_UNAVAILABLE: return "NS_ID_UNAVAILABLE: The number of namespaces supported has been exceeded"; + case NVME_SC_NS_ALREADY_ATTACHED: return "NS_ALREADY_ATTACHED: The controller is already attached to the namespace specified"; + case NVME_SC_NS_IS_PRIVATE: return "NS_IS_PRIVATE: The namespace is private and is already attached to one controller"; + case NVME_SC_NS_NOT_ATTACHED: return "NS_NOT_ATTACHED: The request to detach the controller could not be completed because the controller is not attached to the namespace"; + case NVME_SC_THIN_PROV_NOT_SUPP: return "THIN_PROVISIONING_NOT_SUPPORTED: Thin provisioning is not supported by the controller"; + case NVME_SC_CTRL_LIST_INVALID: return "CONTROLLER_LIST_INVALID: The controller list provided is invalid"; + case NVME_SC_BP_WRITE_PROHIBITED: return "BOOT PARTITION WRITE PROHIBITED: The command is trying to modify a Boot Partition while it is locked"; + case NVME_SC_BAD_ATTRIBUTES: return "BAD_ATTRIBUTES: Bad attributes were given"; + case NVME_SC_WRITE_FAULT: return "WRITE_FAULT: The write data could not be committed to the media"; + case NVME_SC_READ_ERROR: return "READ_ERROR: The read data could not be recovered from the media"; + case NVME_SC_GUARD_CHECK: return "GUARD_CHECK: The command was aborted due to an end-to-end guard check failure"; + case NVME_SC_APPTAG_CHECK: return "APPTAG_CHECK: The command was aborted due to an end-to-end application tag check failure"; + case NVME_SC_REFTAG_CHECK: return "REFTAG_CHECK: The command was aborted due to an end-to-end reference tag check failure"; + case NVME_SC_COMPARE_FAILED: return "COMPARE_FAILED: The command failed due to a miscompare during a Compare command"; + case NVME_SC_ACCESS_DENIED: return "ACCESS_DENIED: Access to the namespace and/or LBA range is denied due to lack of access rights"; + case NVME_SC_UNWRITTEN_BLOCK: return "UNWRITTEN_BLOCK: The command failed due to an attempt to read from an LBA range containing a deallocated or unwritten logical block"; default: return "Unknown"; } }