]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nvmet: implement active command set ns list
authorKeith Busch <kbusch@kernel.org>
Mon, 4 Nov 2024 21:24:36 +0000 (13:24 -0800)
committerKeith Busch <kbusch@kernel.org>
Mon, 11 Nov 2024 17:49:48 +0000 (09:49 -0800)
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>
Reviewed-by: Matias Bjørling <matias.bjorling@wdc.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/admin-cmd.c
include/linux/nvme.h

index 3bf2e06baad788ecba926b0b8822b7c0e82770ff..c59e21434833ecb1d9dd3061c5d9ca4e2c8a079f 100644 (file)
@@ -592,7 +592,7 @@ out:
        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;
@@ -622,6 +622,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;
@@ -728,7 +730,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);
@@ -759,6 +761,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",
index 0179bb6d502d84151d72f5f558d8defa16e8597c..26de7c5c12be75a14e419212df0ef579475e6428 100644 (file)
@@ -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,