nvmf/tcp: eliminate function 'nvmf_tcp_pdu_payload_insert_dif'

This function is called only once and can be eliminated.

Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: I0b3e80c025b60a816e2113f859907f95e96dd183
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14578
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
MengjinWu 2022-09-20 11:21:47 +00:00 committed by Tomasz Zawadzki
parent 252c053e6f
commit 00005ed8d5

View File

@ -2097,21 +2097,6 @@ err:
nvmf_tcp_send_c2h_term_req(tqpair, pdu, fes, error_offset); nvmf_tcp_send_c2h_term_req(tqpair, pdu, fes, error_offset);
} }
static int
nvmf_tcp_pdu_payload_insert_dif(struct nvme_tcp_pdu *pdu, uint32_t read_offset,
int read_len)
{
int rc;
rc = spdk_dif_generate_stream(pdu->data_iov, pdu->data_iovcnt,
read_offset, read_len, pdu->dif_ctx);
if (rc != 0) {
SPDK_ERRLOG("DIF generate failed\n");
}
return rc;
}
static int static int
nvmf_tcp_sock_process(struct spdk_nvmf_tcp_qpair *tqpair) nvmf_tcp_sock_process(struct spdk_nvmf_tcp_qpair *tqpair)
{ {
@ -2213,11 +2198,12 @@ nvmf_tcp_sock_process(struct spdk_nvmf_tcp_qpair *tqpair)
return NVME_TCP_PDU_IN_PROGRESS; return NVME_TCP_PDU_IN_PROGRESS;
} }
if (spdk_unlikely(pdu->dif_ctx != NULL)) { /* Generate and insert DIF to whole data block received if DIF is enabled */
rc = nvmf_tcp_pdu_payload_insert_dif(pdu, 0, data_len); if (spdk_unlikely(pdu->dif_ctx != NULL) &&
if (rc != 0) { spdk_dif_generate_stream(pdu->data_iov, pdu->data_iovcnt, 0, data_len,
return NVME_TCP_PDU_FATAL; pdu->dif_ctx) != 0) {
} SPDK_ERRLOG("DIF generate failed\n");
return NVME_TCP_PDU_FATAL;
} }
/* All of this PDU has now been read from the socket. */ /* All of this PDU has now been read from the socket. */