From 6074b3a3f98ddc2240e5ae8c9a073e19dbb3ecdd Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 5 Aug 2022 12:32:35 -0700 Subject: [PATCH] accel: Move definitions not needed by modules to accel_internal.h spdk_internal/accel_engine.h will become the API for accel modules. Move anything in there that a module doesn't need to see into lib/accel/accel_internal.h Some of the software fallback definitions didn't even need to be in a header and were moved to accel_engine.c Change-Id: Idb8b12b1c0c1de3d462b906e3df3ba9ee8f830b8 Signed-off-by: Ben Walker Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13911 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk Reviewed-by: Paul Luse --- include/spdk_internal/accel_engine.h | 15 --------------- lib/accel/accel_engine.c | 16 ++++++++++++++++ lib/accel/accel_engine_rpc.c | 2 +- lib/accel/accel_internal.h | 25 +++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 lib/accel/accel_internal.h diff --git a/include/spdk_internal/accel_engine.h b/include/spdk_internal/accel_engine.h index c1dfbe49b..e3d46d8ea 100644 --- a/include/spdk_internal/accel_engine.h +++ b/include/spdk_internal/accel_engine.h @@ -16,16 +16,6 @@ #include "../isa-l/include/igzip_lib.h" #endif -struct engine_info { - struct spdk_json_write_ctx *w; - const char *name; - enum accel_opcode ops[ACCEL_OPC_LAST]; - uint32_t num_ops; -}; - -typedef void (*_accel_for_each_engine_fn)(struct engine_info *info); -void _accel_for_each_engine(struct engine_info *info, _accel_for_each_engine_fn fn); - struct spdk_accel_task; void spdk_accel_task_complete(struct spdk_accel_task *task, int status); @@ -41,11 +31,6 @@ struct accel_io_channel { TAILQ_HEAD(, spdk_accel_task) task_pool; }; -struct sw_accel_io_channel { - struct spdk_poller *completion_poller; - TAILQ_HEAD(, spdk_accel_task) tasks_to_complete; -}; - struct spdk_accel_task { struct accel_io_channel *accel_ch; spdk_accel_completion_cb cb_fn; diff --git a/lib/accel/accel_engine.c b/lib/accel/accel_engine.c index 7ee81168d..451b5618a 100644 --- a/lib/accel/accel_engine.c +++ b/lib/accel/accel_engine.c @@ -7,6 +7,8 @@ #include "spdk_internal/accel_engine.h" +#include "accel_internal.h" + #include "spdk/env.h" #include "spdk/likely.h" #include "spdk/log.h" @@ -19,6 +21,10 @@ #include "libpmem.h" #endif +#ifdef SPDK_CONFIG_ISAL +#include "../isa-l/include/igzip_lib.h" +#endif + /* Accelerator Engine 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 @@ -141,6 +147,16 @@ _get_task(struct accel_io_channel *accel_ch, spdk_accel_completion_cb cb_fn, voi return accel_task; } +struct sw_accel_io_channel { + /* for ISAL */ +#ifdef SPDK_CONFIG_ISAL + struct isal_zstream stream; + struct inflate_state state; +#endif + struct spdk_poller *completion_poller; + TAILQ_HEAD(, spdk_accel_task) tasks_to_complete; +}; + /* Post SW completions to a list and complete in a poller as we don't want to * complete them on the caller's stack as they'll likely submit another. */ inline static void diff --git a/lib/accel/accel_engine_rpc.c b/lib/accel/accel_engine_rpc.c index cfb660d0d..335239203 100644 --- a/lib/accel/accel_engine_rpc.c +++ b/lib/accel/accel_engine_rpc.c @@ -3,7 +3,7 @@ * All rights reserved. */ -#include "spdk_internal/accel_engine.h" +#include "accel_internal.h" #include "spdk/rpc.h" #include "spdk/util.h" diff --git a/lib/accel/accel_internal.h b/lib/accel/accel_internal.h new file mode 100644 index 000000000..df0390600 --- /dev/null +++ b/lib/accel/accel_internal.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) Intel Corporation. + * All rights reserved. + */ + +#ifndef SPDK_INTERNAL_ACCEL_INTERNAL_H +#define SPDK_INTERNAL_ACCEL_INTERNAL_H + +#include "spdk/stdinc.h" + +#include "spdk/accel_engine.h" +#include "spdk/queue.h" +#include "spdk/config.h" + +struct engine_info { + struct spdk_json_write_ctx *w; + const char *name; + enum accel_opcode ops[ACCEL_OPC_LAST]; + uint32_t num_ops; +}; + +typedef void (*_accel_for_each_engine_fn)(struct engine_info *info); +void _accel_for_each_engine(struct engine_info *info, _accel_for_each_engine_fn fn); + +#endif