Commit f6646fd9 authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

nvme/tcp: detect cq errors.



We should alert the upper layer when the qpair becomes unusable due to
qpair errors.

Change-Id: Icdee3b55a14441a60111f3bd7a44dceef93bbb09
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474095


Reviewed-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent ac03d920
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -235,6 +235,7 @@ nvme_tcp_qpair_disconnect(struct spdk_nvme_qpair *qpair)
	struct nvme_tcp_qpair *tqpair = nvme_tcp_qpair(qpair);
	struct nvme_tcp_pdu *pdu;

	qpair->transport_qp_is_failed = true;
	spdk_sock_close(&tqpair->sock);

	/* clear the send_queue */
@@ -1490,7 +1491,7 @@ nvme_tcp_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_c
		if (rc < 0) {
			SPDK_DEBUGLOG(SPDK_LOG_NVME, "Error polling CQ! (%d): %s\n",
				      errno, spdk_strerror(errno));
			return -1;
			goto fail;
		} else if (rc == 0) {
			/* Partial PDU is read */
			break;
@@ -1503,6 +1504,19 @@ nvme_tcp_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_c
	}

	return reaped;
fail:

	/*
	 * Since admin queues take the ctrlr_lock before entering this function,
	 * we can call nvme_tcp_qpair_disconnect. For other qpairs we need
	 * to call the generic function which will take the lock for us.
	 */
	if (nvme_qpair_is_admin_queue(qpair)) {
		nvme_tcp_qpair_disconnect(qpair);
	} else {
		nvme_ctrlr_disconnect_qpair(qpair);
	}
	return -ENXIO;
}

static int
@@ -1610,8 +1624,10 @@ nvme_tcp_qpair_connect(struct nvme_tcp_qpair *tqpair)
		return -1;
	}

	tqpair->qpair.transport_qp_is_failed = false;
	rc = nvme_fabric_qpair_connect(&tqpair->qpair, tqpair->num_entries);
	if (rc < 0) {
		tqpair->qpair.transport_qp_is_failed = true;
		SPDK_ERRLOG("Failed to send an NVMe-oF Fabric CONNECT command\n");
		return -1;
	}
+1 −4
Original line number Diff line number Diff line
@@ -51,10 +51,7 @@ run_test suite test/nvmf/host/perf.sh $TEST_ARGS
#run_test test/nvmf/host/identify_kernel_nvmf.sh $TEST_ARGS
run_test suite test/nvmf/host/aer.sh $TEST_ARGS
run_test suite test/nvmf/host/fio.sh $TEST_ARGS
# The automated reconnect we do in this test currently only works for RDMA.
if [ $TEST_TRANSPORT == "rdma" ]; then
run_test suite test/nvmf/host/target_disconnect.sh $TEST_ARGS
fi

timing_exit host

+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ DEFINE_STUB(nvme_qpair_submit_request,
DEFINE_STUB(spdk_nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *,
	    (struct spdk_nvme_ctrlr *ctrlr), (struct spdk_nvme_ctrlr_process *)(uintptr_t)0x1);

DEFINE_STUB_V(nvme_ctrlr_disconnect_qpair, (struct spdk_nvme_qpair *qpair));

static void
test_nvme_tcp_pdu_set_data_buf(void)
{