Commit 85a82229 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Changpeng Liu
Browse files

nvmf: refactor abort handling



Combine request lookup and abort into a single operation. Keeping them
separate would result in duplicating a lot of logic for finding the
proper list from which to remove aborted requests.

This is still a no-op for now, but it paves the way for aborting
requests that are still queued in software.

Change-Id: If8f268521f2c9f93b413261d87e9f39e539813aa
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/412880


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent d10401cc
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -498,13 +498,6 @@ spdk_nvmf_ctrlr_get_qpair(struct spdk_nvmf_ctrlr *ctrlr, uint16_t qid)
	return NULL;
}

static struct spdk_nvmf_request *
spdk_nvmf_qpair_get_request(struct spdk_nvmf_qpair *qpair, uint16_t cid)
{
	/* TODO: track list of outstanding requests in qpair? */
	return NULL;
}

static uint64_t
nvmf_prop_get_cap(struct spdk_nvmf_ctrlr *ctrlr)
{
@@ -1458,6 +1451,14 @@ invalid_cns:
	return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}


static struct spdk_nvmf_request *
spdk_nvmf_qpair_abort(struct spdk_nvmf_qpair *qpair, uint16_t cid)
{
	/* TODO: track list of outstanding requests in qpair? */
	return NULL;
}

static void
spdk_nvmf_ctrlr_abort_on_qpair(void *arg)
{
@@ -1483,7 +1484,7 @@ spdk_nvmf_ctrlr_abort_on_qpair(void *arg)

	assert(spdk_get_thread() == qpair->group->thread);

	req_to_abort = spdk_nvmf_qpair_get_request(qpair, cid);
	req_to_abort = spdk_nvmf_qpair_abort(qpair, cid);
	if (req_to_abort == NULL) {
		SPDK_DEBUGLOG(SPDK_LOG_NVMF, "cid %u not found\n", cid);
		rsp->status.sct = SPDK_NVME_SCT_GENERIC;
@@ -1491,11 +1492,14 @@ spdk_nvmf_ctrlr_abort_on_qpair(void *arg)
		goto complete_abort;
	}

	if (spdk_nvmf_request_abort(req_to_abort) == 0) {
	/* Complete the request with aborted status */
	req_to_abort->rsp->nvme_cpl.status.sct = SPDK_NVME_SCT_GENERIC;
	req_to_abort->rsp->nvme_cpl.status.sc = SPDK_NVME_SC_ABORTED_BY_REQUEST;
	spdk_nvmf_request_complete(req_to_abort);

	SPDK_DEBUGLOG(SPDK_LOG_NVMF, "abort ctrlr=%p req=%p sqid=%u cid=%u successful\n",
		      ctrlr, req_to_abort, sqid, cid);
	rsp->cdw0 = 0; /* Command successfully aborted */
	}
	rsp->status.sct = SPDK_NVME_SCT_GENERIC;
	rsp->status.sc = SPDK_NVME_SC_SUCCESS;

+0 −1
Original line number Diff line number Diff line
@@ -252,7 +252,6 @@ int spdk_nvmf_poll_group_resume_subsystem(struct spdk_nvmf_poll_group *group,
		struct spdk_nvmf_subsystem *subsystem);
void spdk_nvmf_request_exec(struct spdk_nvmf_request *req);
int spdk_nvmf_request_complete(struct spdk_nvmf_request *req);
int spdk_nvmf_request_abort(struct spdk_nvmf_request *req);

void spdk_nvmf_get_discovery_log_page(struct spdk_nvmf_tgt *tgt,
				      void *buffer, uint64_t offset,
+0 −7
Original line number Diff line number Diff line
@@ -152,10 +152,3 @@ spdk_nvmf_request_exec(struct spdk_nvmf_request *req)
		spdk_nvmf_request_complete(req);
	}
}

int
spdk_nvmf_request_abort(struct spdk_nvmf_request *req)
{
	/* TODO: implement abort, at least for commands that are still queued in software */
	return -1;
}