nvme/tcp: Implement nvme_tcp_qpair_fail function.
This patch is used to implement this function. Since we need to call nvme_tcp_req_complete in this function, so we need to adjust the location of the nvme_tcp_rep_complete funtion. Change-Id: I5fc3693aec8dc166ac1eb03babcd2d73d7b00e63 Signed-off-by: Ziye Yang <optimistyzy@gmail.com> Reviewed-on: https://review.gerrithub.io/c/444489 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
This commit is contained in:
parent
e7dc23696b
commit
7bf5e1dee3
@ -244,6 +244,7 @@ nvme_tcp_qpair_destroy(struct spdk_nvme_qpair *qpair)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvme_tcp_qpair_fail(qpair);
|
||||||
nvme_qpair_deinit(qpair);
|
nvme_qpair_deinit(qpair);
|
||||||
|
|
||||||
tqpair = nvme_tcp_qpair(qpair);
|
tqpair = nvme_tcp_qpair(qpair);
|
||||||
@ -748,9 +749,37 @@ nvme_tcp_qpair_reset(struct spdk_nvme_qpair *qpair)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nvme_tcp_req_complete(struct nvme_request *req,
|
||||||
|
struct spdk_nvme_cpl *rsp)
|
||||||
|
{
|
||||||
|
nvme_complete_request(req, rsp);
|
||||||
|
nvme_free_request(req);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nvme_tcp_qpair_fail(struct spdk_nvme_qpair *qpair)
|
nvme_tcp_qpair_fail(struct spdk_nvme_qpair *qpair)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* If the qpair is really failed, the connection is broken
|
||||||
|
* and we need to flush back all I/O
|
||||||
|
*/
|
||||||
|
struct nvme_tcp_req *tcp_req, *tmp;
|
||||||
|
struct nvme_request *req;
|
||||||
|
struct spdk_nvme_cpl cpl;
|
||||||
|
struct nvme_tcp_qpair *tqpair = nvme_tcp_qpair(qpair);
|
||||||
|
|
||||||
|
cpl.status.sc = SPDK_NVME_SC_ABORTED_SQ_DELETION;
|
||||||
|
cpl.status.sct = SPDK_NVME_SCT_GENERIC;
|
||||||
|
|
||||||
|
TAILQ_FOREACH_SAFE(tcp_req, &tqpair->outstanding_reqs, link, tmp) {
|
||||||
|
assert(tcp_req->req != NULL);
|
||||||
|
req = tcp_req->req;
|
||||||
|
|
||||||
|
nvme_tcp_req_complete(req, &cpl);
|
||||||
|
nvme_tcp_req_put(tqpair, tcp_req);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -926,14 +955,6 @@ get_nvme_active_req_by_cid(struct nvme_tcp_qpair *tqpair, uint32_t cid)
|
|||||||
return &tqpair->tcp_reqs[cid];
|
return &tqpair->tcp_reqs[cid];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
nvme_tcp_req_complete(struct nvme_request *req,
|
|
||||||
struct spdk_nvme_cpl *rsp)
|
|
||||||
{
|
|
||||||
nvme_complete_request(req, rsp);
|
|
||||||
nvme_free_request(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvme_tcp_free_and_handle_queued_req(struct spdk_nvme_qpair *qpair)
|
nvme_tcp_free_and_handle_queued_req(struct spdk_nvme_qpair *qpair)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user