nvmf/tcp: Move duplicated disconnect code to a function
Change-Id: Ib3daec83ec518a0934911e04d771c19cb34b6167 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470529 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
811a66e97e
commit
78a11548da
@ -890,6 +890,17 @@ spdk_nvmf_tcp_qpair_flush_pdus(void *_tqpair)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spdk_nvmf_tcp_qpair_disconnect(struct spdk_nvmf_tcp_qpair *tqpair)
|
||||||
|
{
|
||||||
|
SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "Disconnecting qpair %p\n", tqpair);
|
||||||
|
|
||||||
|
tqpair->state = NVME_TCP_QPAIR_STATE_EXITED;
|
||||||
|
spdk_nvmf_tcp_qpair_flush_pdus(tqpair);
|
||||||
|
spdk_poller_unregister(&tqpair->timeout_poller);
|
||||||
|
spdk_nvmf_qpair_disconnect(&tqpair->qpair, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_nvmf_tcp_qpair_write_pdu(struct spdk_nvmf_tcp_qpair *tqpair,
|
spdk_nvmf_tcp_qpair_write_pdu(struct spdk_nvmf_tcp_qpair *tqpair,
|
||||||
struct nvme_tcp_pdu *pdu,
|
struct nvme_tcp_pdu *pdu,
|
||||||
@ -1287,11 +1298,8 @@ spdk_nvmf_tcp_qpair_handle_timeout(void *ctx)
|
|||||||
|
|
||||||
SPDK_ERRLOG("No pdu coming for tqpair=%p within %d seconds\n", tqpair,
|
SPDK_ERRLOG("No pdu coming for tqpair=%p within %d seconds\n", tqpair,
|
||||||
SPDK_NVME_TCP_QPAIR_EXIT_TIMEOUT);
|
SPDK_NVME_TCP_QPAIR_EXIT_TIMEOUT);
|
||||||
tqpair->state = NVME_TCP_QPAIR_STATE_EXITED;
|
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "will disconect the tqpair=%p\n", tqpair);
|
|
||||||
spdk_poller_unregister(&tqpair->timeout_poller);
|
|
||||||
spdk_nvmf_qpair_disconnect(&tqpair->qpair, NULL, NULL);
|
|
||||||
|
|
||||||
|
spdk_nvmf_tcp_qpair_disconnect(tqpair);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2652,11 +2660,7 @@ spdk_nvmf_tcp_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_sock
|
|||||||
* State of tqpair: The tqpair is in EXITING state due to internal error
|
* State of tqpair: The tqpair is in EXITING state due to internal error
|
||||||
*/
|
*/
|
||||||
if ((rc < 0) || (tqpair->state == NVME_TCP_QPAIR_STATE_EXITING)) {
|
if ((rc < 0) || (tqpair->state == NVME_TCP_QPAIR_STATE_EXITING)) {
|
||||||
tqpair->state = NVME_TCP_QPAIR_STATE_EXITED;
|
spdk_nvmf_tcp_qpair_disconnect(tqpair);
|
||||||
spdk_nvmf_tcp_qpair_flush_pdus(tqpair);
|
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "will disconect the tqpair=%p\n", tqpair);
|
|
||||||
spdk_poller_unregister(&tqpair->timeout_poller);
|
|
||||||
spdk_nvmf_qpair_disconnect(&tqpair->qpair, NULL, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user