Commit b95fc6fc authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

nvmf: Return the correct error for out-of-range QID



This one is actually a bit tough to deduce in the specification.
The NVMe-oF spec says that QID errors detected in the RDMA
transport shall return an RDMA-specific error indicating
the problem. However, our code doesn't detect the error in
RDMA-specific code, and it isn't clear if the language is
a "must" or a "should".

The NVMe specification does clearly indicate what error
to return on invalid QID in response to a Create
I/O Queue Pair command. For now, return that while
we game plan whether we need to call into the RDMA
transport to correctly report this error.

Change-Id: I7faf37bad9b9202bc50a906214a51c17e4808fc0
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/413858


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 008c111b
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -249,8 +249,8 @@ spdk_nvmf_ctrlr_add_io_qpair(void *ctx)


	if (spdk_nvmf_ctrlr_get_qpair(ctrlr, cmd->qid)) {
	if (spdk_nvmf_ctrlr_get_qpair(ctrlr, cmd->qid)) {
		SPDK_ERRLOG("Got I/O connect with duplicate QID %u\n", cmd->qid);
		SPDK_ERRLOG("Got I/O connect with duplicate QID %u\n", cmd->qid);
		rsp->status.sct = SPDK_NVME_SCT_GENERIC;
		rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
		rsp->status.sc = SPDK_NVME_SC_COMMAND_SEQUENCE_ERROR;
		rsp->status.sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER;
		goto end;
		goto end;
	}
	}


@@ -258,7 +258,7 @@ spdk_nvmf_ctrlr_add_io_qpair(void *ctx)
	if (ctrlr->num_qpairs >= ctrlr->max_qpairs_allowed) {
	if (ctrlr->num_qpairs >= ctrlr->max_qpairs_allowed) {
		SPDK_ERRLOG("qpair limit %d\n", ctrlr->num_qpairs);
		SPDK_ERRLOG("qpair limit %d\n", ctrlr->num_qpairs);
		rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
		rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
		rsp->status.sc = SPDK_NVMF_FABRIC_SC_CONTROLLER_BUSY;
		rsp->status.sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER;
		goto end;
		goto end;
	}
	}


+3 −3
Original line number Original line Diff line number Diff line
@@ -525,7 +525,7 @@ test_connect(void)
	rc = spdk_nvmf_ctrlr_connect(&req);
	rc = spdk_nvmf_ctrlr_connect(&req);
	CU_ASSERT(rc == SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS);
	CU_ASSERT(rc == SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS);
	CU_ASSERT(rsp.nvme_cpl.status.sct == SPDK_NVME_SCT_COMMAND_SPECIFIC);
	CU_ASSERT(rsp.nvme_cpl.status.sct == SPDK_NVME_SCT_COMMAND_SPECIFIC);
	CU_ASSERT(rsp.nvme_cpl.status.sc == SPDK_NVMF_FABRIC_SC_CONTROLLER_BUSY);
	CU_ASSERT(rsp.nvme_cpl.status.sc == SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER);
	CU_ASSERT(qpair.ctrlr == NULL);
	CU_ASSERT(qpair.ctrlr == NULL);
	ctrlr.num_qpairs = 0;
	ctrlr.num_qpairs = 0;


@@ -538,8 +538,8 @@ test_connect(void)
	cmd.connect_cmd.qid = 1;
	cmd.connect_cmd.qid = 1;
	rc = spdk_nvmf_ctrlr_connect(&req);
	rc = spdk_nvmf_ctrlr_connect(&req);
	CU_ASSERT(rc == SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS);
	CU_ASSERT(rc == SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS);
	CU_ASSERT(rsp.nvme_cpl.status.sct == SPDK_NVME_SCT_GENERIC);
	CU_ASSERT(rsp.nvme_cpl.status.sct == SPDK_NVME_SCT_COMMAND_SPECIFIC);
	CU_ASSERT(rsp.nvme_cpl.status.sc == SPDK_NVME_SC_COMMAND_SEQUENCE_ERROR);
	CU_ASSERT(rsp.nvme_cpl.status.sc == SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER);
	CU_ASSERT(qpair.ctrlr == NULL);
	CU_ASSERT(qpair.ctrlr == NULL);
	TAILQ_INIT(&ctrlr.qpairs);
	TAILQ_INIT(&ctrlr.qpairs);