nvmet: looks at the passthrough controller when initializing CAP
[linux-2.6-microblaze.git] / drivers / nvme / target / core.c
index 66d05ee..11c4470 100644 (file)
@@ -1206,6 +1206,9 @@ static void nvmet_init_cap(struct nvmet_ctrl *ctrl)
        ctrl->cap |= (15ULL << 24);
        /* maximum queue entries supported: */
        ctrl->cap |= NVMET_QUEUE_SIZE - 1;
+
+       if (nvmet_passthru_ctrl(ctrl->subsys))
+               nvmet_passthrough_override_cap(ctrl);
 }
 
 struct nvmet_ctrl *nvmet_ctrl_find_get(const char *subsysnqn,
@@ -1363,8 +1366,6 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
                goto out_put_subsystem;
        mutex_init(&ctrl->lock);
 
-       nvmet_init_cap(ctrl);
-
        ctrl->port = req->port;
 
        INIT_WORK(&ctrl->async_event_work, nvmet_async_event_work);
@@ -1378,6 +1379,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 
        kref_init(&ctrl->ref);
        ctrl->subsys = subsys;
+       nvmet_init_cap(ctrl);
        WRITE_ONCE(ctrl->aen_enabled, NVMET_AEN_CFG_OPTIONAL);
 
        ctrl->changed_ns_list = kmalloc_array(NVME_MAX_CHANGED_NAMESPACES,