nvme: Add a helper function to return status type string
Add spdk_nvme_cpl_get_status_type_string() to return ASCII string for the type of an error. Append a dummy entry to return "RESERVED" for unknown types. Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: Ibc07132ee067f146ac149884c6344f313bfcbfff Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15835 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
8f990f5e47
commit
ce92d919d7
@ -3750,6 +3750,14 @@ void spdk_nvme_qpair_remove_cmd_error_injection(struct spdk_nvme_ctrlr *ctrlr,
|
|||||||
*/
|
*/
|
||||||
const char *spdk_nvme_cpl_get_status_string(const struct spdk_nvme_status *status);
|
const char *spdk_nvme_cpl_get_status_string(const struct spdk_nvme_status *status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Given NVMe status, return ASCII string for the type of that error.
|
||||||
|
*
|
||||||
|
* \param status Status from NVMe completion queue element.
|
||||||
|
* \return Returns status type as an ASCII string.
|
||||||
|
*/
|
||||||
|
const char *spdk_nvme_cpl_get_status_type_string(const struct spdk_nvme_status *status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Prints (SPDK_NOTICELOG) the contents of an NVMe submission queue entry (command).
|
* \brief Prints (SPDK_NOTICELOG) the contents of an NVMe submission queue entry (command).
|
||||||
*
|
*
|
||||||
|
@ -7,7 +7,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
|||||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||||
|
|
||||||
SO_VER := 9
|
SO_VER := 9
|
||||||
SO_MINOR := 0
|
SO_MINOR := 1
|
||||||
|
|
||||||
C_SRCS = nvme_ctrlr_cmd.c nvme_ctrlr.c nvme_fabric.c nvme_ns_cmd.c \
|
C_SRCS = nvme_ctrlr_cmd.c nvme_ctrlr.c nvme_fabric.c nvme_ns_cmd.c \
|
||||||
nvme_ns.c nvme_pcie_common.c nvme_pcie.c nvme_qpair.c nvme.c \
|
nvme_ns.c nvme_pcie_common.c nvme_pcie.c nvme_qpair.c nvme.c \
|
||||||
|
@ -279,6 +279,15 @@ spdk_nvme_qpair_print_command(struct spdk_nvme_qpair *qpair, struct spdk_nvme_cm
|
|||||||
spdk_nvme_print_command(qpair->id, cmd);
|
spdk_nvme_print_command(qpair->id, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct nvme_string status_type[] = {
|
||||||
|
{ SPDK_NVME_SCT_GENERIC, "GENERIC" },
|
||||||
|
{ SPDK_NVME_SCT_COMMAND_SPECIFIC, "COMMAND SPECIFIC" },
|
||||||
|
{ SPDK_NVME_SCT_MEDIA_ERROR, "MEDIA ERROR" },
|
||||||
|
{ SPDK_NVME_SCT_PATH, "PATH" },
|
||||||
|
{ SPDK_NVME_SCT_VENDOR_SPECIFIC, "VENDOR SPECIFIC" },
|
||||||
|
{ 0xFFFF, "RESERVED" },
|
||||||
|
};
|
||||||
|
|
||||||
static const struct nvme_string generic_status[] = {
|
static const struct nvme_string generic_status[] = {
|
||||||
{ SPDK_NVME_SC_SUCCESS, "SUCCESS" },
|
{ SPDK_NVME_SC_SUCCESS, "SUCCESS" },
|
||||||
{ SPDK_NVME_SC_INVALID_OPCODE, "INVALID OPCODE" },
|
{ SPDK_NVME_SC_INVALID_OPCODE, "INVALID OPCODE" },
|
||||||
@ -445,6 +454,12 @@ spdk_nvme_cpl_get_status_string(const struct spdk_nvme_status *status)
|
|||||||
return nvme_get_string(entry, status->sc);
|
return nvme_get_string(entry, status->sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
spdk_nvme_cpl_get_status_type_string(const struct spdk_nvme_status *status)
|
||||||
|
{
|
||||||
|
return nvme_get_string(status_type, status->sct);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spdk_nvme_print_completion(uint16_t qid, struct spdk_nvme_cpl *cpl)
|
spdk_nvme_print_completion(uint16_t qid, struct spdk_nvme_cpl *cpl)
|
||||||
{
|
{
|
||||||
|
@ -183,6 +183,7 @@
|
|||||||
spdk_nvme_print_completion;
|
spdk_nvme_print_completion;
|
||||||
|
|
||||||
spdk_nvme_cpl_get_status_string;
|
spdk_nvme_cpl_get_status_string;
|
||||||
|
spdk_nvme_cpl_get_status_type_string;
|
||||||
|
|
||||||
spdk_nvme_rdma_init_hooks;
|
spdk_nvme_rdma_init_hooks;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user