nvme: broken up nvme_ctrlr_set_num_qpairs() into set/get functions
Change-Id: If5744389ae36f9af0964040d30f81afca3fc4962 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/425063 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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
5a02886075
commit
8b95dbab84
@ -622,8 +622,10 @@ nvme_ctrlr_state_string(enum nvme_ctrlr_state state)
|
|||||||
return "identify controller";
|
return "identify controller";
|
||||||
case NVME_CTRLR_STATE_WAIT_FOR_IDENTIFY:
|
case NVME_CTRLR_STATE_WAIT_FOR_IDENTIFY:
|
||||||
return "wait for identify controller";
|
return "wait for identify controller";
|
||||||
case NVME_CTRLR_STATE_SET_NUM_QPAIRS:
|
case NVME_CTRLR_STATE_SET_NUM_QUEUES:
|
||||||
return "set number of queues";
|
return "set number of queues";
|
||||||
|
case NVME_CTRLR_STATE_GET_NUM_QUEUES:
|
||||||
|
return "get number of queues";
|
||||||
case NVME_CTRLR_STATE_CONSTRUCT_NS:
|
case NVME_CTRLR_STATE_CONSTRUCT_NS:
|
||||||
return "construct namespaces";
|
return "construct namespaces";
|
||||||
case NVME_CTRLR_STATE_CONFIGURE_AER:
|
case NVME_CTRLR_STATE_CONFIGURE_AER:
|
||||||
@ -856,7 +858,7 @@ nvme_ctrlr_identify_done(void *arg, const struct spdk_nvme_cpl *cpl)
|
|||||||
ctrlr->max_sges = nvme_transport_ctrlr_get_max_sges(ctrlr);
|
ctrlr->max_sges = nvme_transport_ctrlr_get_max_sges(ctrlr);
|
||||||
}
|
}
|
||||||
|
|
||||||
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_SET_NUM_QPAIRS, NVME_TIMEOUT_INFINITE);
|
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_SET_NUM_QUEUES, NVME_TIMEOUT_INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -949,10 +951,9 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvme_ctrlr_set_num_qpairs(struct spdk_nvme_ctrlr *ctrlr)
|
nvme_ctrlr_set_num_queues(struct spdk_nvme_ctrlr *ctrlr)
|
||||||
{
|
{
|
||||||
struct nvme_completion_poll_status status;
|
struct nvme_completion_poll_status status;
|
||||||
uint32_t cq_allocated, sq_allocated, min_allocated, i;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (ctrlr->opts.num_io_queues > SPDK_NVME_MAX_IO_QUEUES) {
|
if (ctrlr->opts.num_io_queues > SPDK_NVME_MAX_IO_QUEUES) {
|
||||||
@ -974,6 +975,16 @@ nvme_ctrlr_set_num_qpairs(struct spdk_nvme_ctrlr *ctrlr)
|
|||||||
SPDK_ERRLOG("Set Features - Number of Queues failed!\n");
|
SPDK_ERRLOG("Set Features - Number of Queues failed!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
nvme_ctrlr_get_num_queues(struct spdk_nvme_ctrlr *ctrlr)
|
||||||
|
{
|
||||||
|
struct nvme_completion_poll_status status;
|
||||||
|
uint32_t cq_allocated, sq_allocated, min_allocated, i;
|
||||||
|
int rc;
|
||||||
|
|
||||||
/* Obtain the number of queues allocated using Get Features. */
|
/* Obtain the number of queues allocated using Get Features. */
|
||||||
rc = nvme_ctrlr_cmd_get_num_queues(ctrlr, nvme_completion_poll_cb, &status);
|
rc = nvme_ctrlr_cmd_get_num_queues(ctrlr, nvme_completion_poll_cb, &status);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
@ -1778,8 +1789,13 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
|
|||||||
spdk_nvme_qpair_process_completions(ctrlr->adminq, 0);
|
spdk_nvme_qpair_process_completions(ctrlr->adminq, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NVME_CTRLR_STATE_SET_NUM_QPAIRS:
|
case NVME_CTRLR_STATE_SET_NUM_QUEUES:
|
||||||
rc = nvme_ctrlr_set_num_qpairs(ctrlr);
|
rc = nvme_ctrlr_set_num_queues(ctrlr);
|
||||||
|
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_GET_NUM_QUEUES, NVME_TIMEOUT_INFINITE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NVME_CTRLR_STATE_GET_NUM_QUEUES:
|
||||||
|
rc = nvme_ctrlr_get_num_queues(ctrlr);
|
||||||
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_CONSTRUCT_NS, NVME_TIMEOUT_INFINITE);
|
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_CONSTRUCT_NS, NVME_TIMEOUT_INFINITE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -428,9 +428,14 @@ enum nvme_ctrlr_state {
|
|||||||
NVME_CTRLR_STATE_WAIT_FOR_IDENTIFY,
|
NVME_CTRLR_STATE_WAIT_FOR_IDENTIFY,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup Number of Queues of the controller.
|
* Set Number of Queues of the controller.
|
||||||
*/
|
*/
|
||||||
NVME_CTRLR_STATE_SET_NUM_QPAIRS,
|
NVME_CTRLR_STATE_SET_NUM_QUEUES,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Number of Queues of the controller.
|
||||||
|
*/
|
||||||
|
NVME_CTRLR_STATE_GET_NUM_QUEUES,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct Namespaces of the controller.
|
* Construct Namespaces of the controller.
|
||||||
|
Loading…
Reference in New Issue
Block a user