From 50472c44cfcbf25c821b1d93dd91aed9e1d5cdf5 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Wed, 21 Jul 2021 23:08:16 +0800 Subject: [PATCH] idxd: Do not assign the results if there is error on completion. If there is hardware issues, we do not need to assign the result. Because we will report the error status to the uplayer. Change-Id: I647ddd609a1d5d0d52cc4fee59699b9992da4fa4 Signed-off-by: Ziye Yang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8864 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Paul Luse Reviewed-by: Krzysztof Karas Reviewed-by: Aleksey Marchuk --- lib/idxd/idxd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index b4f4bac3e..8b7b6402c 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -1155,11 +1155,13 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan) break; case IDXD_OPCODE_CRC32C_GEN: case IDXD_OPCODE_COPY_CRC: - *comp_ctx->crc_dst = comp_ctx->hw.crc32c_val; - *comp_ctx->crc_dst ^= ~0; + if (spdk_likely(status == 0)) { + *comp_ctx->crc_dst = comp_ctx->hw.crc32c_val; + *comp_ctx->crc_dst ^= ~0; + } break; case IDXD_OPCODE_COMPARE: - if (status == 0) { + if (spdk_likely(status == 0)) { status = comp_ctx->hw.result; } break; @@ -1169,8 +1171,8 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan) comp_ctx->cb_fn(comp_ctx->cb_arg, status); } + /* reinit the status in the completion context */ comp_ctx->hw.status = status = 0; - if (comp_ctx->batch_op == false) { assert(spdk_bit_array_get(chan->ring_slots, comp_ctx->index)); spdk_bit_array_clear(chan->ring_slots, comp_ctx->index);