Commit f4b7b44a authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

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: default avatarBen 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 3185df90
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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;
				}