Commit eb79ef57 authored by Jacek Kalwas's avatar Jacek Kalwas Committed by Tomasz Zawadzki
Browse files

nvmf: expose api to remove qpair from internal poll group



Signed-off-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I681327d405f60757c43b66592d9af7bd7ac2db0b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2774


Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 7b77e068
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -400,6 +400,13 @@ void spdk_nvmf_request_exec_fabrics(struct spdk_nvmf_request *req);
int spdk_nvmf_request_free(struct spdk_nvmf_request *req);
int spdk_nvmf_request_complete(struct spdk_nvmf_request *req);

/**
 * Remove the given qpair from the poll group.
 *
 * \param qpair The qpair to remove.
 */
void spdk_nvmf_poll_group_remove(struct spdk_nvmf_qpair *qpair);

/**
 * Get the NVMe-oF subsystem associated with this controller.
 *
+15 −7
Original line number Diff line number Diff line
@@ -880,20 +880,16 @@ _nvmf_ctrlr_free_from_qpair(void *ctx)
	free(qpair_ctx);
}

static void
_nvmf_qpair_destroy(void *ctx, int status)
void
spdk_nvmf_poll_group_remove(struct spdk_nvmf_qpair *qpair)
{
	struct nvmf_qpair_disconnect_ctx *qpair_ctx = ctx;
	struct spdk_nvmf_qpair *qpair = qpair_ctx->qpair;
	struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr;
	struct spdk_nvmf_transport_poll_group *tgroup;
	struct spdk_nvmf_request *req, *tmp;
	struct spdk_nvmf_subsystem_poll_group *sgroup;
	int rc;

	assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING);
	nvmf_qpair_set_state(qpair, SPDK_NVMF_QPAIR_ERROR);
	qpair_ctx->qid = qpair->qid;

	/* Find the tgroup and remove the qpair from the tgroup */
	TAILQ_FOREACH(tgroup, &qpair->group->tgroups, link) {
@@ -920,6 +916,19 @@ _nvmf_qpair_destroy(void *ctx, int status)
	}

	TAILQ_REMOVE(&qpair->group->qpairs, qpair, link);
}

static void
_nvmf_qpair_destroy(void *ctx, int status)
{
	struct nvmf_qpair_disconnect_ctx *qpair_ctx = ctx;
	struct spdk_nvmf_qpair *qpair = qpair_ctx->qpair;
	struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr;

	assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING);
	qpair_ctx->qid = qpair->qid;

	spdk_nvmf_poll_group_remove(qpair);

	if (!ctrlr || !ctrlr->thread) {
		nvmf_transport_qpair_fini(qpair);
@@ -932,7 +941,6 @@ _nvmf_qpair_destroy(void *ctx, int status)

	qpair_ctx->ctrlr = ctrlr;
	spdk_thread_send_msg(ctrlr->thread, _nvmf_ctrlr_free_from_qpair, qpair_ctx);

}

int
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@
	spdk_nvmf_request_complete;
	spdk_nvmf_ctrlr_get_subsystem;
	spdk_nvmf_req_get_xfer;
	spdk_nvmf_poll_group_remove;


	local: *;