Commit 7ee58b90 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Darek Stojaczyk
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458929


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
parent e3e023cf
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1429,6 +1429,11 @@ spdk_nvmf_tcp_h2c_data_hdr_handle(struct spdk_nvmf_tcp_transport *ttransport,
	}

	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,
				  h2c_data->datao, h2c_data->datal);
	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;

	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,
				  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);
		if (rc != 0) {
			/* Data digest error detected by the NVMe/TCP target is treated as non-fatal