linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] nvmet: don't check iosqes, iocqes for discovery controllers
@ 2021-02-09 10:12 Sagi Grimberg
  2021-02-09 10:12 ` [PATCH 2/2] nvme: don't set iosqes,iocqes " Sagi Grimberg
  2021-02-10 10:10 ` [PATCH 1/2] nvmet: don't check " Christoph Hellwig
  0 siblings, 2 replies; 11+ messages in thread
From: Sagi Grimberg @ 2021-02-09 10:12 UTC (permalink / raw)
  To: linux-nvme, Keith Busch, Christoph Hellwig; +Cc: Martin.Belanger

From the base spec, Figure 78:
"Controller Configuration, these fields are defined as parameters to
configure an "I/O Controller (IOC)" and not to configure a "Discovery
Controller (DC)".
...
"If the controller does not support I/O queues, then this field shall
be read-only with a value of 0h"

Just have this check for I/O controllers.

Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
Reported-by: Belanger, Martin <Martin.Belanger@dell.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/target/core.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 8ce4d59cc9e7..baa26a65d83d 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1107,9 +1107,14 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
 {
 	lockdep_assert_held(&ctrl->lock);
 
-	if (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
-	    nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES ||
-	    nvmet_cc_mps(ctrl->cc) != 0 ||
+	if (!ctrl->subsys->type == NVME_NQN_DISC &&
+	    (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
+	     nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) {
+		ctrl->csts = NVME_CSTS_CFS;
+		return;
+	}
+
+	if (nvmet_cc_mps(ctrl->cc) != 0 ||
 	    nvmet_cc_ams(ctrl->cc) != 0 ||
 	    nvmet_cc_css(ctrl->cc) != 0) {
 		ctrl->csts = NVME_CSTS_CFS;
-- 
2.27.0


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-24  9:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 10:12 [PATCH 1/2] nvmet: don't check iosqes, iocqes for discovery controllers Sagi Grimberg
2021-02-09 10:12 ` [PATCH 2/2] nvme: don't set iosqes,iocqes " Sagi Grimberg
2021-02-10 10:11   ` Christoph Hellwig
2021-02-10 22:37     ` Sagi Grimberg
2021-02-11  7:02       ` Christoph Hellwig
2021-02-11 10:43         ` Sagi Grimberg
2021-02-11 18:31           ` Christoph Hellwig
2021-02-11 19:44             ` Sagi Grimberg
2021-02-24  9:08               ` Christoph Hellwig
2021-02-10 10:10 ` [PATCH 1/2] nvmet: don't check " Christoph Hellwig
2021-02-10 22:34   ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).