linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: align "fake" nqn with spec 1.3
@ 2022-08-10 13:39 Linjun Bao
  2022-08-10 14:08 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Linjun Bao @ 2022-08-10 13:39 UTC (permalink / raw)
  Cc: Linjun Bao, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, linux-nvme, linux-kernel

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

Signed-off-by: Linjun Bao <meljbao@gmail.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d2ea6ca37c41..d6fb91bbcf9e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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);
-- 
2.25.1


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

* Re: [PATCH] nvme: align "fake" nqn with spec 1.3
  2022-08-10 13:39 [PATCH] nvme: align "fake" nqn with spec 1.3 Linjun Bao
@ 2022-08-10 14:08 ` Christoph Hellwig
  2022-08-11  7:40   ` [PATCH] nvme: add comment for unaligned "fake" nqn Linjun Bao
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-08-10 14:08 UTC (permalink / raw)
  To: Linjun Bao
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel

On Wed, Aug 10, 2022 at 09:39:54PM +0800, Linjun Bao wrote:
> 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.

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

* [PATCH] nvme: add comment for unaligned "fake" nqn
  2022-08-10 14:08 ` Christoph Hellwig
@ 2022-08-11  7:40   ` Linjun Bao
  2022-09-05 11:02     ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Linjun Bao @ 2022-08-11  7:40 UTC (permalink / raw)
  Cc: Linjun Bao, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, linux-nvme, linux-kernel

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

Signed-off-by: Linjun Bao <meljbao@gmail.com>
---
 drivers/nvme/host/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index af367b22871b..e72021212971 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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));
-- 
2.25.1


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

* Re: [PATCH] nvme: add comment for unaligned "fake" nqn
  2022-08-11  7:40   ` [PATCH] nvme: add comment for unaligned "fake" nqn Linjun Bao
@ 2022-09-05 11:02     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2022-09-05 11:02 UTC (permalink / raw)
  To: Linjun Bao
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel

Thanks,

applied to nvme-6.1.

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

end of thread, other threads:[~2022-09-05 11:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 13:39 [PATCH] nvme: align "fake" nqn with spec 1.3 Linjun Bao
2022-08-10 14:08 ` Christoph Hellwig
2022-08-11  7:40   ` [PATCH] nvme: add comment for unaligned "fake" nqn Linjun Bao
2022-09-05 11:02     ` Christoph Hellwig

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).