[PATCH] nvme: Use NN for max_namespaces if MNAN is zero
Daniel Wagner
dwagner at suse.de
Fri May 21 07:47:34 PDT 2021
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 at 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
More information about the Linux-nvme
mailing list