nvme: make set_num_qpairs failure non-fatal

A controller that fails the Set Features/Get Features - Number of Queues
won't be able to create I/O queues, but it may still accept admin
commands.

Change-Id: Iec79d641f7d460448a8d8e1295764f1f03f98594
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/407378
Tested-by: 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:
Daniel Verkamp 2018-04-11 16:40:14 -07:00
parent c43dc1f1e3
commit c9ef7642c9

View File

@ -902,7 +902,6 @@ nvme_ctrlr_set_num_qpairs(struct spdk_nvme_ctrlr *ctrlr)
} }
if (spdk_nvme_cpl_is_error(&status.cpl)) { if (spdk_nvme_cpl_is_error(&status.cpl)) {
SPDK_ERRLOG("nvme_set_num_queues failed!\n"); SPDK_ERRLOG("nvme_set_num_queues failed!\n");
return -ENXIO;
} }
/* Obtain the number of queues allocated using Get Features. */ /* Obtain the number of queues allocated using Get Features. */
@ -917,26 +916,26 @@ nvme_ctrlr_set_num_qpairs(struct spdk_nvme_ctrlr *ctrlr)
} }
if (spdk_nvme_cpl_is_error(&status.cpl)) { if (spdk_nvme_cpl_is_error(&status.cpl)) {
SPDK_ERRLOG("nvme_set_num_queues failed!\n"); SPDK_ERRLOG("nvme_set_num_queues failed!\n");
return -ENXIO; ctrlr->opts.num_io_queues = 0;
} else {
/*
* Data in cdw0 is 0-based.
* Lower 16-bits indicate number of submission queues allocated.
* Upper 16-bits indicate number of completion queues allocated.
*/
sq_allocated = (status.cpl.cdw0 & 0xFFFF) + 1;
cq_allocated = (status.cpl.cdw0 >> 16) + 1;
/*
* For 1:1 queue mapping, set number of allocated queues to be minimum of
* submission and completion queues.
*/
min_allocated = spdk_min(sq_allocated, cq_allocated);
/* Set number of queues to be minimum of requested and actually allocated. */
ctrlr->opts.num_io_queues = spdk_min(min_allocated, ctrlr->opts.num_io_queues);
} }
/*
* Data in cdw0 is 0-based.
* Lower 16-bits indicate number of submission queues allocated.
* Upper 16-bits indicate number of completion queues allocated.
*/
sq_allocated = (status.cpl.cdw0 & 0xFFFF) + 1;
cq_allocated = (status.cpl.cdw0 >> 16) + 1;
/*
* For 1:1 queue mapping, set number of allocated queues to be minimum of
* submission and completion queues.
*/
min_allocated = spdk_min(sq_allocated, cq_allocated);
/* Set number of queues to be minimum of requested and actually allocated. */
ctrlr->opts.num_io_queues = spdk_min(min_allocated, ctrlr->opts.num_io_queues);
ctrlr->free_io_qids = spdk_bit_array_create(ctrlr->opts.num_io_queues + 1); ctrlr->free_io_qids = spdk_bit_array_create(ctrlr->opts.num_io_queues + 1);
if (ctrlr->free_io_qids == NULL) { if (ctrlr->free_io_qids == NULL) {
return -ENOMEM; return -ENOMEM;