From b8eaa9679132c5e701c7ecd5bd1050ed1bc2a458 Mon Sep 17 00:00:00 2001 From: Jacek Kalwas Date: Wed, 25 Mar 2020 18:53:30 +0100 Subject: [PATCH] nvme: fix issue with io queue size The quirk can only be applied when not exceeding mqes. Given codition is not enough as DEFAULT_IO_QUEUE_SIZE can be equal mqes + 1. In such case driver is unable to create io queues. Signed-off-by: Jacek Kalwas Change-Id: I72de37ee413788ffd3483e814eded21ea05997c9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1456 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk Reviewed-by: Darek Stojaczyk --- lib/nvme/nvme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/nvme/nvme.c b/lib/nvme/nvme.c index 141df48196..d8b88cef50 100644 --- a/lib/nvme/nvme.c +++ b/lib/nvme/nvme.c @@ -472,8 +472,9 @@ nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid, /* 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(DEFAULT_IO_QUEUE_SIZE_FOR_QUIRK, ctrlr->cap.bits.mqes + 1u); } nvme_qpair_set_state(ctrlr->adminq, NVME_QPAIR_ENABLED);