Commit 9975d4a1 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarMichael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 47b0d427
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -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,