lib/nvmf: Add subsystem_listener to struct spdk_nvmf_ctrlr

Find the subsystem listener whose trid matches req->port->trid when
creating a controller, and store it in the controller.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iea343b8d8ae827b554df2245b67aed113469c592
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4010
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2020-09-01 22:51:45 +09:00 committed by Tomasz Zawadzki
parent e21de9a9cc
commit 7bcff376ab
4 changed files with 24 additions and 0 deletions

View File

@ -409,6 +409,16 @@ nvmf_ctrlr_create(struct spdk_nvmf_subsystem *subsystem,
ctrlr->dif_insert_or_strip = transport->opts.dif_insert_or_strip;
if (ctrlr->subsys->subtype == SPDK_NVMF_SUBTYPE_NVME) {
ctrlr->listener = nvmf_subsystem_find_listener(ctrlr->subsys,
req->qpair->trid);
if (!ctrlr->listener) {
SPDK_ERRLOG("Listener was not found\n");
free(ctrlr);
return NULL;
}
}
req->qpair->ctrlr = ctrlr;
spdk_thread_send_msg(subsystem->thread, _nvmf_subsystem_add_ctrlr, req);

View File

@ -216,6 +216,8 @@ struct spdk_nvmf_ctrlr {
struct spdk_thread *thread;
struct spdk_bit_array *qpair_mask;
const struct spdk_nvmf_subsystem_listener *listener;
struct spdk_nvmf_request *aer_req[NVMF_MAX_ASYNC_EVENTS];
union spdk_nvme_async_event_completion notice_event;
union spdk_nvme_async_event_completion reservation_event;

View File

@ -119,6 +119,12 @@ DEFINE_STUB(spdk_nvmf_subsystem_listener_allowed,
(struct spdk_nvmf_subsystem *subsystem, const struct spdk_nvme_transport_id *trid),
true);
DEFINE_STUB(nvmf_subsystem_find_listener,
struct spdk_nvmf_subsystem_listener *,
(struct spdk_nvmf_subsystem *subsystem,
const struct spdk_nvme_transport_id *trid),
(void *)0x1);
DEFINE_STUB(nvmf_bdev_ctrlr_read_cmd,
int,
(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,

View File

@ -83,6 +83,12 @@ DEFINE_STUB(spdk_nvmf_subsystem_listener_allowed,
(struct spdk_nvmf_subsystem *subsystem, const struct spdk_nvme_transport_id *trid),
true);
DEFINE_STUB(nvmf_subsystem_find_listener,
struct spdk_nvmf_subsystem_listener *,
(struct spdk_nvmf_subsystem *subsystem,
const struct spdk_nvme_transport_id *trid),
(void *)0x1);
DEFINE_STUB_V(nvmf_get_discovery_log_page,
(struct spdk_nvmf_tgt *tgt, const char *hostnqn, struct iovec *iov,
uint32_t iovcnt, uint64_t offset, uint32_t length));