Skip to contentSkip to conversation

nvme: align "fake" nqn with spec 1.3

PATCH In review Linjun Bao 2 participants 4 messages Aug 10, 2022 – Sep 5, 2022 NVMe

lore
Share & tools
lore

Linjun Bao

author
#0 lore raw

PATCH 1/1 nvme: align "fake" nqn with spec 1.3

Replace '.' with '-' to align "fake" nqn format with nvme spec 1.3 or newer.

---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index d2ea6ca37c41..d6fb91bbcf9e 100644
@@ -2504,7 +2504,7 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
 
 	/* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
 	off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
-			"nqn.2014.08.org.nvmexpress:%04x%04x",
+			"nqn.2014-08.org.nvmexpress:%04x%04x",
 			le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
 	memcpy(subsys->subnqn + off, id->sn, sizeof(id->sn));
 	off += sizeof(id->sn);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 1 line · Linjun Bao

Replace '.' with '-' to align "fake" nqn format with nvme spec 1.3 or newer.

We can't just change the existing NQN construction if we don't want to break userspace. Maybe add a comment that it is different from the canonical version for historic reasons instead.

author
#2 lore raw

PATCH 1/1 nvme: add comment for unaligned "fake" nqn

Current "fake" nqn field is "nqn.2014.08.org.nvmexpress:", it is not aligned with the canonical version for history reasons.

---
 drivers/nvme/host/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +5 -1
index af367b22871b..e72021212971 100644
@@ -2704,7 +2704,11 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
 			dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
 	}
 
-	/* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
+	/*
+	 * Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001,
+	 * the NSS field is different from the canonical version 
+	 * "nqn.2014-08.org.nvmexpress:" for historic reasons. 
+	 */
 	off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
 			"nqn.2014.08.org.nvmexpress:%04x%04x",
 			le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
Signature · 1 line
2.25.1
maintainer Applied
#3 lore raw

Re: [PATCH] nvme: add comment for unaligned "fake" nqn

Thanks,

applied to nvme-6.1.