nvme/tcp: put the plen initialization into the correct location.

To fix a very small issue due to the refactoring, the previous
plen initialization is wrong. We will miss caculate 4 for
head digest, if we put this variable in this location.

Change-Id: I197e1498a4b7f7c4b8d9eb99447634ef9be1c76d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447669
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Ziye Yang 2019-03-12 05:40:04 +08:00 committed by Changpeng Liu
parent 87851b6f3a
commit 267f09dea0

View File

@ -226,7 +226,6 @@ nvme_tcp_build_iovecs(struct iovec *iovec, int num_iovs, struct nvme_tcp_pdu *pd
_iov_ctx_init(&ctx, iovec, num_iovs, pdu->writev_offset);
hlen = pdu->hdr.common.hlen;
plen = hlen;
enable_digest = 1;
if (pdu->hdr.common.pdu_type == SPDK_NVME_TCP_PDU_TYPE_IC_REQ ||
pdu->hdr.common.pdu_type == SPDK_NVME_TCP_PDU_TYPE_IC_RESP ||
@ -241,6 +240,7 @@ nvme_tcp_build_iovecs(struct iovec *iovec, int num_iovs, struct nvme_tcp_pdu *pd
hlen += SPDK_NVME_TCP_DIGEST_LEN;
}
plen = hlen;
if (!pdu->data_len || !pdu->data) {
/* PDU header + possible header digest */
_iov_ctx_set_iov(&ctx, (uint8_t *)&pdu->hdr.raw, hlen);