nvme: move nvme_ctrlr_construct() before the PCI initialization

This will be consistent with TCP and RDMA transport, and we will use
ctrlr->flags in nvme_ctrlr_init_cap() in next patch, the flags will
be cleared to 0 for now.

Change-Id: Ic360cd0c00d60c77452d19cdc1e7a32a5fc34df0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466678
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Changpeng Liu 2019-08-29 02:28:36 -04:00 committed by Jim Harris
parent 6e77b0b68d
commit 2f9d2b811c

View File

@ -839,6 +839,13 @@ struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(const struct spdk_nvme_transpo
pctrlr->claim_fd = claim_fd;
memcpy(&pctrlr->ctrlr.trid, trid, sizeof(pctrlr->ctrlr.trid));
rc = nvme_ctrlr_construct(&pctrlr->ctrlr);
if (rc != 0) {
close(claim_fd);
spdk_free(pctrlr);
return NULL;
}
rc = nvme_pcie_ctrlr_allocate_bars(pctrlr);
if (rc != 0) {
close(claim_fd);
@ -871,12 +878,6 @@ struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(const struct spdk_nvme_transpo
* but we want multiples of 4, so drop the + 2 */
pctrlr->doorbell_stride_u32 = 1 << cap.bits.dstrd;
rc = nvme_ctrlr_construct(&pctrlr->ctrlr);
if (rc != 0) {
nvme_ctrlr_destruct(&pctrlr->ctrlr);
return NULL;
}
pci_id = spdk_pci_device_get_id(pci_dev);
pctrlr->ctrlr.quirks = nvme_get_quirks(&pci_id);