nvmf/tcp: Set DIF context to PDU when processing in-capsule, C2H, or H2C data

Set DIF context of the corresponding request to PDU when
- processing in-capsule data of the command,
- processing data of C2H PDU, or
- processing data of H2C PDU.

Change-Id: I3a668a55be21dbe2ee6ecf26476290670bd7b4a8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458929
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-06-24 15:23:50 +09:00 committed by Darek Stojaczyk
parent e3e023cfd3
commit 7ee58b90e1

View File

@ -1429,6 +1429,11 @@ spdk_nvmf_tcp_h2c_data_hdr_handle(struct spdk_nvmf_tcp_transport *ttransport,
} }
pdu->ctx = tcp_req; pdu->ctx = tcp_req;
if (spdk_unlikely(tcp_req->dif_insert_or_strip)) {
pdu->dif_ctx = &tcp_req->dif_ctx;
}
nvme_tcp_pdu_set_data_buf(pdu, tcp_req->req.iov, tcp_req->req.iovcnt, nvme_tcp_pdu_set_data_buf(pdu, tcp_req->req.iov, tcp_req->req.iovcnt,
h2c_data->datao, h2c_data->datal); h2c_data->datao, h2c_data->datal);
spdk_nvmf_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_PAYLOAD); spdk_nvmf_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_PAYLOAD);
@ -2304,10 +2309,14 @@ spdk_nvmf_tcp_send_c2h_data(struct spdk_nvmf_tcp_qpair *tqpair,
c2h_data->common.plen = plen; c2h_data->common.plen = plen;
if (spdk_unlikely(tcp_req->dif_insert_or_strip)) {
rsp_pdu->dif_ctx = &tcp_req->dif_ctx;
}
nvme_tcp_pdu_set_data_buf(rsp_pdu, tcp_req->req.iov, tcp_req->req.iovcnt, nvme_tcp_pdu_set_data_buf(rsp_pdu, tcp_req->req.iov, tcp_req->req.iovcnt,
c2h_data->datao, c2h_data->datal); c2h_data->datao, c2h_data->datal);
if (spdk_unlikely(rsp_pdu->dif_ctx != NULL)) { if (spdk_unlikely(tcp_req->dif_insert_or_strip)) {
rc = nvmf_tcp_pdu_verify_dif(rsp_pdu, rsp_pdu->dif_ctx); rc = nvmf_tcp_pdu_verify_dif(rsp_pdu, rsp_pdu->dif_ctx);
if (rc != 0) { if (rc != 0) {
/* Data digest error detected by the NVMe/TCP target is treated as non-fatal /* Data digest error detected by the NVMe/TCP target is treated as non-fatal