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 <alexeymar@nvidia.com>
Change-Id: I453961299f67342c1193dc622685aefb46bfceb6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17165
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Alexey Marchuk 2023-03-13 09:36:05 +01:00 committed by Ben Walker
parent d478b20ddf
commit 0de1c21570
4 changed files with 19 additions and 2 deletions

View File

@ -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

View File

@ -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`

View File

@ -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.

View File

@ -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);