All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Use NN for max_namespaces if MNAN is zero
@ 2021-05-21 14:47 ` Daniel Wagner
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Wagner @ 2021-05-21 14:47 UTC (permalink / raw)
  To: linux-nvme
  Cc: linux-kernel, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Daniel Wagner

NVMe 1.4 states that MNAN might be zero, in which case we should
evaluate NN to get the number of supported namespaces.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/nvme/host/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e7441ccaa8db..32457c77c9ab 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2905,6 +2905,8 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
 	ctrl->sgls = le32_to_cpu(id->sgls);
 	ctrl->kas = le16_to_cpu(id->kas);
 	ctrl->max_namespaces = le32_to_cpu(id->mnan);
+	if (!ctrl->max_namespaces)
+		ctrl->max_namespaces = le32_to_cpu(id->nn);
 	ctrl->ctratt = le32_to_cpu(id->ctratt);
 
 	if (id->rtd3e) {
-- 
2.29.2


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

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

end of thread, other threads:[~2021-05-25  7:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-21 14:47 [PATCH] nvme: Use NN for max_namespaces if MNAN is zero Daniel Wagner
2021-05-21 14:47 ` Daniel Wagner
2021-05-21 14:53 ` Daniel Wagner
2021-05-21 14:53   ` Daniel Wagner
2021-05-21 15:27   ` Keith Busch
2021-05-21 15:27     ` Keith Busch
2021-05-21 20:19     ` Sagi Grimberg
2021-05-21 20:19       ` Sagi Grimberg
2021-05-24  7:37       ` Christoph Hellwig
2021-05-24  7:37         ` Christoph Hellwig
2021-05-25  7:12         ` Daniel Wagner
2021-05-25  7:12           ` Daniel Wagner
2021-05-25  7:22           ` Christoph Hellwig
2021-05-25  7:22             ` Christoph Hellwig
2021-05-25  7:52             ` Daniel Wagner
2021-05-25  7:52               ` Daniel Wagner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.