nvmf/tcp: initialize zcopy phase in nvmf_tcp_req_get

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ia74148fb36733deaf7b2f833ac0247859311a805
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10794
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Konrad Sztyber 2021-12-08 14:42:38 +01:00 committed by Tomasz Zawadzki
parent a50a70ecdf
commit 6631c2a8aa
3 changed files with 11 additions and 1 deletions

View File

@ -3709,7 +3709,7 @@ nvmf_ctrlr_use_zcopy(struct spdk_nvmf_request *req)
struct spdk_nvmf_transport *transport = req->qpair->transport;
struct spdk_nvmf_ns *ns;
req->zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
assert(req->zcopy_phase == NVMF_ZCOPY_PHASE_NONE);
if (!transport->opts.zcopy) {
return false;

View File

@ -397,6 +397,7 @@ nvmf_tcp_req_get(struct spdk_nvmf_tcp_qpair *tqpair)
tcp_req->h2c_offset = 0;
tcp_req->has_in_capsule_data = false;
tcp_req->req.dif_enabled = false;
tcp_req->req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
TAILQ_REMOVE(&tqpair->tcp_req_free_queue, tcp_req, state_link);
TAILQ_INSERT_TAIL(&tqpair->tcp_req_working_queue, tcp_req, state_link);

View File

@ -2337,6 +2337,7 @@ test_nvmf_ctrlr_use_zcopy(void)
req.qpair = &qpair;
req.cmd = &cmd;
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
/* Admin queue */
qpair.qid = 0;
@ -2374,6 +2375,7 @@ test_nvmf_ctrlr_use_zcopy(void)
/* Success */
CU_ASSERT(nvmf_ctrlr_use_zcopy(&req));
CU_ASSERT(req.zcopy_phase == NVMF_ZCOPY_PHASE_INIT);
}
static void
@ -2442,6 +2444,7 @@ test_spdk_nvmf_request_zcopy_start(void)
req.qpair = &qpair;
req.cmd = (union nvmf_h2c_msg *)&cmd;
req.rsp = &rsp;
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
cmd.opc = SPDK_NVME_OPC_READ;
/* Fail because no controller */
@ -2453,6 +2456,7 @@ test_spdk_nvmf_request_zcopy_start(void)
CU_ASSERT_EQUAL(rsp.nvme_cpl.status.sct, SPDK_NVME_SCT_GENERIC);
CU_ASSERT_EQUAL(rsp.nvme_cpl.status.sc, SPDK_NVME_SC_COMMAND_SEQUENCE_ERROR);
qpair.ctrlr = &ctrlr;
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
/* Fail because bad NSID */
CU_ASSERT(nvmf_ctrlr_use_zcopy(&req));
@ -2463,6 +2467,7 @@ test_spdk_nvmf_request_zcopy_start(void)
CU_ASSERT_EQUAL(rsp.nvme_cpl.status.sct, SPDK_NVME_SCT_GENERIC);
CU_ASSERT_EQUAL(rsp.nvme_cpl.status.sc, SPDK_NVME_SC_INVALID_NAMESPACE_OR_FORMAT);
cmd.nsid = 1;
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
/* Fail because bad Channel */
CU_ASSERT(nvmf_ctrlr_use_zcopy(&req));
@ -2473,6 +2478,7 @@ test_spdk_nvmf_request_zcopy_start(void)
CU_ASSERT_EQUAL(rsp.nvme_cpl.status.sct, SPDK_NVME_SCT_GENERIC);
CU_ASSERT_EQUAL(rsp.nvme_cpl.status.sc, SPDK_NVME_SC_INVALID_NAMESPACE_OR_FORMAT);
ns_info.channel = &io_ch;
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
/* Queue the requet because NSID is not active */
CU_ASSERT(nvmf_ctrlr_use_zcopy(&req));
@ -2483,6 +2489,7 @@ test_spdk_nvmf_request_zcopy_start(void)
CU_ASSERT_EQUAL(TAILQ_FIRST(&sgroups.queued), &req);
ns_info.state = SPDK_NVMF_SUBSYSTEM_ACTIVE;
TAILQ_REMOVE(&sgroups.queued, &req, link);
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
/* Fail because QPair is not active */
CU_ASSERT(nvmf_ctrlr_use_zcopy(&req));
@ -2493,6 +2500,7 @@ test_spdk_nvmf_request_zcopy_start(void)
CU_ASSERT(req.zcopy_phase == NVMF_ZCOPY_PHASE_INIT_FAILED);
qpair.state = SPDK_NVMF_QPAIR_ACTIVE;
qpair.state_cb = NULL;
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
/* Fail because nvmf_bdev_ctrlr_zcopy_start fails */
CU_ASSERT(nvmf_ctrlr_use_zcopy(&req));
@ -2504,6 +2512,7 @@ test_spdk_nvmf_request_zcopy_start(void)
CU_ASSERT_EQUAL(req.zcopy_phase, NVMF_ZCOPY_PHASE_INIT_FAILED);
cmd.cdw10 = 0;
cmd.cdw12 = 0;
req.zcopy_phase = NVMF_ZCOPY_PHASE_NONE;
/* Success */
CU_ASSERT(nvmf_ctrlr_use_zcopy(&req));