nvme: Prioritize user provided trstring for transport lookup
This patch fixes the issue with custom nvme transport. It is possible to register custom nvme transport with arbitrary name but it is not usable because 'spdk_nvme_trid_populate_transport' call in probe function will always set trstring to 'CUSTOM' and transport lookup will fail. Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com> Change-Id: I83fd24dd8732ac0a21e22435e0acff20ab0e7521 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9557 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e68aebd50b
commit
a2d4ddb3b1
@ -2054,9 +2054,6 @@ add_trid(const char *trid_str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
spdk_nvme_transport_id_populate_trstring(trid,
|
||||
spdk_nvme_transport_id_trtype_str(trid->trtype));
|
||||
|
||||
ns = strcasestr(trid_str, "ns:");
|
||||
if (ns) {
|
||||
char nsid_str[6]; /* 5 digits maximum in an nsid */
|
||||
|
@ -825,9 +825,14 @@ 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 (strlen(probe_ctx->trid.trstring) == 0) {
|
||||
/* If user didn't provide trstring, derive it from trtype */
|
||||
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);
|
||||
SPDK_ERRLOG("NVMe trtype %u (%s) not available\n",
|
||||
probe_ctx->trid.trtype, probe_ctx->trid.trstring);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user