nvmf/tcp: 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_tcp_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: I1abceecc211ee79d8ac18a82dc63b13d313a6f27 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3008 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
This commit is contained in:
parent
a7d59c9d75
commit
b8a87e6af5
@ -46,6 +46,8 @@
|
||||
#include "spdk_internal/log.h"
|
||||
#include "spdk_internal/nvme_tcp.h"
|
||||
|
||||
#include "nvmf_internal.h"
|
||||
|
||||
#define NVMF_TCP_MAX_ACCEPT_SOCK_ONE_TIME 16
|
||||
#define SPDK_NVMF_TCP_DEFAULT_MAX_SOCK_PRIORITY 6
|
||||
#define SPDK_NVMF_TCP_RECV_BUF_SIZE_FACTOR 4
|
||||
@ -2463,6 +2465,40 @@ static void
|
||||
nvmf_tcp_qpair_abort_request(struct spdk_nvmf_qpair *qpair,
|
||||
struct spdk_nvmf_request *req)
|
||||
{
|
||||
struct spdk_nvmf_tcp_qpair *tqpair;
|
||||
uint16_t cid;
|
||||
uint32_t i;
|
||||
struct spdk_nvmf_tcp_req *tcp_req_to_abort = NULL;
|
||||
int rc;
|
||||
|
||||
tqpair = SPDK_CONTAINEROF(qpair, struct spdk_nvmf_tcp_qpair, qpair);
|
||||
cid = req->cmd->nvme_cmd.cdw10_bits.abort.cid;
|
||||
|
||||
for (i = 0; i < tqpair->resource_count; i++) {
|
||||
tcp_req_to_abort = &tqpair->reqs[i];
|
||||
|
||||
if (tcp_req_to_abort->state != TCP_REQUEST_STATE_FREE &&
|
||||
tcp_req_to_abort->req.cmd->nvme_cmd.cid == cid) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tcp_req_to_abort == NULL) {
|
||||
goto complete;
|
||||
}
|
||||
|
||||
switch (tcp_req_to_abort->state) {
|
||||
case TCP_REQUEST_STATE_EXECUTING:
|
||||
rc = nvmf_ctrlr_abort_request(req, &tcp_req_to_abort->req);
|
||||
if (rc == SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
complete:
|
||||
spdk_nvmf_request_complete(req);
|
||||
}
|
||||
|
||||
|
@ -163,6 +163,12 @@ DEFINE_STUB(nvmf_bdev_ctrlr_nvme_passthru_io,
|
||||
struct spdk_nvmf_request *req),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(nvmf_bdev_ctrlr_abort_cmd,
|
||||
int,
|
||||
(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
struct spdk_nvmf_request *req, struct spdk_nvmf_request *req_to_abort),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(nvmf_bdev_ctrlr_get_dif_ctx,
|
||||
bool,
|
||||
(struct spdk_bdev *bdev, struct spdk_nvme_cmd *cmd, struct spdk_dif_ctx *dif_ctx),
|
||||
|
Loading…
Reference in New Issue
Block a user