accel: Use vectored crc32 operations instead of chaining

Chaining may be faster, but this is really an implementation detail of
the idxd driver. Push the decision on how to implement a vectored crc
down into the individual drivers and eliminate it from the generic
framework.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Iedbdc5a6dbd3f7d1674d0a83f6827588f4b6b2fb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10291
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Ben Walker 2021-11-17 11:48:24 -07:00 committed by Tomasz Zawadzki
parent 8d2b6e6873
commit 1cfae16563
3 changed files with 5 additions and 64 deletions

View File

@ -67,13 +67,9 @@ enum accel_opcode {
};
struct spdk_accel_task {
struct accel_io_channel *accel_ch;
spdk_accel_completion_cb cb_fn;
void *cb_arg;
struct {
spdk_accel_completion_cb cb_fn;
void *cb_arg;
} chained;
struct accel_io_channel *accel_ch;
spdk_accel_completion_cb cb_fn;
void *cb_arg;
union {
struct {
struct iovec *iovs; /* iovs passed by the caller */

View File

@ -309,36 +309,6 @@ spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *crc_dst, void *sr
}
}
static void
crc32cv_done(void *cb_arg, int status)
{
struct spdk_accel_task *accel_task = cb_arg;
struct spdk_io_channel *ch = spdk_io_channel_from_ctx(accel_task->accel_ch);
assert(accel_task->chained.cb_fn != NULL);
assert(accel_task->chained.cb_arg != NULL);
if (spdk_likely(!status)) {
if (accel_task->op_code == ACCEL_OPCODE_COPY_CRC32C) {
accel_task->dst = (char *)accel_task->dst + accel_task->nbytes;
status = spdk_accel_submit_copy_crc32cv(ch, accel_task->dst, ++accel_task->v.iovs,
accel_task->v.iovcnt - 1, accel_task->crc_dst,
~(*((uint32_t *)accel_task->crc_dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
} else {
status = spdk_accel_submit_crc32cv(ch, accel_task->crc_dst, ++accel_task->v.iovs,
accel_task->v.iovcnt - 1, ~(*((uint32_t *)accel_task->crc_dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
}
if (spdk_likely(!status)) {
return;
}
}
accel_task->chained.cb_fn(accel_task->chained.cb_arg, status);
}
/* Accel framework public API for chained CRC-32C function */
int
spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, struct iovec *iov,
@ -357,10 +327,6 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, struct
return -EINVAL;
}
if (iov_cnt == 1) {
return spdk_accel_submit_crc32c(ch, crc_dst, iov[0].iov_base, seed, iov[0].iov_len, cb_fn, cb_arg);
}
accel_ch = spdk_io_channel_get_ctx(ch);
accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) {
@ -376,13 +342,6 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, struct
accel_task->op_code = ACCEL_OPCODE_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_CRC32C)) {
accel_task->cb_fn = crc32cv_done;
accel_task->cb_arg = accel_task;
accel_task->chained.cb_fn = cb_fn;
accel_task->chained.cb_arg = cb_arg;
accel_task->nbytes = iov[0].iov_len;
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_crc32cv(crc_dst, iov, iov_cnt, seed);
@ -442,11 +401,6 @@ spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iov
return -EINVAL;
}
if (iov_cnt == 1) {
return spdk_accel_submit_copy_crc32c(ch, dst, src_iovs[0].iov_base, crc_dst, seed,
src_iovs[0].iov_len, cb_fn, cb_arg);
}
accel_ch = spdk_io_channel_get_ctx(ch);
accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) {
@ -463,13 +417,6 @@ spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iov
accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
accel_task->cb_fn = crc32cv_done;
accel_task->cb_arg = accel_task;
accel_task->chained.cb_fn = cb_fn;
accel_task->chained.cb_arg = cb_arg;
accel_task->nbytes = src_iovs[0].iov_len;
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_copyv(dst, src_iovs, iov_cnt);

View File

@ -653,11 +653,9 @@ test_spdk_accel_submit_crc32cv(void)
CU_ASSERT(task.seed == seed);
CU_ASSERT(task.op_code == ACCEL_OPCODE_CRC32C);
CU_ASSERT(g_dummy_submit_called == true);
CU_ASSERT(task.cb_fn == crc32cv_done);
CU_ASSERT(task.cb_arg == &task);
CU_ASSERT(task.cb_fn == dummy_submit_cb_fn);
CU_ASSERT(task.cb_arg == cb_arg);
CU_ASSERT(task.nbytes == iov[0].iov_len);
CU_ASSERT(task.chained.cb_fn == dummy_submit_cb_fn);
CU_ASSERT(task.chained.cb_arg == cb_arg);
TAILQ_INSERT_TAIL(&g_accel_ch->task_pool, &task, link);
g_dummy_submit_called = false;