nvmet: set 'CNTRLTYPE' in the identify controller data
authorHannes Reinecke <hare@suse.de>
Wed, 22 Sep 2021 06:35:22 +0000 (08:35 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 20 Oct 2021 17:16:02 +0000 (19:16 +0200)
Set the correct 'CNTRLTYPE' field in the identify controller data.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/admin-cmd.c
drivers/nvme/target/discovery.c
drivers/nvme/target/fabrics-cmd.c

index b653ea4244fe95a8d0658828ddb561cfb7661dab..3616a06f783611eafe744b96daba172387c165cc 100644 (file)
@@ -374,6 +374,11 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
 
        id->rab = 6;
 
+       if (nvmet_is_disc_subsys(ctrl->subsys))
+               id->cntrltype = NVME_CTRL_DISC;
+       else
+               id->cntrltype = NVME_CTRL_IO;
+
        /*
         * XXX: figure out how we can assign a IEEE OUI, but until then
         * the safest is to leave it as zeroes.
index 7aa62bc6ae849dbc172ca38797226e841bae5e01..7b360f8d07e98523ed9104a6129c7da80c4978d5 100644 (file)
@@ -268,6 +268,8 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
        memcpy_and_pad(id->fr, sizeof(id->fr),
                       UTS_RELEASE, strlen(UTS_RELEASE), ' ');
 
+       id->cntrltype = NVME_CTRL_DISC;
+
        /* no limit on data transfer sizes for now */
        id->mdts = 0;
        id->cntlid = cpu_to_le16(ctrl->cntlid);
index 7d0454cee9205903fa69b96a7eaa7f87663f7115..70fb587e94136640aef465d8a21d85d643ee8476 100644 (file)
@@ -221,7 +221,8 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
                goto out;
        }
 
-       pr_info("creating controller %d for subsystem %s for NQN %s%s.\n",
+       pr_info("creating %s controller %d for subsystem %s for NQN %s%s.\n",
+               nvmet_is_disc_subsys(ctrl->subsys) ? "discovery" : "nvm",
                ctrl->cntlid, ctrl->subsys->subsysnqn, ctrl->hostnqn,
                ctrl->pi_support ? " T10-PI is enabled" : "");
        req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);