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: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474095
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2019-11-13 08:43:16 -07:00 committed by Tomasz Zawadzki
parent ac03d9206f
commit f6646fd9fa
3 changed files with 20 additions and 5 deletions

View File

@ -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;
}

View File

@ -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
run_test suite test/nvmf/host/target_disconnect.sh $TEST_ARGS
timing_exit host

View File

@ -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)
{