nvmf: don't implicitly create the transport in tgt listen.
In order to prepare for multiple transports, the nvmf tgt should never implicitly create a transport when listen is called. Change-Id: If1286e7e3f7bce422a4acd66390852736113df7a Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/430160 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
28f26abfa7
commit
7f128c757b
@ -506,29 +506,20 @@ spdk_nvmf_tgt_listen(struct spdk_nvmf_tgt *tgt,
|
|||||||
void *cb_arg)
|
void *cb_arg)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_transport *transport;
|
struct spdk_nvmf_transport *transport;
|
||||||
|
const char *trtype;
|
||||||
int rc;
|
int rc;
|
||||||
bool propagate = false;
|
|
||||||
|
|
||||||
transport = spdk_nvmf_tgt_get_transport(tgt, trid->trtype);
|
transport = spdk_nvmf_tgt_get_transport(tgt, trid->trtype);
|
||||||
if (!transport) {
|
if (!transport) {
|
||||||
struct spdk_nvmf_transport_opts opts;
|
trtype = spdk_nvme_transport_id_trtype_str(trid->trtype);
|
||||||
|
if (trtype != NULL) {
|
||||||
opts.max_queue_depth = tgt->opts.max_queue_depth;
|
SPDK_ERRLOG("Unable to listen on transport %s. The transport must be created first.\n", trtype);
|
||||||
opts.max_qpairs_per_ctrlr = tgt->opts.max_qpairs_per_ctrlr;
|
} else {
|
||||||
opts.in_capsule_data_size = tgt->opts.in_capsule_data_size;
|
SPDK_ERRLOG("The specified trtype %d is unknown. Please make sure that it is properly registered.\n",
|
||||||
opts.max_io_size = tgt->opts.max_io_size;
|
trid->trtype);
|
||||||
opts.io_unit_size = tgt->opts.io_unit_size;
|
|
||||||
/* use max_queue depth since tgt. opts. doesn't have max_aq_depth */
|
|
||||||
opts.max_aq_depth = tgt->opts.max_queue_depth;
|
|
||||||
|
|
||||||
transport = spdk_nvmf_transport_create(trid->trtype, &opts);
|
|
||||||
if (!transport) {
|
|
||||||
SPDK_ERRLOG("Transport initialization failed\n");
|
|
||||||
cb_fn(cb_arg, -EINVAL);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
cb_fn(cb_arg, -EINVAL);
|
||||||
propagate = true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_nvmf_transport_listen(transport, trid);
|
rc = spdk_nvmf_transport_listen(transport, trid);
|
||||||
@ -540,11 +531,7 @@ spdk_nvmf_tgt_listen(struct spdk_nvmf_tgt *tgt,
|
|||||||
|
|
||||||
tgt->discovery_genctr++;
|
tgt->discovery_genctr++;
|
||||||
|
|
||||||
if (propagate) {
|
cb_fn(cb_arg, 0);
|
||||||
spdk_nvmf_tgt_add_transport(tgt, transport, cb_fn, cb_arg);
|
|
||||||
} else {
|
|
||||||
cb_fn(cb_arg, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct spdk_nvmf_tgt_add_transport_ctx {
|
struct spdk_nvmf_tgt_add_transport_ctx {
|
||||||
|
Loading…
Reference in New Issue
Block a user