nvmf: simplify listen_associate interface

There is no need for this interface to be async.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I1f21b53e90b7d165b6b5fb2e1226ce7591966b58
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4181
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Jacek Kalwas 2020-09-13 02:26:47 +02:00 committed by Tomasz Zawadzki
parent ae207216fb
commit 8387e97f90
2 changed files with 8 additions and 15 deletions

View File

@ -242,17 +242,11 @@ struct spdk_nvmf_transport_ops {
* action here, as the enforcement of the association is done in the generic * action here, as the enforcement of the association is done in the generic
* code. * code.
* *
* The association is not considered complete until cb_fn is called. New * Returns a negated errno code to block the association. 0 to allow.
* connections on the listener targeting this subsystem will be rejected
* until that time.
*
* Pass a negated errno code to `cb_fn` to block the association. 0 to allow.
*/ */
void (*listen_associate)(struct spdk_nvmf_transport *transport, int (*listen_associate)(struct spdk_nvmf_transport *transport,
const struct spdk_nvmf_subsystem *subsystem, const struct spdk_nvmf_subsystem *subsystem,
const struct spdk_nvme_transport_id *trid, const struct spdk_nvme_transport_id *trid);
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void *cb_arg);
/** /**
* Check for new connections on the transport. * Check for new connections on the transport.

View File

@ -831,6 +831,7 @@ spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem,
struct spdk_nvmf_transport *transport; struct spdk_nvmf_transport *transport;
struct spdk_nvmf_subsystem_listener *listener; struct spdk_nvmf_subsystem_listener *listener;
struct spdk_nvmf_listener *tr_listener; struct spdk_nvmf_listener *tr_listener;
int rc = 0;
assert(cb_fn != NULL); assert(cb_fn != NULL);
@ -874,12 +875,10 @@ spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem,
listener->ana_state = SPDK_NVME_ANA_OPTIMIZED_STATE; listener->ana_state = SPDK_NVME_ANA_OPTIMIZED_STATE;
if (transport->ops->listen_associate != NULL) { if (transport->ops->listen_associate != NULL) {
transport->ops->listen_associate(transport, subsystem, trid, rc = transport->ops->listen_associate(transport, subsystem, trid);
_nvmf_subsystem_add_listener_done,
listener);
} else {
_nvmf_subsystem_add_listener_done(listener, 0);
} }
_nvmf_subsystem_add_listener_done(listener, rc);
} }
int int