From: Keith Busch <kbusch@meta.com>
To: <linux-nvme@lists.infradead.org>
Cc: <hch@lst.de>, <m@bjorling.me>, <matias.bjorling@wdc.com>,
<kch@nvidia.com>, <kanie@linux.alibaba.com>,
Keith Busch <kbusch@kernel.org>
Subject: [PATCHv4 02/13] nvmet: implement active command set ns list
Date: Thu, 7 Nov 2024 11:38:37 -0800 [thread overview]
Message-ID: <20241107193849.995554-3-kbusch@meta.com> (raw)
In-Reply-To: <20241107193849.995554-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
This is required for nvme 2.1 for targets that support multiple command
sets. We support NVM and ZNS, so are required to support this
identification.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/target/admin-cmd.c | 9 +++++++--
include/linux/nvme.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 8d06dba42bcb3..a13242e791c0f 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -576,7 +576,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)
nvmet_req_complete(req, status);
}
-static void nvmet_execute_identify_nslist(struct nvmet_req *req)
+static void nvmet_execute_identify_nslist(struct nvmet_req *req, bool match_css)
{
static const int buf_size = NVME_IDENTIFY_DATA_SIZE;
struct nvmet_ctrl *ctrl = req->sq->ctrl;
@@ -606,6 +606,8 @@ static void nvmet_execute_identify_nslist(struct nvmet_req *req)
xa_for_each(&ctrl->subsys->namespaces, idx, ns) {
if (ns->nsid <= min_nsid)
continue;
+ if (match_css && req->ns->csi != req->cmd->identify.csi)
+ continue;
list[i++] = cpu_to_le32(ns->nsid);
if (i == buf_size / sizeof(__le32))
break;
@@ -712,7 +714,7 @@ static void nvmet_execute_identify(struct nvmet_req *req)
nvmet_execute_identify_ctrl(req);
return;
case NVME_ID_CNS_NS_ACTIVE_LIST:
- nvmet_execute_identify_nslist(req);
+ nvmet_execute_identify_nslist(req, false);
return;
case NVME_ID_CNS_NS_DESC_LIST:
nvmet_execute_identify_desclist(req);
@@ -743,6 +745,9 @@ static void nvmet_execute_identify(struct nvmet_req *req)
break;
}
break;
+ case NVME_ID_CNS_NS_ACTIVE_LIST_CS:
+ nvmet_execute_identify_nslist(req, true);
+ return;
}
pr_debug("unhandled identify cns %d on qid %d\n",
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index b58d9405d65e0..0f263c7e63192 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -522,6 +522,7 @@ enum {
NVME_ID_CNS_NS_DESC_LIST = 0x03,
NVME_ID_CNS_CS_NS = 0x05,
NVME_ID_CNS_CS_CTRL = 0x06,
+ NVME_ID_CNS_NS_ACTIVE_LIST_CS = 0x07,
NVME_ID_CNS_NS_CS_INDEP = 0x08,
NVME_ID_CNS_NS_PRESENT_LIST = 0x10,
NVME_ID_CNS_NS_PRESENT = 0x11,
--
2.43.5
next prev parent reply other threads:[~2024-11-07 19:56 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 19:38 [PATCHv4 00/13] nvme target 2.1 and independent identify ns Keith Busch
2024-11-07 19:38 ` [PATCHv4 01/13] nvmet: implement id ns for nvm command set Keith Busch
2024-11-08 12:01 ` Matias Bjørling
2024-11-08 14:21 ` Christoph Hellwig
2024-11-07 19:38 ` Keith Busch [this message]
2024-11-08 12:10 ` [PATCHv4 02/13] nvmet: implement active command set ns list Matias Bjørling
2024-11-07 19:38 ` [PATCHv4 03/13] nvmet: implement supported log pages Keith Busch
2024-11-08 12:16 ` Matias Bjørling
2024-11-08 14:22 ` Christoph Hellwig
2024-11-11 1:57 ` Chaitanya Kulkarni
2024-11-07 19:38 ` [PATCHv4 04/13] nvmet: implement supported features log Keith Busch
2024-11-08 12:24 ` Matias Bjørling
2024-11-08 14:24 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 05/13] nvmet: implement crto property Keith Busch
2024-11-08 12:34 ` Matias Bjørling
2024-11-07 19:38 ` [PATCHv4 06/13] nvmet: declare 2.1 version compliance Keith Busch
2024-11-08 12:37 ` Matias Bjørling
2024-11-07 19:38 ` [PATCHv4 07/13] nvmet: implement endurance groups Keith Busch
2024-11-08 14:26 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 08/13] nvmet: implement rotational media information log Keith Busch
2024-11-07 19:38 ` [PATCHv4 09/13] nvmet: implement csi identify ns Keith Busch
2024-11-08 1:42 ` Guixin Liu
2024-11-08 14:26 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 10/13] nvme: use command set independent id ns if available Keith Busch
2024-11-08 14:26 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 11/13] nvme: add rotational support Keith Busch
2024-11-09 15:01 ` Guixin Liu
2024-11-07 19:38 ` [PATCHv4 12/13] nvme: check ns's volatile write cache not present Keith Busch
2024-11-07 19:38 ` [PATCHv4 13/13] nvmet: report ns's vwc " Keith Busch
2024-11-08 14:27 ` Christoph Hellwig
2024-11-08 16:15 ` Keith Busch
2024-11-09 14:59 ` Guixin Liu
2024-11-09 15:00 ` Guixin Liu
2024-11-12 22:49 ` Keith Busch
2024-11-13 1:51 ` Guixin Liu
2024-11-11 5:42 ` Christoph Hellwig
2024-11-11 5:41 ` Christoph Hellwig
2024-11-08 16:50 ` [PATCHv4 00/13] nvme target 2.1 and independent identify ns Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241107193849.995554-3-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=hch@lst.de \
--cc=kanie@linux.alibaba.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=m@bjorling.me \
--cc=matias.bjorling@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox