nvme: add ERROR controller states in initialization

Change-Id: I1e5be0e282b9e29f7bf7ca7d2720b9fd00539be0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/424776
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2018-09-06 21:05:51 -04:00 committed by Jim Harris
parent e9b5420f70
commit 1c79fadb23
2 changed files with 12 additions and 1 deletions

View File

@ -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);

View File

@ -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