From f295f5b31a0f75f893fcdb42d6feb309f0b263bc Mon Sep 17 00:00:00 2001 From: paul luse Date: Wed, 1 Jul 2020 15:24:49 -0400 Subject: [PATCH] module/accel/ioat: add support for batching IOAT accelerated ops Also remove the batching check in accel_perf as all 3 engines now support it. Signed-off-by: paul luse Change-Id: Ib4cf4b148b50df50a4fc7be9e861cc83f355623a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3155 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- examples/accel/perf/accel_perf.c | 4 ++-- module/accel/ioat/accel_engine_ioat.c | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/examples/accel/perf/accel_perf.c b/examples/accel/perf/accel_perf.c index 9d8acb703..5144c78df 100644 --- a/examples/accel/perf/accel_perf.c +++ b/examples/accel/perf/accel_perf.c @@ -544,8 +544,8 @@ _init_thread(void *arg1) g_num_workers++; pthread_mutex_unlock(&g_workers_lock); - /* TODO: remove batch check once implemented for IOAT */ - if ((g_capabilites & ACCEL_BATCH) == ACCEL_BATCH && g_queue_depth > 1) { + /* Batching is only possible if there is at least 2 operations. */ + if (g_queue_depth > 1) { /* Selected engine supports batching and we have enough, so do it. */ max_per_batch = spdk_accel_batch_get_max(worker->ch); diff --git a/module/accel/ioat/accel_engine_ioat.c b/module/accel/ioat/accel_engine_ioat.c index d4c7cbccd..2ecfad5e6 100644 --- a/module/accel/ioat/accel_engine_ioat.c +++ b/module/accel/ioat/accel_engine_ioat.c @@ -288,8 +288,14 @@ static int ioat_batch_prep_copy(void *cb_arg, struct spdk_io_channel *ch, struct spdk_accel_batch *batch, void *dst, void *src, uint64_t nbytes, spdk_accel_completion_cb cb) { - /* TODO - HW ACCELERATED */ - return 0;; + struct ioat_io_channel *ioat_ch = spdk_io_channel_get_ctx(ch); + struct ioat_task *ioat_task = (struct ioat_task *)cb_arg; + + ioat_task->cb = cb; + ioat_ch->hw_batch = true; + + /* Call the IOAT library prep function. */ + return spdk_ioat_build_copy(ioat_ch->ioat_ch, ioat_task, ioat_done, dst, src, nbytes); } static int @@ -297,8 +303,14 @@ ioat_batch_prep_fill(void *cb_arg, struct spdk_io_channel *ch, struct spdk_accel_batch *batch, void *dst, uint8_t fill, uint64_t nbytes, spdk_accel_completion_cb cb) { - /* TODO - HW ACCELERATED */ - return 0; + struct ioat_io_channel *ioat_ch = spdk_io_channel_get_ctx(ch); + struct ioat_task *ioat_task = (struct ioat_task *)cb_arg; + + ioat_task->cb = cb; + ioat_ch->hw_batch = true; + + /* Call the IOAT library prep function. */ + return spdk_ioat_build_fill(ioat_ch->ioat_ch, ioat_task, ioat_done, dst, fill, nbytes); } static int @@ -391,7 +403,9 @@ ioat_batch_submit(void *cb_arg, struct spdk_io_channel *ch, struct spdk_accel_ba return -EINVAL; } - /* TODO submit the batched HW items first. */ + /* Flush the batched HW items first. */ + spdk_ioat_flush(ioat_ch->ioat_ch); + ioat_ch->hw_batch = false; /* Complete the batched software items. */ while ((op = TAILQ_FIRST(&ioat_ch->sw_batch))) {