From 34c48f1b3bd4e943b1598d6368a86ef382a97d0d Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Mon, 8 Aug 2022 13:51:25 -0700 Subject: [PATCH] accel: Do not refer to the "framework" as "engine" The word engine was both used (interchangeably with module) to refer to the things that plug into the framework and to the framework itself. This patch eliminates all use of the word engine that meant the framework. It leaves uses of the word that meant "module". Change-Id: I6b9b50e2f045ac39f2a74d0152ee8d6269be4bd1 Signed-off-by: Ben Walker Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13918 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Reviewed-by: Shuhei Matsumoto Reviewed-by: Paul Luse Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk --- autotest.sh | 2 +- examples/accel/perf/accel_perf.c | 2 +- include/spdk/accel.h | 22 ++++++++-------- lib/accel/Makefile | 2 +- lib/accel/{accel_engine.c => accel.c} | 26 +++++++++---------- lib/accel/{accel_engine_rpc.c => accel_rpc.c} | 0 lib/accel/spdk_accel.map | 6 ++--- lib/nvmf/tcp.c | 2 +- module/bdev/malloc/bdev_malloc.c | 4 +-- module/bdev/nvme/bdev_nvme.c | 2 +- module/event/subsystems/accel/accel.c | 14 +++++----- test/accel/accel.sh | 16 ++++++++++++ test/accel_engine/accel_engine.sh | 16 ------------ test/unit/lib/accel/accel.c/Makefile | 2 +- .../accel.c/{accel_engine_ut.c => accel_ut.c} | 2 +- .../lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c | 2 +- test/unit/lib/nvmf/tcp.c/tcp_ut.c | 2 +- test/unit/unittest.sh | 2 +- 18 files changed, 62 insertions(+), 62 deletions(-) rename lib/accel/{accel_engine.c => accel.c} (96%) rename lib/accel/{accel_engine_rpc.c => accel_rpc.c} (100%) create mode 100755 test/accel/accel.sh delete mode 100755 test/accel_engine/accel_engine.sh rename test/unit/lib/accel/accel.c/{accel_engine_ut.c => accel_ut.c} (99%) diff --git a/autotest.sh b/autotest.sh index 440a43349..b86558c17 100755 --- a/autotest.sh +++ b/autotest.sh @@ -161,7 +161,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then run_test "dpdk_mem_utility" test/dpdk_memory_utility/test_dpdk_mem_info.sh run_test "event" test/event/event.sh run_test "thread" test/thread/thread.sh - run_test "accel_engine" test/accel_engine/accel_engine.sh + run_test "accel" test/accel/accel.sh if [ $SPDK_TEST_BLOCKDEV -eq 1 ]; then run_test "blockdev_general" test/bdev/blockdev.sh diff --git a/examples/accel/perf/accel_perf.c b/examples/accel/perf/accel_perf.c index edbafec4c..ee4affbe5 100644 --- a/examples/accel/perf/accel_perf.c +++ b/examples/accel/perf/accel_perf.c @@ -628,7 +628,7 @@ _init_thread(void *arg1) worker->next = g_workers; g_workers = worker; pthread_mutex_unlock(&g_workers_lock); - worker->ch = spdk_accel_engine_get_io_channel(); + worker->ch = spdk_accel_get_io_channel(); if (worker->ch == NULL) { fprintf(stderr, "Unable to get an accel channel\n"); goto error; diff --git a/include/spdk/accel.h b/include/spdk/accel.h index c57706a11..af47de2d0 100644 --- a/include/spdk/accel.h +++ b/include/spdk/accel.h @@ -4,11 +4,11 @@ */ /** \file - * Acceleration engine abstraction layer + * Acceleration Framework */ -#ifndef SPDK_ACCEL_ENGINE_H -#define SPDK_ACCEL_ENGINE_H +#ifndef SPDK_ACCEL_H +#define SPDK_ACCEL_H #include "spdk/stdinc.h" @@ -40,35 +40,35 @@ enum accel_opcode { typedef void (*spdk_accel_completion_cb)(void *ref, int status); /** - * Acceleration engine finish callback. + * Acceleration framework finish callback. * * \param cb_arg Callback argument. */ typedef void (*spdk_accel_fini_cb)(void *cb_arg); /** - * Initialize the acceleration engine. + * Initialize the acceleration framework. * * \return 0 on success. */ -int spdk_accel_engine_initialize(void); +int spdk_accel_initialize(void); /** - * Close the acceleration engine. + * Close the acceleration framework. * * \param cb_fn Called when the close operation completes. * \param cb_arg Argument passed to the callback function. */ -void spdk_accel_engine_finish(spdk_accel_fini_cb cb_fn, void *cb_arg); +void spdk_accel_finish(spdk_accel_fini_cb cb_fn, void *cb_arg); /** - * Get the I/O channel registered on the acceleration engine. + * Get an I/O channel for the acceleration framework. * - * This I/O channel is used to submit copy request. + * This I/O channel is used to submit requests. * * \return a pointer to the I/O channel on success, or NULL on failure. */ -struct spdk_io_channel *spdk_accel_engine_get_io_channel(void); +struct spdk_io_channel *spdk_accel_get_io_channel(void); /** * Submit a copy request. diff --git a/lib/accel/Makefile b/lib/accel/Makefile index 5a42a943f..7e92c6aab 100644 --- a/lib/accel/Makefile +++ b/lib/accel/Makefile @@ -11,7 +11,7 @@ SO_MINOR := 0 SO_SUFFIX := $(SO_VER).$(SO_MINOR) LIBNAME = accel -C_SRCS = accel_engine.c accel_engine_rpc.c accel_sw.c +C_SRCS = accel.c accel_rpc.c accel_sw.c SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_accel.map) diff --git a/lib/accel/accel_engine.c b/lib/accel/accel.c similarity index 96% rename from lib/accel/accel_engine.c rename to lib/accel/accel.c index 0d4fe759e..52ae1ee01 100644 --- a/lib/accel/accel_engine.c +++ b/lib/accel/accel.c @@ -17,7 +17,7 @@ #include "spdk/crc32.h" #include "spdk/util.h" -/* Accelerator Engine Framework: The following provides a top level +/* Accelerator Framework: The following provides a top level * generic API for the accelerator functions defined here. Modules, * such as the one in /module/accel/ioat, supply the implementation * with the exception of the pure software implementation contained @@ -483,7 +483,7 @@ spdk_accel_module_list_add(struct spdk_accel_module_if *accel_module) /* Framework level channel create callback. */ static int -accel_engine_create_cb(void *io_device, void *ctx_buf) +accel_create_channel(void *io_device, void *ctx_buf) { struct accel_io_channel *accel_ch = ctx_buf; struct spdk_accel_task *accel_task; @@ -523,7 +523,7 @@ err: /* Framework level channel destroy callback. */ static void -accel_engine_destroy_cb(void *io_device, void *ctx_buf) +accel_destroy_channel(void *io_device, void *ctx_buf) { struct accel_io_channel *accel_ch = ctx_buf; int i; @@ -538,13 +538,13 @@ accel_engine_destroy_cb(void *io_device, void *ctx_buf) } struct spdk_io_channel * -spdk_accel_engine_get_io_channel(void) +spdk_accel_get_io_channel(void) { return spdk_get_io_channel(&spdk_accel_module_list); } static void -accel_engine_module_initialize(void) +accel_module_initialize(void) { struct spdk_accel_module_if *accel_engine_module; @@ -554,13 +554,13 @@ accel_engine_module_initialize(void) } int -spdk_accel_engine_initialize(void) +spdk_accel_initialize(void) { enum accel_opcode op; struct spdk_accel_module_if *accel_module = NULL; g_engine_started = true; - accel_engine_module_initialize(); + accel_module_initialize(); /* Create our priority global map of opcodes to engines, we populate starting * with the software engine (guaranteed to be first on the list) and then @@ -599,17 +599,17 @@ spdk_accel_engine_initialize(void) } #endif /* - * We need a unique identifier for the accel engine framework, so use the + * We need a unique identifier for the accel framework, so use the * spdk_accel_module_list address for this purpose. */ - spdk_io_device_register(&spdk_accel_module_list, accel_engine_create_cb, accel_engine_destroy_cb, - sizeof(struct accel_io_channel), "accel_module"); + spdk_io_device_register(&spdk_accel_module_list, accel_create_channel, accel_destroy_channel, + sizeof(struct accel_io_channel), "accel"); return 0; } static void -accel_engine_module_finish_cb(void) +accel_module_finish_cb(void) { spdk_accel_fini_cb cb_fn = g_fini_cb_fn; @@ -646,7 +646,7 @@ spdk_accel_module_finish(void) } if (!g_accel_engine_module) { - accel_engine_module_finish_cb(); + accel_module_finish_cb(); return; } @@ -658,7 +658,7 @@ spdk_accel_module_finish(void) } void -spdk_accel_engine_finish(spdk_accel_fini_cb cb_fn, void *cb_arg) +spdk_accel_finish(spdk_accel_fini_cb cb_fn, void *cb_arg) { enum accel_opcode op; diff --git a/lib/accel/accel_engine_rpc.c b/lib/accel/accel_rpc.c similarity index 100% rename from lib/accel/accel_engine_rpc.c rename to lib/accel/accel_rpc.c diff --git a/lib/accel/spdk_accel.map b/lib/accel/spdk_accel.map index b55b1e97e..944a123c0 100644 --- a/lib/accel/spdk_accel.map +++ b/lib/accel/spdk_accel.map @@ -2,9 +2,9 @@ global: # public functions - spdk_accel_engine_initialize; - spdk_accel_engine_finish; - spdk_accel_engine_get_io_channel; + spdk_accel_initialize; + spdk_accel_finish; + spdk_accel_get_io_channel; spdk_accel_submit_copy; spdk_accel_submit_dualcast; spdk_accel_submit_compare; diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index fd31ec32d..e4652b31d 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -1313,7 +1313,7 @@ nvmf_tcp_poll_group_create(struct spdk_nvmf_transport *transport, } } - tgroup->accel_channel = spdk_accel_engine_get_io_channel(); + tgroup->accel_channel = spdk_accel_get_io_channel(); if (spdk_unlikely(!tgroup->accel_channel)) { SPDK_ERRLOG("Cannot create accel_channel for tgroup=%p\n", tgroup); goto cleanup; diff --git a/module/bdev/malloc/bdev_malloc.c b/module/bdev/malloc/bdev_malloc.c index c15a8c51a..287088c33 100644 --- a/module/bdev/malloc/bdev_malloc.c +++ b/module/bdev/malloc/bdev_malloc.c @@ -478,9 +478,9 @@ malloc_create_channel_cb(void *io_device, void *ctx) { struct malloc_channel *ch = ctx; - ch->accel_channel = spdk_accel_engine_get_io_channel(); + ch->accel_channel = spdk_accel_get_io_channel(); if (!ch->accel_channel) { - SPDK_ERRLOG("Failed to get accel engine's IO channel\n"); + SPDK_ERRLOG("Failed to get accel framework's IO channel\n"); return -ENOMEM; } diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 75fe2d9c3..659dca730 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -2426,7 +2426,7 @@ bdev_nvme_create_poll_group_cb(void *io_device, void *ctx_buf) return -1; } - group->accel_channel = spdk_accel_engine_get_io_channel(); + group->accel_channel = spdk_accel_get_io_channel(); if (!group->accel_channel) { spdk_nvme_poll_group_destroy(group->group); SPDK_ERRLOG("Cannot get the accel_channel for bdev nvme polling group=%p\n", diff --git a/module/event/subsystems/accel/accel.c b/module/event/subsystems/accel/accel.c index 798d55eb0..ea34dc4cc 100644 --- a/module/event/subsystems/accel/accel.c +++ b/module/event/subsystems/accel/accel.c @@ -11,31 +11,31 @@ #include "spdk/env.h" static void -accel_engine_subsystem_initialize(void) +accel_subsystem_initialize(void) { int rc; - rc = spdk_accel_engine_initialize(); + rc = spdk_accel_initialize(); spdk_subsystem_init_next(rc); } static void -accel_engine_subsystem_finish_done(void *cb_arg) +accel_subsystem_finish_done(void *cb_arg) { spdk_subsystem_fini_next(); } static void -accel_engine_subsystem_finish(void) +accel_subsystem_finish(void) { - spdk_accel_engine_finish(accel_engine_subsystem_finish_done, NULL); + spdk_accel_finish(accel_subsystem_finish_done, NULL); } static struct spdk_subsystem g_spdk_subsystem_accel = { .name = "accel", - .init = accel_engine_subsystem_initialize, - .fini = accel_engine_subsystem_finish, + .init = accel_subsystem_initialize, + .fini = accel_subsystem_finish, .write_config_json = spdk_accel_write_config_json, }; diff --git a/test/accel/accel.sh b/test/accel/accel.sh new file mode 100755 index 000000000..9d13e5a6b --- /dev/null +++ b/test/accel/accel.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +testdir=$(readlink -f $(dirname $0)) +rootdir=$(readlink -f $testdir/../..) +source $rootdir/test/common/autotest_common.sh + +#Run through all SW ops with defaults for a quick sanity check +#To save time, only use verification case +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w crc32c -y +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w crc32c -y -C 2 +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w copy -y +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w fill -y +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w copy_crc32c -y +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w copy_crc32c -y -C 2 +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w dualcast -y +run_test "accel" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w compare -y diff --git a/test/accel_engine/accel_engine.sh b/test/accel_engine/accel_engine.sh deleted file mode 100755 index 6f28cd84c..000000000 --- a/test/accel_engine/accel_engine.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -testdir=$(readlink -f $(dirname $0)) -rootdir=$(readlink -f $testdir/../..) -source $rootdir/test/common/autotest_common.sh - -#Run through all SW ops with defaults for a quick sanity check -#To save time, only use verification case -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w crc32c -y -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w crc32c -y -C 2 -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w copy -y -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w fill -y -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w copy_crc32c -y -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w copy_crc32c -y -C 2 -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w dualcast -y -run_test "accel_engine" $SPDK_EXAMPLE_DIR/accel_perf -t 1 -w compare -y diff --git a/test/unit/lib/accel/accel.c/Makefile b/test/unit/lib/accel/accel.c/Makefile index 9cc41a2c4..cb0ef546b 100644 --- a/test/unit/lib/accel/accel.c/Makefile +++ b/test/unit/lib/accel/accel.c/Makefile @@ -5,6 +5,6 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../../..) -TEST_FILE = accel_engine_ut.c +TEST_FILE = accel_ut.c include $(SPDK_ROOT_DIR)/mk/spdk.unittest.mk diff --git a/test/unit/lib/accel/accel.c/accel_engine_ut.c b/test/unit/lib/accel/accel.c/accel_ut.c similarity index 99% rename from test/unit/lib/accel/accel.c/accel_engine_ut.c rename to test/unit/lib/accel/accel.c/accel_ut.c index fb9560aca..6e48caa3b 100644 --- a/test/unit/lib/accel/accel.c/accel_engine_ut.c +++ b/test/unit/lib/accel/accel.c/accel_ut.c @@ -9,7 +9,7 @@ #include "spdk_internal/accel_engine.h" #include "thread/thread_internal.h" #include "common/lib/test_env.c" -#include "accel/accel_engine.c" +#include "accel/accel.c" #include "accel/accel_sw.c" #include "unit/lib/json_mock.c" diff --git a/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c b/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c index 8b2fc861a..674613c3c 100644 --- a/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c +++ b/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c @@ -57,7 +57,7 @@ spdk_nvme_ctrlr_get_memory_domains(const struct spdk_nvme_ctrlr *ctrlr, } struct spdk_io_channel * -spdk_accel_engine_get_io_channel(void) +spdk_accel_get_io_channel(void) { return spdk_get_io_channel(g_accel_p); } diff --git a/test/unit/lib/nvmf/tcp.c/tcp_ut.c b/test/unit/lib/nvmf/tcp.c/tcp_ut.c index daaf4c91d..92d78d2fc 100644 --- a/test/unit/lib/nvmf/tcp.c/tcp_ut.c +++ b/test/unit/lib/nvmf/tcp.c/tcp_ut.c @@ -217,7 +217,7 @@ DEFINE_STUB(spdk_bdev_reset, int, (struct spdk_bdev_desc *desc, struct spdk_io_c DEFINE_STUB_V(spdk_bdev_free_io, (struct spdk_bdev_io *bdev_io)); struct spdk_io_channel * -spdk_accel_engine_get_io_channel(void) +spdk_accel_get_io_channel(void) { return spdk_get_io_channel(g_accel_p); } diff --git a/test/unit/unittest.sh b/test/unit/unittest.sh index e72b956db..b7fe5dfc2 100755 --- a/test/unit/unittest.sh +++ b/test/unit/unittest.sh @@ -219,7 +219,7 @@ if [ $(uname -s) = Linux ]; then run_test "unittest_ftl" unittest_ftl fi -run_test "unittest_accel" $valgrind $testdir/lib/accel/accel.c/accel_engine_ut +run_test "unittest_accel" $valgrind $testdir/lib/accel/accel.c/accel_ut run_test "unittest_ioat" $valgrind $testdir/lib/ioat/ioat.c/ioat_ut if grep -q '#define SPDK_CONFIG_IDXD 1' $rootdir/include/spdk/config.h; then run_test "unittest_idxd_user" $valgrind $testdir/lib/idxd/idxd_user.c/idxd_user_ut