nvmet: set ctrl pi_support cap before initializing cap reg
authorMax Gurtovoy <mgurtovoy@nvidia.com>
Tue, 23 Jan 2024 14:40:28 +0000 (16:40 +0200)
committerKeith Busch <kbusch@kernel.org>
Sat, 2 Mar 2024 23:18:08 +0000 (15:18 -0800)
This is a preparation for setting the maximal queue size of a controller
that supports PI.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Israel Rukshin <israelr@nvidia.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/core.c
drivers/nvme/target/fabrics-cmd.c

index 8658e9c08534df50c466314c6c70d18d79525324..5d50f731c326aad8ab4354cc1f6d257bd493e49b 100644 (file)
@@ -1411,6 +1411,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 
        kref_init(&ctrl->ref);
        ctrl->subsys = subsys;
+       ctrl->pi_support = ctrl->port->pi_enable && ctrl->subsys->pi_support;
        nvmet_init_cap(ctrl);
        WRITE_ONCE(ctrl->aen_enabled, NVMET_AEN_CFG_OPTIONAL);
 
index 4d014c5d0b6a71b1ac00c21128e4769399455ce9..08e9c6b6f55177903bcbc192813dcc2099b5af76 100644 (file)
@@ -252,8 +252,6 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
        if (status)
                goto out;
 
-       ctrl->pi_support = ctrl->port->pi_enable && ctrl->subsys->pi_support;
-
        uuid_copy(&ctrl->hostid, &d->hostid);
 
        ret = nvmet_setup_auth(ctrl);