From 3febb1aa31ff44972243adf23b0b7906064ccdfa Mon Sep 17 00:00:00 2001 From: Steven Seungcheol Lee Date: Fri, 27 Mar 2020 19:27:18 +0900 Subject: [PATCH] nvme status code updates based nvme spec v1.4 --- linux/nvme.h | 19 +++++++++++++++++-- nvme-print.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/linux/nvme.h b/linux/nvme.h index 3381c4d0..640b9664 100644 --- a/linux/nvme.h +++ b/linux/nvme.h @@ -1299,20 +1299,28 @@ enum { NVME_SC_SGL_INVALID_DATA = 0xf, NVME_SC_SGL_INVALID_METADATA = 0x10, NVME_SC_SGL_INVALID_TYPE = 0x11, - + NVME_SC_CMB_INVALID_USE = 0x12, + NVME_SC_PRP_INVALID_OFFSET = 0x13, + NVME_SC_ATOMIC_WRITE_UNIT_EXCEEDED= 0x14, + NVME_SC_OPERATION_DENIED = 0x15, NVME_SC_SGL_INVALID_OFFSET = 0x16, - NVME_SC_SGL_INVALID_SUBTYPE = 0x17, + NVME_SC_INCONSISTENT_HOST_ID= 0x18, + NVME_SC_KEEP_ALIVE_EXPIRED = 0x19, + NVME_SC_KEEP_ALIVE_INVALID = 0x1A, + NVME_SC_PREEMPT_ABORT = 0x1B, NVME_SC_SANITIZE_FAILED = 0x1C, NVME_SC_SANITIZE_IN_PROGRESS = 0x1D, NVME_SC_NS_WRITE_PROTECTED = 0x20, NVME_SC_CMD_INTERRUPTED = 0x21, + NVME_SC_TRANSIENT_TRANSPORT = 0x22, NVME_SC_LBA_RANGE = 0x80, NVME_SC_CAP_EXCEEDED = 0x81, NVME_SC_NS_NOT_READY = 0x82, NVME_SC_RESERVATION_CONFLICT = 0x83, + NVME_SC_FORMAT_IN_PROGRESS = 0x84, /* * Command Specific Status: @@ -1345,8 +1353,15 @@ enum { NVME_SC_NS_NOT_ATTACHED = 0x11a, NVME_SC_THIN_PROV_NOT_SUPP = 0x11b, NVME_SC_CTRL_LIST_INVALID = 0x11c, + NVME_SC_DEVICE_SELF_TEST_IN_PROGRESS= 0x11d, NVME_SC_BP_WRITE_PROHIBITED = 0x11e, + NVME_SC_INVALID_CTRL_ID = 0x11f, + NVME_SC_INVALID_SECONDARY_CTRL_STATE= 0x120, + NVME_SC_INVALID_NUM_CTRL_RESOURCE = 0x121, + NVME_SC_INVALID_RESOURCE_ID = 0x122, NVME_SC_PMR_SAN_PROHIBITED = 0x123, + NVME_SC_ANA_INVALID_GROUP_ID= 0x124, + NVME_SC_ANA_ATTACH_FAIL = 0x125, /* * I/O Command Set Specific - NVM commands: diff --git a/nvme-print.c b/nvme-print.c index 579ac100..c63de13c 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -3807,6 +3807,34 @@ const char *nvme_status_to_string(__u32 status) 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_SGL_INVALID_LAST: + return "SGL_INVALID_LAST: The command includes an invalid SGL Last Segment or SGL Segment descriptor."; + case NVME_SC_SGL_INVALID_COUNT: + return "SGL_INVALID_COUNT: There is an SGL Last Segment descriptor or an SGL Segment descriptor in a location other than the last descriptor of a segment based on the length indicated."; + case NVME_SC_SGL_INVALID_DATA: + return "SGL_INVALID_DATA: This may occur if the length of a Data SGL is too short."; + case NVME_SC_SGL_INVALID_METADATA: + return "SGL_INVALID_METADATA: This may occur if the length of a Metadata SGL is too short"; + case NVME_SC_SGL_INVALID_TYPE: + return "SGL_INVALID_TYPE: The type of an SGL Descriptor is a type that is not supported by the controller."; + case NVME_SC_CMB_INVALID_USE: + return "CMB_INVALID_USE: The attempted use of the Controller Memory Buffer is not supported by the controller."; + case NVME_SC_PRP_INVALID_OFFSET: + return "PRP_INVALID_OFFSET: The Offset field for a PRP entry is invalid."; + case NVME_SC_ATOMIC_WRITE_UNIT_EXCEEDED: + return "ATOMIC_WRITE_UNIT_EXCEEDED: The length specified exceeds the atomic write unit size."; + case NVME_SC_OPERATION_DENIED: + return "OPERATION_DENIED: The command was denied due to lack of access rights."; + case NVME_SC_SGL_INVALID_OFFSET: + return "SGL_INVALID_OFFSET: The offset specified in a descriptor is invalid."; + case NVME_SC_INCONSISTENT_HOST_ID: + return "INCONSISTENT_HOST_ID: The NVM subsystem detected the simultaneous use of 64-bit and 128-bit Host Identifier values on different controllers."; + case NVME_SC_KEEP_ALIVE_EXPIRED: + return "KEEP_ALIVE_EXPIRED: The Keep Alive Timer expired."; + case NVME_SC_KEEP_ALIVE_INVALID: + return "KEEP_ALIVE_INVALID: The Keep Alive Timeout value specified is invalid."; + case NVME_SC_PREEMPT_ABORT: + return "PREEMPT_ABORT: The command was aborted due to a Reservation Acquire command with the Reservation Acquire Action (RACQA) set to 010b (Preempt and Abort)."; 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: @@ -3815,12 +3843,16 @@ const char *nvme_status_to_string(__u32 status) return "LBA_RANGE: The command references a LBA that exceeds the size of the namespace"; case NVME_SC_NS_WRITE_PROTECTED: return "NS_WRITE_PROTECTED: The command is prohibited while the namespace is write protected by the host."; + case NVME_SC_TRANSIENT_TRANSPORT: + return "TRANSIENT_TRANSPORT: A transient transport error was detected."; 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 as a result of a condition other than a condition that is reported as an Asymmetric Namespace Access condition"; 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_FORMAT_IN_PROGRESS: + return "FORMAT_IN_PROGRESS: A Format NVM command is in progress on the 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: @@ -3877,8 +3909,22 @@ const char *nvme_status_to_string(__u32 status) 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_DEVICE_SELF_TEST_IN_PROGRESS: + return "DEVICE_SELF_TEST_IN_PROGRESS: The controller or NVM subsystem already has a device self-test operation in process."; 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_INVALID_CTRL_ID: + return "INVALID_CTRL_ID: An invalid Controller Identifier was specified."; + case NVME_SC_INVALID_SECONDARY_CTRL_STATE: + return "INVALID_SECONDARY_CTRL_STATE: The action requested for the secondary controller is invalid based on the current state of the secondary controller and its primary controller."; + case NVME_SC_INVALID_NUM_CTRL_RESOURCE: + return "INVALID_NUM_CTRL_RESOURCE: The specified number of Flexible Resources is invalid"; + case NVME_SC_INVALID_RESOURCE_ID: + return "INVALID_RESOURCE_ID: At least one of the specified resource identifiers was invalid"; + case NVME_SC_ANA_INVALID_GROUP_ID: + return "ANA_INVALID_GROUP_ID: The specified ANA Group Identifier (ANAGRPID) is not supported in the submitted command."; + case NVME_SC_ANA_ATTACH_FAIL: + return "ANA_ATTACH_FAIL: The controller is not attached to the namespace as a result of an ANA condition"; case NVME_SC_BAD_ATTRIBUTES: return "BAD_ATTRIBUTES: Bad attributes were given"; case NVME_SC_WRITE_FAULT: -- 2.50.1