From 3df11166e7caf95c4fbdd14a6bcbabe2f4a5513c Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 20 Apr 2021 00:09:19 +0800 Subject: [PATCH] accel_engine: fix the bug while computing chained crc32c via hardware engine. This patch is used to fix the chained crc32c computing when users pass a vector. Since we use a union in spdk_accel_task structure to differentiate the usage on "src" and "the vector info" (iovs and iovcnt). So we cannot directly write the src field while users pass a vector. And I verified it in the hardware platform. Change-Id: I85d6e86fa689b261782f80a2f89d908a5d4db84f Signed-off-by: Ziye Yang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7471 Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Paul Luse Reviewed-by: Ben Walker --- lib/accel/accel_engine.c | 2 -- module/accel/idxd/accel_engine_idxd.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/accel/accel_engine.c b/lib/accel/accel_engine.c index acb043895c..4505951206 100644 --- a/lib/accel/accel_engine.c +++ b/lib/accel/accel_engine.c @@ -390,7 +390,6 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iove accel_task->chained.cb_fn = cb_fn; accel_task->chained.cb_arg = cb_arg; - accel_task->src = iov[0].iov_base; accel_task->nbytes = iov[0].iov_len; return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task); @@ -619,7 +618,6 @@ spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batc accel_task->chained.cb_fn = cb_fn; accel_task->chained.cb_arg = cb_arg; - accel_task->src = iovs[0].iov_base; accel_task->nbytes = iovs[0].iov_len; TAILQ_INSERT_TAIL(&batch->hw_tasks, accel_task, link); diff --git a/module/accel/idxd/accel_engine_idxd.c b/module/accel/idxd/accel_engine_idxd.c index 0ea88bbc21..44a2f742dc 100644 --- a/module/accel/idxd/accel_engine_idxd.c +++ b/module/accel/idxd/accel_engine_idxd.c @@ -110,6 +110,7 @@ _process_single_task(struct spdk_io_channel *ch, struct spdk_accel_task *task) struct idxd_io_channel *chan = spdk_io_channel_get_ctx(ch); int rc = 0; uint8_t fill_pattern = (uint8_t)task->fill_pattern; + void *src; switch (task->op_code) { case ACCEL_OPCODE_MEMMOVE: @@ -128,7 +129,8 @@ _process_single_task(struct spdk_io_channel *ch, struct spdk_accel_task *task) task); break; case ACCEL_OPCODE_CRC32C: - rc = spdk_idxd_submit_crc32c(chan->chan, task->dst, task->src, task->seed, task->nbytes, idxd_done, + src = (task->v.iovcnt == 0) ? task->src : task->v.iovs[0].iov_base; + rc = spdk_idxd_submit_crc32c(chan->chan, task->dst, src, task->seed, task->nbytes, idxd_done, task); break; default: