nvme: fix DEFAULT_IO_QUEUE_SIZE_FOR_QUIRK handling

We need to wait to process this quirk until after we
have a valid CAP register value.  Before this fix,
controllers with this quirk would get their io_queue_size
always capped at 2 (min io queue size) because CAP hadn't
actually been read yet.

Fixes: f5ba8a5e (nvme: add NVME_CTRLR_STATE_READ_CAP)

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4df87b5dfb0faa21db5b4cf6fc667d80621d1691

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8211
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Jim Harris 2021-06-08 07:30:53 -07:00 committed by Tomasz Zawadzki
parent 5e4fe0adc8
commit 6564bd94ba
2 changed files with 9 additions and 10 deletions

View File

@ -678,16 +678,6 @@ nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid,
ctrlr->remove_cb = probe_ctx->remove_cb;
ctrlr->cb_ctx = probe_ctx->cb_ctx;
if (ctrlr->quirks & NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE &&
ctrlr->opts.io_queue_size == DEFAULT_IO_QUEUE_SIZE) {
/* If the user specifically set an IO queue size different than the
* default, use that value. Otherwise overwrite with the quirked value.
* This allows this quirk to be overridden when necessary.
* However, cap.mqes still needs to be respected.
*/
ctrlr->opts.io_queue_size = spdk_min(DEFAULT_IO_QUEUE_SIZE_FOR_QUIRK, ctrlr->cap.bits.mqes + 1u);
}
nvme_qpair_set_state(ctrlr->adminq, NVME_QPAIR_ENABLED);
TAILQ_INSERT_TAIL(&probe_ctx->init_ctrlrs, ctrlr, tailq);
return 0;

View File

@ -3522,6 +3522,15 @@ nvme_ctrlr_init_cap(struct spdk_nvme_ctrlr *ctrlr)
ctrlr->opts.io_queue_size = spdk_max(ctrlr->opts.io_queue_size, SPDK_NVME_IO_QUEUE_MIN_ENTRIES);
ctrlr->opts.io_queue_size = spdk_min(ctrlr->opts.io_queue_size, MAX_IO_QUEUE_ENTRIES);
if (ctrlr->quirks & NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE &&
ctrlr->opts.io_queue_size == DEFAULT_IO_QUEUE_SIZE) {
/* If the user specifically set an IO queue size different than the
* default, use that value. Otherwise overwrite with the quirked value.
* This allows this quirk to be overridden when necessary.
* However, cap.mqes still needs to be respected.
*/
ctrlr->opts.io_queue_size = DEFAULT_IO_QUEUE_SIZE_FOR_QUIRK;
}
ctrlr->opts.io_queue_size = spdk_min(ctrlr->opts.io_queue_size, ctrlr->cap.bits.mqes + 1u);
ctrlr->opts.io_queue_requests = spdk_max(ctrlr->opts.io_queue_requests, ctrlr->opts.io_queue_size);