nvmf/tcp: Insert DIF to the newly read data to create extended LBA payload
Generate and insert DIF to each data block when reading more than a single byte. This update is very similar with the use case of spdk_dif_generate_stream in iSCSI target. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I063919a32153ac0daf6d6eb1836c0d5995b65d33 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459092 Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
ff0a7dfc42
commit
975239c29d
@ -1834,6 +1834,20 @@ err:
|
||||
spdk_nvmf_tcp_send_c2h_term_req(tqpair, pdu, fes, error_offset);
|
||||
}
|
||||
|
||||
static int
|
||||
nvmf_tcp_pdu_payload_insert_dif(struct nvme_tcp_pdu *pdu, int read_len)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = spdk_dif_generate_stream(pdu->data_iov, pdu->data_iovcnt,
|
||||
pdu->readv_offset, read_len, pdu->dif_ctx);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("DIF generate failed\n");
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#define MAX_NVME_TCP_PDU_LOOP_COUNT 32
|
||||
|
||||
static int
|
||||
@ -1944,8 +1958,15 @@ spdk_nvmf_tcp_sock_process(struct spdk_nvmf_tcp_qpair *tqpair)
|
||||
if (rc < 0) {
|
||||
return NVME_TCP_PDU_IN_PROGRESS;
|
||||
}
|
||||
|
||||
pdu->readv_offset += rc;
|
||||
|
||||
if (spdk_unlikely(pdu->dif_ctx != NULL)) {
|
||||
rc = nvmf_tcp_pdu_payload_insert_dif(pdu, rc);
|
||||
if (rc != 0) {
|
||||
return NVME_TCP_PDU_FATAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (pdu->readv_offset < data_len) {
|
||||
return NVME_TCP_PDU_IN_PROGRESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user