public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme-fabrics: check max outstanding commands
@ 2024-02-23  3:30 Guixin Liu
  2024-02-27  6:05 ` Guixin Liu
  2024-02-27 17:46 ` Keith Busch
  0 siblings, 2 replies; 7+ messages in thread
From: Guixin Liu @ 2024-02-23  3:30 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme

Maxcmd is mandatory for fabrics, check it early to identify the root
cause instead of waiting for it to propagate to "sqsize" and "allocing
queue".

By the way, change nvme_check_ctrl_fabric_info() to
nvmf_validate_identify_ctrl().

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/nvme/host/core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 0a96362912ce..5cdd22f591f9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3084,7 +3084,8 @@ static int nvme_init_effects(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 	return 0;
 }
 
-static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
+static int nvmf_validate_identify_ctrl(struct nvme_ctrl *ctrl,
+				       struct nvme_id_ctrl *id)
 {
 	/*
 	 * In fabrics we need to verify the cntlid matches the
@@ -3117,6 +3118,11 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
 		return -EINVAL;
 	}
 
+	if (!ctrl->maxcmd) {
+		dev_err(ctrl->device, "Maximum outstanding commands is 0\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
@@ -3232,7 +3238,7 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
 		ctrl->iorcsz = le32_to_cpu(id->iorcsz);
 		ctrl->maxcmd = le16_to_cpu(id->maxcmd);
 
-		ret = nvme_check_ctrl_fabric_info(ctrl, id);
+		ret = nvmf_validate_identify_ctrl(ctrl, id);
 		if (ret)
 			goto out_free;
 	} else {
-- 
2.43.0



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

end of thread, other threads:[~2024-02-28 15:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23  3:30 [PATCH] nvme-fabrics: check max outstanding commands Guixin Liu
2024-02-27  6:05 ` Guixin Liu
2024-02-27 17:46 ` Keith Busch
2024-02-28  2:23   ` Guixin Liu
2024-02-28  7:27     ` Daniel Wagner
2024-02-28  9:54       ` Guixin Liu
2024-02-28 15:38         ` Daniel Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox