From 1c79fadb23c49bade8752d41d2c22f1f5461cb6f Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Thu, 6 Sep 2018 21:05:51 -0400 Subject: [PATCH] nvme: add ERROR controller states in initialization Change-Id: I1e5be0e282b9e29f7bf7ca7d2720b9fd00539be0 Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/424776 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/nvme/nvme_ctrlr.c | 6 ++++++ lib/nvme/nvme_internal.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 290a37225..9c54d1fbd 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -638,6 +638,8 @@ nvme_ctrlr_state_string(enum nvme_ctrlr_state state) return "set host ID"; case NVME_CTRLR_STATE_READY: return "ready"; + case NVME_CTRLR_STATE_ERROR: + return "error"; } return "unknown"; }; @@ -1772,6 +1774,10 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr) SPDK_DEBUGLOG(SPDK_LOG_NVME, "Ctrlr already in ready state\n"); return 0; + case NVME_CTRLR_STATE_ERROR: + SPDK_ERRLOG("Ctrlr %s is in error state\n", ctrlr->trid.traddr); + return -1; + default: assert(0); nvme_ctrlr_fail(ctrlr, false); diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index eba34ffa1..419f4a8a5 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -465,7 +465,12 @@ enum nvme_ctrlr_state { /** * Controller initialization has completed and the controller is ready. */ - NVME_CTRLR_STATE_READY + NVME_CTRLR_STATE_READY, + + /** + * Controller inilialization has an error. + */ + NVME_CTRLR_STATE_ERROR }; #define NVME_TIMEOUT_INFINITE UINT64_MAX