From 9975d4a1d23e3431609de9e039222125e26f2d2b Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Sat, 20 Jun 2020 13:57:58 +0900 Subject: [PATCH] lib/nvmf: Always return success and only toggle bit 0 of CDW0 for abort command Description is not clear but according to the NVMe specification, always set the completion status to success and differentiate only the bit 0 of CDW0 between success and failure for abort command. Signed-off-by: Shuhei Matsumoto Change-Id: I0195e72fe1d7fcc2592f47e9dcf92ac56912282c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1965 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris Reviewed-by: Michael Haeuptle Reviewed-by: Ben Walker --- lib/nvmf/ctrlr.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index 24bb593f1..28380c524 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -2117,20 +2117,16 @@ nvmf_ctrlr_abort_on_pg(struct spdk_io_channel_iter *i) if (!nvmf_qpair_abort_aer(qpair, cid)) { /* TODO: track list of outstanding requests in qpair? */ SPDK_DEBUGLOG(SPDK_LOG_NVMF, "cid %u not found\n", cid); - rsp->status.sct = SPDK_NVME_SCT_GENERIC; - rsp->status.sc = SPDK_NVME_SC_INVALID_FIELD; - spdk_for_each_channel_continue(i, -EINVAL); + spdk_for_each_channel_continue(i, -1); return; } SPDK_DEBUGLOG(SPDK_LOG_NVMF, "abort ctrlr=%p sqid=%u cid=%u successful\n", qpair->ctrlr, sqid, cid); - rsp->cdw0 = 0; /* Command successfully aborted */ - rsp->status.sct = SPDK_NVME_SCT_GENERIC; - rsp->status.sc = SPDK_NVME_SC_SUCCESS; + rsp->cdw0 &= ~1U; /* Command successfully aborted */ /* Return -1 for the status so the iteration across threads stops. */ spdk_for_each_channel_continue(i, -1); - + return; } } @@ -2142,9 +2138,9 @@ nvmf_ctrlr_abort(struct spdk_nvmf_request *req) { struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl; - rsp->cdw0 = 1; /* Command not aborted */ - rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC; - rsp->status.sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER; + rsp->cdw0 = 1U; /* Command not aborted */ + rsp->status.sct = SPDK_NVME_SCT_GENERIC; + rsp->status.sc = SPDK_NVME_SC_SUCCESS; /* Send a message to each poll group, searching for this ctrlr, sqid, and command. */ spdk_for_each_channel(req->qpair->ctrlr->subsys->tgt,