nvmf/rdma: Abort request whose CID matches if it is outstanding
Call nvmf_ctrlr_abort_request() if the request whose CID matches is found and its state is executing. nvmf_rdma_qpair_abort_request() returns immediately if rc is SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS, or calls spdk_nvmf_request_complete() otherwise. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I1462a21db7270f3d63f8f293ad4be61d52e74da1 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3011 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
This commit is contained in:
parent
040ee27c16
commit
deec1fc790
@ -45,6 +45,8 @@
|
||||
#include "spdk_internal/log.h"
|
||||
#include "spdk_internal/rdma.h"
|
||||
|
||||
#include "nvmf_internal.h"
|
||||
|
||||
struct spdk_nvme_rdma_hooks g_nvmf_hooks = {};
|
||||
const struct spdk_nvmf_transport_ops spdk_nvmf_transport_rdma;
|
||||
|
||||
@ -4030,6 +4032,40 @@ static void
|
||||
nvmf_rdma_qpair_abort_request(struct spdk_nvmf_qpair *qpair,
|
||||
struct spdk_nvmf_request *req)
|
||||
{
|
||||
struct spdk_nvmf_rdma_qpair *rqpair;
|
||||
uint16_t cid;
|
||||
uint32_t i;
|
||||
struct spdk_nvmf_rdma_request *rdma_req_to_abort = NULL;
|
||||
int rc;
|
||||
|
||||
rqpair = SPDK_CONTAINEROF(qpair, struct spdk_nvmf_rdma_qpair, qpair);
|
||||
cid = req->cmd->nvme_cmd.cdw10_bits.abort.cid;
|
||||
|
||||
for (i = 0; i < rqpair->max_queue_depth; i++) {
|
||||
rdma_req_to_abort = &rqpair->resources->reqs[i];
|
||||
|
||||
if (rdma_req_to_abort->state != RDMA_REQUEST_STATE_FREE &&
|
||||
rdma_req_to_abort->req.cmd->nvme_cmd.cid == cid) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rdma_req_to_abort == NULL) {
|
||||
goto complete;
|
||||
}
|
||||
|
||||
switch (rdma_req_to_abort->state) {
|
||||
case RDMA_REQUEST_STATE_EXECUTING:
|
||||
rc = nvmf_ctrlr_abort_request(req, &rdma_req_to_abort->req);
|
||||
if (rc == SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
complete:
|
||||
spdk_nvmf_request_complete(req);
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,9 @@ DEFINE_STUB(spdk_nvmf_request_get_dif_ctx, bool, (struct spdk_nvmf_request *req,
|
||||
DEFINE_STUB_V(spdk_nvme_trid_populate_transport, (struct spdk_nvme_transport_id *trid,
|
||||
enum spdk_nvme_transport_type trtype));
|
||||
DEFINE_STUB_V(spdk_nvmf_tgt_new_qpair, (struct spdk_nvmf_tgt *tgt, struct spdk_nvmf_qpair *qpair));
|
||||
DEFINE_STUB(nvmf_ctrlr_abort_request, int,
|
||||
(struct spdk_nvmf_request *req, struct spdk_nvmf_request *req_to_abort),
|
||||
0);
|
||||
|
||||
const char *
|
||||
spdk_nvme_transport_id_trtype_str(enum spdk_nvme_transport_type trtype)
|
||||
|
Loading…
Reference in New Issue
Block a user