Skip to content

Commit

Permalink
types,util: Added Enums for missing status codes
Browse files Browse the repository at this point in the history
Added enums for missing status codes based on NVM Express
Base Specification 2.1

Signed-off-by: Arbaz Khan <[email protected]>
Reviewed-by: Steven Seungcheol Lee <[email protected]>
  • Loading branch information
arbaz404 committed Feb 5, 2025
1 parent acc19fc commit bc15f8b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/nvme/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7649,6 +7649,14 @@ struct nvme_mi_vpd_hdr {
* @NVME_SC_ADMIN_CMD_MEDIA_NOT_READY: Admin Command Media Not Ready: The Admin
* command requires access to media and
* the media is not ready.
* @NVME_SC_INVALID_KEY_TAG: The command was aborted due to an invalid KEYTAG
* field value.

Check failure on line 7653 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* @NVME_SC_HOST_DISPERSED_NS_NOT_ENABLED: The command is prohibited while the
* Host Disperesed Namespace Support (HDISNS) field is not

Check failure on line 7655 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* set to 1h in the Host Behavior Support feature.

Check failure on line 7656 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* @NVME_SC_HOST_ID_NOT_INITIALIZED: Host Identifier Not Initialized.
* @NVME_SC_INCORRECT_KEY: The command was aborted due to the key associated
* with the KEYTAG field being incorrect.

Check failure on line 7659 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* @NVME_SC_FDP_DISABLED: Command is not allowed when
* Flexible Data Placement is disabled.
* @NVME_SC_INVALID_PLACEMENT_HANDLE_LIST: The Placement Handle List is invalid
Expand All @@ -7672,6 +7680,15 @@ struct nvme_mi_vpd_hdr {
* namespace.
* @NVME_SC_FORMAT_IN_PROGRESS: Format In Progress: A Format NVM command
* is in progress on the namespace.
* @NVME_SC_INVALID_VALUE_SIZE: The value size is not valid.
* @NVME_SC_INVALID_KEY_SIZE: The KV key size is not valid.
* @NVME_SC_KV_KEY_NOT_EXISTS: The Store If Key Exists (SIKE) bit is set to
* '1' in the Store Option field and the KV key does not

Check failure on line 7686 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* exists.

Check failure on line 7687 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* @NVME_SC_UNRECOVERED_ERROR: There was an unrecovered error when reading
* from the meidum.

Check failure on line 7689 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* @NVME_SC_KEY_EXISTS: The Store If No Key Exists (SINKE) bit is set to '1'
* in the Store Option field and the KV key exists.

Check failure on line 7691 in src/nvme/types.h

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: please, no space before tabs
* @NVME_SC_CQ_INVALID: Completion Queue Invalid: The Completion
* Queue identifier specified in the command
* does not exist.
Expand Down Expand Up @@ -8029,13 +8046,22 @@ enum nvme_status_field {
NVME_SC_TRAN_TPORT_ERROR = 0x22,
NVME_SC_PROHIBITED_BY_CMD_AND_FEAT = 0x23,
NVME_SC_ADMIN_CMD_MEDIA_NOT_READY = 0x24,
NVME_SC_INVALID_KEY_TAG = 0x25,
NVME_SC_HOST_DISPERSED_NS_NOT_ENABLED = 0x26,
NVME_SC_HOST_ID_NOT_INITIALIZED = 0x27,
NVME_SC_INCORRECT_KEY = 0x28,
NVME_SC_FDP_DISABLED = 0x29,
NVME_SC_INVALID_PLACEMENT_HANDLE_LIST = 0x2A,
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,
NVME_SC_INVALID_VALUE_SIZE = 0x85,
NVME_SC_INVALID_KEY_SIZE = 0x86,
NVME_SC_KV_KEY_NOT_EXISTS = 0x87,
NVME_SC_UNRECOVERED_ERROR = 0x88,
NVME_SC_KEY_EXISTS = 0x89,

/*
* Command Specific Status Codes:
Expand Down
13 changes: 13 additions & 0 deletions src/nvme/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ static inline __u8 nvme_generic_status_to_errno(__u16 status)
case NVME_SC_PRP_INVALID_OFFSET:
case NVME_SC_CMB_INVALID_USE:
case NVME_SC_KAT_INVALID:
case NVME_SC_INVALID_KEY_TAG:
case NVME_SC_INCORRECT_KEY:
case NVME_SC_INVALID_VALUE_SIZE:
case NVME_SC_INVALID_KEY_SIZE:
return EINVAL;
case NVME_SC_CMDID_CONFLICT:
return EADDRINUSE;
Expand Down Expand Up @@ -227,11 +231,20 @@ static const char * const generic_status[] = {
[NVME_SC_TRAN_TPORT_ERROR] = "Transient Transport Error: A transient transport error was detected",
[NVME_SC_PROHIBITED_BY_CMD_AND_FEAT] = "Command Prohibited by Command and Feature Lockdown: The command was aborted due to command execution being prohibited by the Command and Feature Lockdown",
[NVME_SC_ADMIN_CMD_MEDIA_NOT_READY] = "Admin Command Media Not Ready: The Admin command requires access to media and the media is not ready",
[NVME_SC_INVALID_KEY_TAG] = "The command was aborted due to an invalid KEYTAG field value",
[NVME_SC_HOST_DISPERSED_NS_NOT_ENABLED] = "The command is prohibited while the Host Disperesed Namespace Support (HDISNS) field is not set to 1h in the Host Behavior Support feature",

Check failure on line 235 in src/nvme/util.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 193 exceeds 120 columns
[NVME_SC_HOST_ID_NOT_INITIALIZED] = "Host Identifier Not Initialized",
[NVME_SC_INCORRECT_KEY] = "The command was aborted due to the key associated with the KEYTAG field being incorrect",

Check failure on line 237 in src/nvme/util.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 142 exceeds 120 columns
[NVME_SC_LBA_RANGE] = "LBA Out of Range: The command references an LBA that exceeds the size of the namespace",
[NVME_SC_CAP_EXCEEDED] = "Capacity Exceeded: Execution of the command has caused the capacity of the namespace to be exceeded",
[NVME_SC_NS_NOT_READY] = "Namespace Not Ready: The namespace is not ready to be accessed",
[NVME_SC_RESERVATION_CONFLICT] = "Reservation Conflict: The command was aborted due to a conflict with a reservation held on the accessed namespace",
[NVME_SC_FORMAT_IN_PROGRESS] = "Format In Progress: A Format NVM command is in progress on the namespace",
[NVME_SC_INVALID_VALUE_SIZE] = "The value size is not valid",
[NVME_SC_INVALID_KEY_SIZE] = "The KV key size is not valid",
[NVME_SC_KV_KEY_NOT_EXISTS] = "The Store If Key Exists (SIKE) bit is set to '1' in the Store Option field and the KV key does not exists",
[NVME_SC_UNRECOVERED_ERROR] = "There was an unrecovered error when reading from the medium",
[NVME_SC_KEY_EXISTS] = "The Store If No Key Exists (SINKE) bit is set to '1' in the Store Option field and the KV key exists",
};

static const char * const cmd_spec_status[] = {
Expand Down

0 comments on commit bc15f8b

Please sign in to comment.