Commit 608b54a2 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Jim Harris
Browse files

nvmf: remove cb_fn/cb_arg from spdk_nvmf_qpair_disconnect()



These were deprecated for a long time, so it's finally time to remove
them.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ia10242b36c3560df4dae8f6bd9fd4ff931179e22
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22945


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
parent 619396cb
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -50,11 +50,6 @@ The function is deprecated and will be removed in 24.09 release. Please use

### nvmf

#### `spdk_nvmf_qpair_disconnect`

Parameters `cb_fn` and `ctx` of `spdk_nvmf_qpair_disconnect` API are deprecated. These parameters
will be removed in 24.05 release.

#### `spdk_nvmf_request_exec_fabrics`

This function is deprecated and will be removed in the 24.09 release.  Instead, users should use
+1 −4
Original line number Diff line number Diff line
@@ -359,15 +359,12 @@ typedef void (*nvmf_qpair_disconnect_cb)(void *ctx);
 * Disconnect an NVMe-oF qpair
 *
 * \param qpair The NVMe-oF qpair to disconnect.
 * \param cb_fn Deprecated, will be removed in v24.05. The function to call upon completion of the disconnect.
 * \param ctx Deprecated, will be removed in v24.05. The context to pass to the callback function.
 *
 * \return 0 upon success.
 * \return -ENOMEM if the function specific context could not be allocated.
 * \return -EINPROGRESS if the qpair is already in the process of disconnect.
 */
int spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_cb cb_fn,
			       void *ctx);
int spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair);

/**
 * Get the peer's transport ID for this queue pair.
+2 −2
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ _nvmf_ctrlr_disconnect_qpairs_on_pg(struct spdk_io_channel_iter *i, bool include

	TAILQ_FOREACH_SAFE(qpair, &group->qpairs, link, temp_qpair) {
		if (qpair->ctrlr == ctrlr && (include_admin || !nvmf_qpair_is_admin_queue(qpair))) {
			rc = spdk_nvmf_qpair_disconnect(qpair, NULL, NULL);
			rc = spdk_nvmf_qpair_disconnect(qpair);
			if (rc) {
				if (rc == -EINPROGRESS) {
					rc = 0;
@@ -1021,7 +1021,7 @@ nvmf_ctrlr_association_remove(void *ctx)
		      ctrlr->subsys->subnqn);

	if (ctrlr->admin_qpair) {
		rc = spdk_nvmf_qpair_disconnect(ctrlr->admin_qpair, NULL, NULL);
		rc = spdk_nvmf_qpair_disconnect(ctrlr->admin_qpair);
		if (rc < 0 && rc != -EINPROGRESS) {
			SPDK_ERRLOG("Fail to disconnect admin ctrlr qpair\n");
			assert(false);
+2 −2
Original line number Diff line number Diff line
@@ -1487,7 +1487,7 @@ nvmf_fc_poller_conn_abort_done(void *hwqp, int32_t status, void *cb_args)
				/* disconnect qpair from nvmf controller */
				fc_conn->qpair_disconnect_cb_fn = nvmf_fc_disconnect_qpair_cb;
				fc_conn->qpair_disconnect_ctx = &conn_args->cb_info;
				spdk_nvmf_qpair_disconnect(&fc_conn->qpair, NULL, NULL);
				spdk_nvmf_qpair_disconnect(&fc_conn->qpair);
			} else {
				nvmf_fc_poller_api_perform_cb(&conn_args->cb_info, SPDK_NVMF_FC_POLLER_API_SUCCESS);
			}
@@ -1548,7 +1548,7 @@ nvmf_fc_poller_api_del_connection(void *arg)
			/* disconnect qpair from nvmf controller */
			fc_conn->qpair_disconnect_cb_fn = nvmf_fc_disconnect_qpair_cb;
			fc_conn->qpair_disconnect_ctx = &conn_args->cb_info;
			spdk_nvmf_qpair_disconnect(&fc_conn->qpair, NULL, NULL);
			spdk_nvmf_qpair_disconnect(&fc_conn->qpair);
		} else {
			nvmf_fc_poller_api_perform_cb(&conn_args->cb_info, SPDK_NVMF_FC_POLLER_API_SUCCESS);
		}
+7 −34
Original line number Diff line number Diff line
@@ -30,9 +30,6 @@ typedef void (*nvmf_qpair_disconnect_cpl)(void *ctx, int status);
struct nvmf_qpair_disconnect_ctx {
	struct spdk_nvmf_qpair *qpair;
	struct spdk_nvmf_ctrlr *ctrlr;
	nvmf_qpair_disconnect_cb cb_fn;
	struct spdk_thread *thread;
	void *ctx;
	uint16_t qid;
};

@@ -316,7 +313,7 @@ _nvmf_tgt_disconnect_qpairs(void *ctx)
	int rc;

	TAILQ_FOREACH_SAFE(qpair, &group->qpairs, link, qpair_tmp) {
		rc = spdk_nvmf_qpair_disconnect(qpair, NULL, NULL);
		rc = spdk_nvmf_qpair_disconnect(qpair);
		if (rc && rc != -EINPROGRESS) {
			break;
		}
@@ -1125,7 +1122,7 @@ _nvmf_poll_group_add(void *_ctx)

	if (spdk_nvmf_poll_group_add(group, qpair) != 0) {
		SPDK_ERRLOG("Unable to add the qpair to a poll group.\n");
		spdk_nvmf_qpair_disconnect(qpair, NULL, NULL);
		spdk_nvmf_qpair_disconnect(qpair);
	}
}

