lib/nvme: add a disconnect_qpair public API.

Also modify some api documentation to indicate how the
new API should be used.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Icdbfb09aceda28635fdd191c520b36c692c2c100
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1340
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2020-03-17 12:45:30 -07:00 committed by Tomasz Zawadzki
parent 7b4558e356
commit 5d9d52fd3c
2 changed files with 25 additions and 0 deletions

View File

@ -1211,6 +1211,21 @@ struct spdk_nvme_qpair *spdk_nvme_ctrlr_alloc_io_qpair(struct spdk_nvme_ctrlr *c
*/
int spdk_nvme_ctrlr_connect_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair);
/**
* Disconnect the given I/O qpair.
*
* This function must be called from the same thread as spdk_nvme_qpair_process_completions
* and the spdk_nvme_ns_cmd_* functions.
*
* After disconnect, calling spdk_nvme_qpair_process_completions or one of the
* spdk_nvme_ns_cmd* on a qpair will result in a return value of -ENXIO. A
* disconnected qpair may be reconnected with either the spdk_nvme_ctrlr_connect_io_qpair
* or spdk_nvme_ctrlr_reconnect_io_qpair APIs.
*
* \param qpair The qpair to disconnect.
*/
void spdk_nvme_ctrlr_disconnect_io_qpair(struct spdk_nvme_qpair *qpair);
/**
* Attempt to reconnect the given qpair.
*

View File

@ -371,6 +371,16 @@ spdk_nvme_ctrlr_connect_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme
return rc;
}
void
spdk_nvme_ctrlr_disconnect_io_qpair(struct spdk_nvme_qpair *qpair)
{
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);
nvme_transport_ctrlr_disconnect_qpair(ctrlr, qpair);
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
}
struct spdk_nvme_qpair *
spdk_nvme_ctrlr_alloc_io_qpair(struct spdk_nvme_ctrlr *ctrlr,
const struct spdk_nvme_io_qpair_opts *user_opts,