nvme: set transport string before the probe based on transport type

Users may only set the transport type, but for the actual probe
process, the trstring field is mandatory, so set the trstring
based on transport type at first.  Also remove unnecessary
spdk_nvme_trid_populate_transport() call from each transport
module.

Fix #1228.

Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1001 (master)

(cherry picked from commit 8d6f48fbf8)
Change-Id: I2378065945cf725df4b1997293a737c101969e69
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1299
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2020-02-25 01:38:52 -05:00 committed by Tomasz Zawadzki
parent 776d45b0e3
commit 52c7d46a3c
4 changed files with 1 additions and 3 deletions

View File

@ -594,6 +594,7 @@ spdk_nvme_probe_internal(struct spdk_nvme_probe_ctx *probe_ctx,
int rc;
struct spdk_nvme_ctrlr *ctrlr, *ctrlr_tmp;
spdk_nvme_trid_populate_transport(&probe_ctx->trid, probe_ctx->trid.trtype);
if (!spdk_nvme_transport_available_by_name(probe_ctx->trid.trstring)) {
SPDK_ERRLOG("NVMe trtype %u not available\n", probe_ctx->trid.trtype);
return -1;

View File

@ -828,7 +828,6 @@ struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(const struct spdk_nvme_transpo
pctrlr->is_remapped = false;
pctrlr->ctrlr.is_removed = false;
spdk_nvme_trid_populate_transport(&pctrlr->ctrlr.trid, SPDK_NVME_TRANSPORT_PCIE);
pctrlr->devhandle = devhandle;
pctrlr->ctrlr.opts = *opts;
memcpy(&pctrlr->ctrlr.trid, trid, sizeof(pctrlr->ctrlr.trid));

View File

@ -1724,7 +1724,6 @@ struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(const struct spdk_nvme_transpo
return NULL;
}
spdk_nvme_trid_populate_transport(&rctrlr->ctrlr.trid, SPDK_NVME_TRANSPORT_RDMA);
rctrlr->ctrlr.opts = *opts;
memcpy(&rctrlr->ctrlr.trid, trid, sizeof(rctrlr->ctrlr.trid));

View File

@ -1625,7 +1625,6 @@ struct spdk_nvme_ctrlr *nvme_tcp_ctrlr_construct(const struct spdk_nvme_transpor
tctrlr->ctrlr.opts = *opts;
tctrlr->ctrlr.trid = *trid;
spdk_nvme_trid_populate_transport(&tctrlr->ctrlr.trid, SPDK_NVME_TRANSPORT_TCP);
rc = nvme_ctrlr_construct(&tctrlr->ctrlr);
if (rc != 0) {