nvmf/tcp: Get DIF context when handling capsule command header

When handling the capsule command header, call spdk_nvmf_request_get_dif_ctx
by passing the NVMf request and the reference to the DIF context, and set
the flag dif_insert_or_strip of the NVMf/TCP request to true.

spdk_nvmf_request_get_dif_ctx returns false immediately when the
corresponding NVMf controller disables DIF insert/strip.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I16f6b322f2692d5f9653d011a490e7929ec37365
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458928
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-06-21 14:00:28 +09:00 committed by Darek Stojaczyk
parent 1c7f92f075
commit 2c9b0af271
2 changed files with 10 additions and 0 deletions

View File

@ -2472,6 +2472,11 @@ spdk_nvmf_tcp_req_process(struct spdk_nvmf_tcp_transport *ttransport,
/* copy the cmd from the receive pdu */ /* copy the cmd from the receive pdu */
tcp_req->cmd = tqpair->pdu_in_progress.hdr.capsule_cmd.ccsqe; tcp_req->cmd = tqpair->pdu_in_progress.hdr.capsule_cmd.ccsqe;
if (spdk_unlikely(spdk_nvmf_request_get_dif_ctx(&tcp_req->req, &tcp_req->dif_ctx))) {
tcp_req->dif_insert_or_strip = true;
tqpair->pdu_in_progress.dif_ctx = &tcp_req->dif_ctx;
}
/* The next state transition depends on the data transfer needs of this request. */ /* The next state transition depends on the data transfer needs of this request. */
tcp_req->req.xfer = spdk_nvmf_tcp_req_get_xfer(tcp_req); tcp_req->req.xfer = spdk_nvmf_tcp_req_get_xfer(tcp_req);

View File

@ -156,6 +156,11 @@ DEFINE_STUB(spdk_nvmf_bdev_ctrlr_nvme_passthru_io,
struct spdk_nvmf_request *req), struct spdk_nvmf_request *req),
0); 0);
DEFINE_STUB(spdk_nvmf_bdev_ctrlr_get_dif_ctx,
bool,
(struct spdk_bdev *bdev, struct spdk_nvme_cmd *cmd, struct spdk_dif_ctx *dif_ctx),
false);
DEFINE_STUB(spdk_nvmf_transport_req_complete, DEFINE_STUB(spdk_nvmf_transport_req_complete,
int, int,
(struct spdk_nvmf_request *req), (struct spdk_nvmf_request *req),