From ec137300330058c3ea2fb77f9c32577c997f9ba3 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Mon, 13 Mar 2023 09:36:05 +0100 Subject: [PATCH] lib/nvmf: Deprecate cb_fn in spdk_nvmf_qpair_disconnect Handling this callback is quite complex and may lead to various problems. In most of places, the actual event when qpair is dosconnected is not importnat for the app logic. Only in shutdown path we need to be sure that all qpairs are disconnected, it can be achieved by checking poll_group::qpairs list Signed-off-by: Alexey Marchuk Change-Id: I453961299f67342c1193dc622685aefb46bfceb6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17165 Reviewed-by: Jim Harris Reviewed-by: Michael Haeuptle Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- CHANGELOG.md | 3 +++ deprecation.md | 7 +++++++ include/spdk/nvmf.h | 4 ++-- lib/nvmf/nvmf.c | 7 +++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e61b999..58a3b736b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ Two functions related to Asynchronous Event and error handling have been made pu - `spdk_nvmf_ctrlr_async_event_error_event`, - `spdk_nvmf_ctrlr_abort_aer`. +Parameters `cb_fn` and `ctx` of `spdk_nvmf_qpair_disconnect` API are deprecated. These parameters +will be removed in 23.09 release. + ### nvme New API `spdk_nvme_ns_get_format_index` was added to calculate the exact format index, that diff --git a/deprecation.md b/deprecation.md index a92effb0d..94cc4de35 100644 --- a/deprecation.md +++ b/deprecation.md @@ -53,6 +53,13 @@ then. Deprecated `spdk_nvme_ctrlr_prepare_for_reset` API, which will be removed in SPDK 22.01. For PCIe transport, `spdk_nvme_ctrlr_disconnect` should be used before freeing I/O qpairs. +### nvmf + +#### `spdk_nvmf_qpair_disconnect` + +Parameters `cb_fn` and `ctx` of `spdk_nvmf_qpair_disconnect` API are deprecated. These parameters +will be removed in 23.09 release. + ### gpt #### `old_gpt_guid` diff --git a/include/spdk/nvmf.h b/include/spdk/nvmf.h index 491fc48d6..47bfb28a3 100644 --- a/include/spdk/nvmf.h +++ b/include/spdk/nvmf.h @@ -291,8 +291,8 @@ typedef void (*nvmf_qpair_disconnect_cb)(void *ctx); * Disconnect an NVMe-oF qpair * * \param qpair The NVMe-oF qpair to disconnect. - * \param cb_fn The function to call upon completion of the disconnect. - * \param ctx The context to pass to the callback function. + * \param cb_fn Deprecated, will be removed in v23.09. The function to call upon completion of the disconnect. + * \param ctx Deprecated, will be removed in v23.09. The context to pass to the callback function. * * \return 0 upon success. * \return -ENOMEM if the function specific context could not be allocated. diff --git a/lib/nvmf/nvmf.c b/lib/nvmf/nvmf.c index 5895276b1..72597dd8c 100644 --- a/lib/nvmf/nvmf.c +++ b/lib/nvmf/nvmf.c @@ -1242,6 +1242,9 @@ _nvmf_qpair_disconnect_msg(void *ctx) free(ctx); } +SPDK_LOG_DEPRECATION_REGISTER(spdk_nvmf_qpair_disconnect, "cb_fn and ctx are deprecated", "v23.09", + 0); + int spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_cb cb_fn, void *ctx) { @@ -1252,6 +1255,10 @@ 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);