diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 24c3e1d36..be76a761f 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -902,7 +902,6 @@ nvme_ctrlr_set_num_qpairs(struct spdk_nvme_ctrlr *ctrlr) } if (spdk_nvme_cpl_is_error(&status.cpl)) { SPDK_ERRLOG("nvme_set_num_queues failed!\n"); - return -ENXIO; } /* 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)) { 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); if (ctrlr->free_io_qids == NULL) { return -ENOMEM;