idxd: Avoid multiple updates to output crc location

This only needs to be updated on the last step of the CRC calculation.

Change-Id: I0b41f33bfbbc195a857d1c39d9f8f7164d2bba8d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10292
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2021-11-18 12:13:11 -07:00 committed by Tomasz Zawadzki
parent 3185df9057
commit f4b7b44a8a

View File

@ -863,7 +863,7 @@ spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan,
spdk_idxd_req_cb cb_fn, void *cb_arg)
{
struct idxd_hw_desc *desc;
struct idxd_ops *op;
struct idxd_ops *op = NULL;
uint64_t src_addr;
int rc;
size_t i;
@ -904,6 +904,10 @@ spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan,
desc->xfer_size = siov[i].iov_len;
prev_crc = &op->hw.crc32c_val;
}
/* Only the last op copies the crc to the destination */
if (op) {
op->crc_dst = crc_dst;
}
@ -971,7 +975,7 @@ spdk_idxd_submit_copy_crc32c(struct spdk_idxd_io_channel *chan,
spdk_idxd_req_cb cb_fn, void *cb_arg)
{
struct idxd_hw_desc *desc;
struct idxd_ops *op;
struct idxd_ops *op = NULL;
void *src, *dst;
uint64_t src_addr, dst_addr;
int rc;
@ -1026,6 +1030,10 @@ spdk_idxd_submit_copy_crc32c(struct spdk_idxd_io_channel *chan,
desc->xfer_size = len;
prev_crc = &op->hw.crc32c_val;
}
/* Only the last op copies the crc to the destination */
if (op) {
op->crc_dst = crc_dst;
}
@ -1437,7 +1445,7 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
break;
case IDXD_OPCODE_CRC32C_GEN:
case IDXD_OPCODE_COPY_CRC:
if (spdk_likely(status == 0)) {
if (spdk_likely(status == 0 && op->crc_dst != NULL)) {
*op->crc_dst = op->hw.crc32c_val;
*op->crc_dst ^= ~0;
}