nvme/tcp: Do not offload header crc32c calculation if header digest is enabled.

The header size is very small, which does not have too much value to
offload such calculation by hardware.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Iaa82f39312df7eef3282325a33677ea41ab735ab
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8011
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ziye Yang 2021-05-25 00:46:33 +08:00 committed by Tomasz Zawadzki
parent 51b6cbb9a7
commit 00b0dc6624
2 changed files with 3 additions and 30 deletions

View File

@ -101,7 +101,6 @@ struct nvme_tcp_pdu {
bool has_hdgst;
bool ddgst_enable;
uint32_t header_digest_crc32;
uint32_t data_digest_crc32;
uint8_t data_digest[SPDK_NVME_TCP_DIGEST_LEN];

View File

@ -460,22 +460,6 @@ pdu_data_crc32_compute(struct nvme_tcp_pdu *pdu)
_tcp_write_pdu(pdu);
}
static void
header_crc32_accel_done(void *cb_arg, int status)
{
struct nvme_tcp_pdu *pdu = cb_arg;
pdu->header_digest_crc32 ^= SPDK_CRC32C_XOR;
MAKE_DIGEST_WORD((uint8_t *)pdu->hdr.raw + pdu->hdr.common.hlen, pdu->header_digest_crc32);
if (spdk_unlikely(status)) {
SPDK_ERRLOG("Failed to compute header digest on pdu=%p\n", pdu);
_pdu_write_done(pdu, status);
return;
}
pdu_data_crc32_compute(pdu);
}
static int
nvme_tcp_qpair_write_pdu(struct nvme_tcp_qpair *tqpair,
struct nvme_tcp_pdu *pdu,
@ -484,27 +468,17 @@ nvme_tcp_qpair_write_pdu(struct nvme_tcp_qpair *tqpair,
{
int hlen;
uint32_t crc32c;
struct nvme_tcp_poll_group *tgroup = nvme_tcp_poll_group(tqpair->qpair.poll_group);
hlen = pdu->hdr.common.hlen;
pdu->cb_fn = cb_fn;
pdu->cb_arg = cb_arg;
pdu->qpair = tqpair;
/* Header Digest */
if (g_nvme_tcp_hdgst[pdu->hdr.common.pdu_type] && tqpair->flags.host_hdgst_enable) {
if (tgroup != NULL && tgroup->group.group->accel_fn_table.submit_accel_crc32c) {
pdu->iov[0].iov_base = &pdu->hdr.raw;
pdu->iov[0].iov_len = hlen;
tgroup->group.group->accel_fn_table.submit_accel_crc32c(tgroup->group.group->ctx,
&pdu->header_digest_crc32,
pdu->iov, 1, 0, header_crc32_accel_done, pdu);
return 0;
} else {
crc32c = nvme_tcp_pdu_calc_header_digest(pdu);
MAKE_DIGEST_WORD((uint8_t *)pdu->hdr.raw + hlen, crc32c);
}
crc32c = nvme_tcp_pdu_calc_header_digest(pdu);
MAKE_DIGEST_WORD((uint8_t *)pdu->hdr.raw + hlen, crc32c);
}
pdu_data_crc32_compute(pdu);