@@ -1141,7 +1138,7 @@ spdk_nvmf_tgt_new_qpair(struct spdk_nvmf_tgt *tgt, struct spdk_nvmf_qpair *qpair
			tgt->next_poll_group = TAILQ_FIRST(&tgt->poll_groups);
			if (tgt->next_poll_group == NULL) {
				SPDK_ERRLOG("No poll groups exist.\n");
				spdk_nvmf_qpair_disconnect(qpair, NULL, NULL);
				spdk_nvmf_qpair_disconnect(qpair);
				return;
			}
		}
@@ -1152,7 +1149,7 @@ spdk_nvmf_tgt_new_qpair(struct spdk_nvmf_tgt *tgt, struct spdk_nvmf_qpair *qpair
	ctx = calloc(1, sizeof(*ctx));
	if (!ctx) {
		SPDK_ERRLOG("Unable to send message to poll group.\n");
		spdk_nvmf_qpair_disconnect(qpair, NULL, NULL);
		spdk_nvmf_qpair_disconnect(qpair);
		return;
	}

@@ -1253,10 +1250,6 @@ _nvmf_transport_qpair_fini_complete(void *cb_ctx)
{
	struct nvmf_qpair_disconnect_ctx *qpair_ctx = cb_ctx;
	struct spdk_nvmf_ctrlr *ctrlr;
	/* Store cb args since cb_ctx can be freed in _nvmf_ctrlr_free_from_qpair */
	nvmf_qpair_disconnect_cb cb_fn = qpair_ctx->cb_fn;
	void *cb_arg = qpair_ctx->ctx;
	struct spdk_thread *cb_thread = qpair_ctx->thread;

	ctrlr = qpair_ctx->ctrlr;
	SPDK_DEBUGLOG(nvmf, "Finish destroying qid %u\n", qpair_ctx->qid);
@@ -1278,10 +1271,6 @@ _nvmf_transport_qpair_fini_complete(void *cb_ctx)
	} else {
		free(qpair_ctx);
	}

	if (cb_fn) {
		spdk_thread_send_msg(cb_thread, cb_fn, cb_arg);
	}
}

void
@@ -1372,15 +1361,12 @@ _nvmf_qpair_disconnect_msg(void *ctx)
{
	struct nvmf_qpair_disconnect_ctx *qpair_ctx = ctx;

	spdk_nvmf_qpair_disconnect(qpair_ctx->qpair, qpair_ctx->cb_fn, qpair_ctx->ctx);
	spdk_nvmf_qpair_disconnect(qpair_ctx->qpair);
	free(ctx);
}

SPDK_LOG_DEPRECATION_REGISTER(spdk_nvmf_qpair_disconnect, "cb_fn and ctx are deprecated", "v24.05",
			      0);

int
spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_cb cb_fn, void *ctx)
spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair)
{
	struct spdk_nvmf_poll_group *group = qpair->group;
	struct nvmf_qpair_disconnect_ctx *qpair_ctx;
@@ -1389,16 +1375,9 @@ spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_
		return -EINPROGRESS;
	}

	if (cb_fn || ctx) {
		SPDK_LOG_DEPRECATED(spdk_nvmf_qpair_disconnect);
	}

	/* If we get a qpair in the uninitialized state, we can just destroy it immediately */
	if (qpair->state == SPDK_NVMF_QPAIR_UNINITIALIZED) {
		nvmf_transport_qpair_fini(qpair, NULL, NULL);
		if (cb_fn) {
			cb_fn(ctx);
		}
		return 0;
	}

@@ -1412,9 +1391,6 @@ spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_
			return -ENOMEM;
		}
		qpair_ctx->qpair = qpair;
		qpair_ctx->cb_fn = cb_fn;
		qpair_ctx->thread = group->thread;
		qpair_ctx->ctx = ctx;
		spdk_thread_send_msg(group->thread, _nvmf_qpair_disconnect_msg, qpair_ctx);
		return 0;
	}
@@ -1430,9 +1406,6 @@ spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_
	}

	qpair_ctx->qpair = qpair;
	qpair_ctx->cb_fn = cb_fn;
	qpair_ctx->thread = group->thread;
	qpair_ctx->ctx = ctx;

	/* Check for outstanding I/O */
	if (!TAILQ_EMPTY(&qpair->outstanding)) {
@@ -1738,7 +1711,7 @@ nvmf_poll_group_remove_subsystem_msg(void *ctx)
	TAILQ_FOREACH_SAFE(qpair, &group->qpairs, link, qpair_tmp) {
		if ((qpair->ctrlr != NULL) && (qpair->ctrlr->subsys == subsystem)) {
			qpairs_found = true;
			rc = spdk_nvmf_qpair_disconnect(qpair, NULL, NULL);
			rc = spdk_nvmf_qpair_disconnect(qpair);
			if (rc && rc != -EINPROGRESS) {
				break;
			}
Loading