Commit 5584232c authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

nvmf: Remove new_qpair callback from transport accept function pointer



Transports may now call spdk_nvmf_tgt_new_qpair() instead.

Change-Id: Ib3295c488e22517e82f2051055ae47521d76fe56
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2814


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAnil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 268aacb2
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -8,7 +8,10 @@ The NVMe-oF target no longer supports connecting scheduling configuration and in
always uses what was previously called "transport" scheduling.

`spdk_nvmf_tgt_accept` no longer takes a function pointer as an argument. New connections
are automatically assigned to poll groups by the underlying transport.
are automatically assigned to poll groups by the underlying transport. Further,
`spdk_nvmf_transport_ops` has changed such that the accept function pointer no longer
takes a function pointer as an argument. Instead, transports should call
`spdk_nvmf_tgt_new_qpair` whenever they previously would have called that callback.

### nvme

+9 −9
Original line number Diff line number Diff line
@@ -192,14 +192,6 @@ struct spdk_nvmf_transport {
	TAILQ_ENTRY(spdk_nvmf_transport)	link;
};

/**
 * Function to be called for each newly discovered qpair.
 *
 * \param qpair The newly discovered qpair.
 * \param cb_arg A context argument passed to this function.
 */
typedef void (*new_qpair_fn)(struct spdk_nvmf_qpair *qpair, void *cb_arg);

struct spdk_nvmf_transport_ops {
	/**
	 * Transport name
@@ -260,7 +252,7 @@ struct spdk_nvmf_transport_ops {
	/**
	 * Check for new connections on the transport.
	 */
	uint32_t (*accept)(struct spdk_nvmf_transport *transport, new_qpair_fn cb_fn, void *cb_arg);
	uint32_t (*accept)(struct spdk_nvmf_transport *transport);

	/**
	 * Initialize subset of identify controller data.
@@ -366,6 +358,14 @@ void spdk_nvmf_transport_register(const struct spdk_nvmf_transport_ops *ops);

int spdk_nvmf_ctrlr_connect(struct spdk_nvmf_request *req);

/**
 * Function to be called for each newly discovered qpair.
 *
 * \param tgt The nvmf target
 * \param qpair The newly discovered qpair.
 */
void spdk_nvmf_tgt_new_qpair(struct spdk_nvmf_tgt *tgt, struct spdk_nvmf_qpair *qpair);

/**
 * A subset of struct spdk_nvme_registers that are emulated by a fabrics device.
 */
+1 −2
Original line number Diff line number Diff line
@@ -1912,7 +1912,7 @@ nvmf_fc_stop_listen(struct spdk_nvmf_transport *transport,
}

static uint32_t
nvmf_fc_accept(struct spdk_nvmf_transport *transport, new_qpair_fn cb_fn, void *cb_arg)
nvmf_fc_accept(struct spdk_nvmf_transport *transport)
{
	struct spdk_nvmf_fc_port *fc_port = NULL;
	uint32_t count = 0;
@@ -1926,7 +1926,6 @@ nvmf_fc_accept(struct spdk_nvmf_transport *transport, new_qpair_fn cb_fn, void *
	/* poll the LS queue on each port */
	TAILQ_FOREACH(fc_port, &g_spdk_nvmf_fc_port_list, link) {
		if (fc_port->hw_port_status == SPDK_FC_PORT_ONLINE) {
			fc_port->new_qp_cb = cb_fn;
			count += nvmf_fc_process_queue(&fc_port->ls_queue);
		}
	}
+1 −3
Original line number Diff line number Diff line
@@ -564,8 +564,6 @@ nvmf_fc_ls_add_conn_to_poller(
{
	struct nvmf_fc_ls_op_ctx *opd;
	struct spdk_nvmf_fc_ls_add_conn_api_data *api_data;
	struct spdk_nvmf_fc_nport *tgtport = assoc->tgtport;
	struct spdk_nvmf_fc_port *fc_port = tgtport->fc_port;

	SPDK_DEBUGLOG(SPDK_LOG_NVMF_FC_LS, "Add Connection to poller for "
		      "assoc_id 0x%lx conn_id 0x%lx\n", assoc->assoc_id,
@@ -595,7 +593,7 @@ nvmf_fc_ls_add_conn_to_poller(

	/* Let the nvmf_tgt decide which pollgroup to use. */
	fc_conn->create_opd = opd;
	fc_port->new_qp_cb(&fc_conn->qpair, fc_port->new_qp_arg);
	spdk_nvmf_tgt_new_qpair(ls_rqst->nvmf_tgt, &fc_conn->qpair);
}

/* Delete association functions */
+3 −6
Original line number Diff line number Diff line
@@ -740,15 +740,12 @@ _nvmf_poll_group_add(void *_ctx)
	}
}

static void
_nvmf_new_qpair(struct spdk_nvmf_qpair *qpair, void *cb_arg)
void
spdk_nvmf_tgt_new_qpair(struct spdk_nvmf_tgt *tgt, struct spdk_nvmf_qpair *qpair)
{
	struct spdk_nvmf_poll_group *group;
	struct spdk_nvmf_tgt *tgt;
	struct nvmf_new_qpair_ctx *ctx;

	tgt = qpair->transport->tgt;

	group = spdk_nvmf_get_optimal_poll_group(qpair);
	if (group == NULL) {
		if (tgt->next_poll_group == NULL) {
@@ -783,7 +780,7 @@ spdk_nvmf_tgt_accept(struct spdk_nvmf_tgt *tgt)
	uint32_t count = 0;

	TAILQ_FOREACH_SAFE(transport, &tgt->transports, link, tmp) {
		count += nvmf_transport_accept(transport, _nvmf_new_qpair, NULL);
		count += nvmf_transport_accept(transport);
	}

	return count;
Loading