From 40b6f761b2554c12848583e3a686fd705e2e29bf Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 29 May 2018 18:24:44 -0700 Subject: [PATCH] nvmf: allow abort of AER requests These are trivial to abort: since we just hold on to aer_req until an event is triggered, we just need to set aer_req back to NULL and complete the request. Change-Id: I74ffe7a227fcaf816c0c584fe5c82a940475687f Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/412881 Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker --- lib/nvmf/ctrlr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index c918da506..ffe736945 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -1455,6 +1455,18 @@ invalid_cns: static struct spdk_nvmf_request * spdk_nvmf_qpair_abort(struct spdk_nvmf_qpair *qpair, uint16_t cid) { + struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr; + struct spdk_nvmf_request *req; + + if (spdk_nvmf_qpair_is_admin_queue(qpair)) { + if (ctrlr->aer_req && ctrlr->aer_req->cmd->nvme_cmd.cid == cid) { + SPDK_DEBUGLOG(SPDK_LOG_NVMF, "Aborting AER request\n"); + req = ctrlr->aer_req; + ctrlr->aer_req = NULL; + return req; + } + } + /* TODO: track list of outstanding requests in qpair? */ return NULL; }