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 <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7471
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ziye Yang 2021-04-20 00:09:19 +08:00 committed by Jim Harris
parent 3727f6ea4a
commit 3df11166e7
2 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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: