accel: Refer to plugins as 'modules' instead of 'engines'

This is consistent with the use of terms in other parts of SPDK and fits
with the code living under module/

Change-Id: If182f7cf2d160d57443a1b5f24e0065f191b59b2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13919
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2022-08-08 14:43:24 -07:00 committed by Tomasz Zawadzki
parent 40cb3961ec
commit 712e8cb7ef
34 changed files with 343 additions and 323 deletions

View File

@ -26,9 +26,9 @@ optimized software implementations of the operations will back the public API. A
operations supported by the framework have a backing software implementation in operations supported by the framework have a backing software implementation in
the event that no hardware accelerators have been enabled for that operation. the event that no hardware accelerators have been enabled for that operation.
When multiple hardware engines are enabled the framework will assign each operation to When multiple hardware modules are enabled the framework will assign each operation to
an engine based on the order in which it was initialized. So, for example if two modules are a module based on the order in which it was initialized. So, for example if two modules are
enabled, IOAT and software, the software engine will be used for every operation except those enabled, IOAT and software, the software module will be used for every operation except those
supported by IOAT. supported by IOAT.
## Acceleration Low Level Libraries {#accel_libs} ## Acceleration Low Level Libraries {#accel_libs}
@ -70,14 +70,14 @@ RPC is provided, the framework is available and will use the software plug-in mo
### IOAT Module {#accel_ioat} ### IOAT Module {#accel_ioat}
To use the IOAT engine, use the RPC [`ioat_scan_accel_engine`](https://spdk.io/doc/jsonrpc.html) before starting the application. To use the IOAT module, use the RPC [`ioat_scan_accel_module`](https://spdk.io/doc/jsonrpc.html) before starting the application.
### DSA Module {#accel_dsa} ### DSA Module {#accel_dsa}
The DSA module supports the DSA hardware and relies on the low level IDXD library. The DSA module supports the DSA hardware and relies on the low level IDXD library.
To use the DSA engine, use the RPC To use the DSA module, use the RPC
[`dsa_scan_accel_engine`](https://spdk.io/doc/jsonrpc.html). By default, this [`dsa_scan_accel_module`](https://spdk.io/doc/jsonrpc.html). By default, this
will attempt to load the SPDK user-space idxd driver. To use the built-in will attempt to load the SPDK user-space idxd driver. To use the built-in
kernel driver on Linux, add the `-k` parameter. See the next section for kernel driver on Linux, add the `-k` parameter. See the next section for
details on using the kernel driver. details on using the kernel driver.
@ -132,26 +132,26 @@ the step above.
### Software Module {#accel_sw} ### Software Module {#accel_sw}
The software module is enabled by default. If no hardware engine is explicitly The software module is enabled by default. If no hardware module is explicitly
enabled via startup RPC as discussed earlier, the software module will use ISA-L enabled via startup RPC as discussed earlier, the software module will use ISA-L
if available for functions such as CRC32C. Otherwise, standard glibc calls are if available for functions such as CRC32C. Otherwise, standard glibc calls are
used to back the framework API. used to back the framework API.
### Engine to Operation Code Assignment {#accel_assignments} ### Module to Operation Code Assignment {#accel_assignments}
When multiple engines are initialized, the accel framework will assign op codes to When multiple modules are initialized, the accel framework will assign op codes to
engines by first assigning all op codes to the Software Engine and then overriding modules by first assigning all op codes to the Software Module and then overriding
op code assignments to Hardware Engines in the order in which they were initialized. op code assignments to Hardware Modules in the order in which they were initialized.
The RPC `accel_get_opc_assignments` can be used at any time to see the current The RPC `accel_get_opc_assignments` can be used at any time to see the current
assignment map including the names of valid operations. The RPC `accel_assign_opc` assignment map including the names of valid operations. The RPC `accel_assign_opc`
can be used after initializing the desired Hardware Engines but before starting the can be used after initializing the desired Hardware Modules but before starting the
framework in the event that a specific override is desired. Note that to start an framework in the event that a specific override is desired. Note that to start an
application and send startup RPC's use the `--wait-for-rpc` parameter and then use the application and send startup RPC's use the `--wait-for-rpc` parameter and then use the
`framework_start_init` RPC to continue. For example, assume the DSA Engine is initialized `framework_start_init` RPC to continue. For example, assume the DSA Module is initialized
but for some reason the desire is to have the Software Module handle copies instead. but for some reason the desire is to have the Software Module handle copies instead.
The following RPCs would accomplish the copy override: The following RPCs would accomplish the copy override:
`./scripts/rpc.py dsa_scan_accel_engine `./scripts/rpc.py dsa_scan_accel_module
./scripts/rpc.py accel_assign_opc -o copy -e software ./scripts/rpc.py accel_assign_opc -o copy -e software
./scripts/rpc.py framework_start_init ./scripts/rpc.py framework_start_init
./scripts/rpc.py accel_get_opc_assignments ./scripts/rpc.py accel_get_opc_assignments
@ -166,5 +166,5 @@ The following RPCs would accomplish the copy override:
"decompress": "software" "decompress": "software"
}` }`
To detemine the name of available engines and their supported operations use the To detemine the name of available modules and their supported operations use the
RPC `accel_get_engine_info`. RPC `accel_get_module_info`.

View File

@ -442,8 +442,8 @@ Example response:
"framework_monitor_context_switch", "framework_monitor_context_switch",
"spdk_kill_instance", "spdk_kill_instance",
"accel_get_opc_assignments", "accel_get_opc_assignments",
"ioat_scan_accel_engine", "ioat_scan_accel_module",
"dsa_scan_accel_engine", "dsa_scan_accel_module",
"bdev_virtio_attach_controller", "bdev_virtio_attach_controller",
"bdev_virtio_scsi_get_devices", "bdev_virtio_scsi_get_devices",
"bdev_virtio_detach_controller", "bdev_virtio_detach_controller",
@ -1500,9 +1500,9 @@ Example response:
## Acceleration Framework Layer {#jsonrpc_components_accel_fw} ## Acceleration Framework Layer {#jsonrpc_components_accel_fw}
### accel_get_engine_info {#accel_get_engine_info} ### accel_get_module_info {#accel_get_module_info}
Get a list of valid engine names and their supported operations. Get a list of valid module names and their supported operations.
#### Parameters #### Parameters
@ -1515,7 +1515,7 @@ Example request:
~~~json ~~~json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "accel_get_engine_info", "method": "accel_get_module_info",
"id": 1 "id": 1
} }
~~~ ~~~
@ -1525,7 +1525,7 @@ Example response:
~~~json ~~~json
[ [
{ {
"engine": "software", "module": "software",
"supported ops": [ "supported ops": [
"copy", "copy",
"fill", "fill",
@ -1538,7 +1538,7 @@ Example response:
] ]
}, },
{ {
"engine": "dsa", "module": "dsa",
"supported ops": [ "supported ops": [
"copy", "copy",
"fill", "fill",
@ -1593,14 +1593,14 @@ Example response:
### accel_assign_opc {#rpc_accel_assign_opc} ### accel_assign_opc {#rpc_accel_assign_opc}
Manually assign an operation to an engine. Manually assign an operation to a module.
#### Parameters #### Parameters
Name | Optional | Type | Description Name | Optional | Type | Description
----------------------- | -------- | ----------- | ----------------- ----------------------- | -------- | ----------- | -----------------
opname | Required | string | name of operation opname | Required | string | name of operation
engine | Required | string | name of engine module | Required | string | name of module
#### Example #### Example
@ -1612,8 +1612,8 @@ Example request:
"method": "accel_assign_opc", "method": "accel_assign_opc",
"id": 1, "id": 1,
"params": { "params": {
"opanme": "copy", "opname": "copy",
"engine": "software" "module": "software"
} }
} }
~~~ ~~~
@ -1628,9 +1628,9 @@ Example response:
} }
~~~ ~~~
### dsa_scan_accel_engine {#rpc_dsa_scan_accel_engine} ### dsa_scan_accel_module {#rpc_dsa_scan_accel_module}
Set config and enable dsa accel engine offload. Set config and enable dsa accel module offload.
This feature is considered as experimental. This feature is considered as experimental.
#### Parameters #### Parameters
@ -1649,7 +1649,7 @@ Example request:
"config_kernel_mode": false "config_kernel_mode": false
}, },
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "dsa_scan_accel_engine", "method": "dsa_scan_accel_module",
"id": 1 "id": 1
} }
~~~ ~~~
@ -1664,9 +1664,9 @@ Example response:
} }
~~~ ~~~
### iaa_scan_accel_engine {#rpc_iaa_scan_accel_engine} ### iaa_scan_accel_module {#rpc_iaa_scan_accel_module}
Enable IAA accel engine offload. Enable IAA accel module offload.
This feature is considered as experimental. This feature is considered as experimental.
#### Parameters #### Parameters
@ -1680,7 +1680,7 @@ Example request:
~~~json ~~~json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "iaa_scan_accel_engine", "method": "iaa_scan_accel_module",
"id": 1 "id": 1
} }
~~~ ~~~
@ -1695,9 +1695,9 @@ Example response:
} }
~~~ ~~~
### ioat_scan_accel_engine {#rpc_ioat_scan_accel_engine} ### ioat_scan_accel_module {#rpc_ioat_scan_accel_module}
Enable ioat accel engine offload. Enable ioat accel module offload.
#### Parameters #### Parameters
@ -1710,7 +1710,7 @@ Example request:
~~~json ~~~json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "ioat_scan_accel_engine", "method": "ioat_scan_accel_module",
"id": 1 "id": 1
} }
~~~ ~~~

View File

@ -80,12 +80,12 @@ struct worker_thread {
static void static void
dump_user_config(void) dump_user_config(void)
{ {
const char *engine_name = NULL; const char *module_name = NULL;
int rc; int rc;
rc = spdk_accel_get_opc_engine_name(g_workload_selection, &engine_name); rc = spdk_accel_get_opc_module_name(g_workload_selection, &module_name);
if (rc) { if (rc) {
printf("error getting engine name (%d)\n", rc); printf("error getting module name (%d)\n", rc);
} }
printf("\nSPDK Configuration:\n"); printf("\nSPDK Configuration:\n");
@ -106,7 +106,7 @@ dump_user_config(void)
} else { } else {
printf("Transfer size: %u bytes\n", g_xfer_size_bytes); printf("Transfer size: %u bytes\n", g_xfer_size_bytes);
} }
printf("Engine: %s\n", engine_name); printf("Module: %s\n", module_name);
printf("Queue depth: %u\n", g_queue_depth); printf("Queue depth: %u\n", g_queue_depth);
printf("Allocate depth: %u\n", g_allocate_depth); printf("Allocate depth: %u\n", g_allocate_depth);
printf("# threads/core: %u\n", g_threads_per_core); printf("# threads/core: %u\n", g_threads_per_core);
@ -244,7 +244,7 @@ _get_task_data_bufs(struct ap_task *task)
int dst_buff_len = g_xfer_size_bytes; int dst_buff_len = g_xfer_size_bytes;
/* For dualcast, the DSA HW requires 4K alignment on destination addresses but /* For dualcast, the DSA HW requires 4K alignment on destination addresses but
* we do this for all engines to keep it simple. * we do this for all modules to keep it simple.
*/ */
if (g_workload_selection == ACCEL_OPC_DUALCAST) { if (g_workload_selection == ACCEL_OPC_DUALCAST) {
align = ALIGN_4K; align = ALIGN_4K;
@ -501,7 +501,7 @@ accel_done(void *arg1, int status)
worker->injected_miscompares++; worker->injected_miscompares++;
status = 0; status = 0;
} else if (status) { } else if (status) {
/* Expected to pass but the accel engine reported an error (ex: COMPARE operation). */ /* Expected to pass but the accel module reported an error (ex: COMPARE operation). */
worker->xfer_failed++; worker->xfer_failed++;
} }

View File

@ -259,27 +259,27 @@ int spdk_accel_submit_decompress(struct spdk_io_channel *ch, void *dst, void *sr
spdk_accel_completion_cb cb_fn, void *cb_arg); spdk_accel_completion_cb cb_fn, void *cb_arg);
/** /**
* Return the name of the engine assigned to a specfic opcode. * Return the name of the module assigned to a specfic opcode.
* *
* \param opcode Accel Framework Opcode enum value. Valid codes can be retrieved using * \param opcode Accel Framework Opcode enum value. Valid codes can be retrieved using
* `accel_get_opc_assignments` or `spdk_accel_get_opc_name`. * `accel_get_opc_assignments` or `spdk_accel_get_opc_name`.
* \param engine_name Pointer to update with engine name. * \param module_name Pointer to update with module name.
* *
* \return 0 if a valid engine name was provided. -EINVAL for invalid opcode * \return 0 if a valid module name was provided. -EINVAL for invalid opcode
* or -ENOENT no engine was found at this time for the provided opcode. * or -ENOENT no module was found at this time for the provided opcode.
*/ */
int spdk_accel_get_opc_engine_name(enum accel_opcode opcode, const char **engine_name); int spdk_accel_get_opc_module_name(enum accel_opcode opcode, const char **module_name);
/** /**
* Override the assignment of an opcode to an engine. * Override the assignment of an opcode to an module.
* *
* \param opcode Accel Framework Opcode enum value. Valid codes can be retrieved using * \param opcode Accel Framework Opcode enum value. Valid codes can be retrieved using
* `accel_get_opc_assignments` or `spdk_accel_get_opc_name`. * `accel_get_opc_assignments` or `spdk_accel_get_opc_name`.
* \param name Name of the engine to assign. Valid engine names may be retrieved * \param name Name of the module to assign. Valid module names may be retrieved
* with `spdk_accel_get_opc_engine_name` * with `spdk_accel_get_opc_module_name`
* *
* \return 0 if a valid opcode name was provided. -EINVAL for invalid opcode * \return 0 if a valid opcode name was provided. -EINVAL for invalid opcode
* or if the framework has started (cannot change engines after startup) * or if the framework has started (cannot change modules after startup)
*/ */
int spdk_accel_assign_opc(enum accel_opcode opcode, const char *name); int spdk_accel_assign_opc(enum accel_opcode opcode, const char *name);

View File

@ -3,8 +3,8 @@
* All rights reserved. * All rights reserved.
*/ */
#ifndef SPDK_INTERNAL_ACCEL_ENGINE_H #ifndef SPDK_ACCEL_MODULE_H
#define SPDK_INTERNAL_ACCEL_ENGINE_H #define SPDK_ACCEL_MODULE_H
#include "spdk/stdinc.h" #include "spdk/stdinc.h"

View File

@ -5,7 +5,7 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk_internal/accel_engine.h" #include "spdk_internal/accel_module.h"
#include "accel_internal.h" #include "accel_internal.h"
@ -30,35 +30,35 @@
/* Largest context size for all accel modules */ /* Largest context size for all accel modules */
static size_t g_max_accel_module_size = sizeof(struct spdk_accel_task); static size_t g_max_accel_module_size = sizeof(struct spdk_accel_task);
static struct spdk_accel_module_if *g_accel_engine_module = NULL; static struct spdk_accel_module_if *g_accel_module = NULL;
static spdk_accel_fini_cb g_fini_cb_fn = NULL; static spdk_accel_fini_cb g_fini_cb_fn = NULL;
static void *g_fini_cb_arg = NULL; static void *g_fini_cb_arg = NULL;
static bool g_engine_started = false; static bool g_modules_started = false;
/* Global list of registered accelerator modules */ /* Global list of registered accelerator modules */
static TAILQ_HEAD(, spdk_accel_module_if) spdk_accel_module_list = static TAILQ_HEAD(, spdk_accel_module_if) spdk_accel_module_list =
TAILQ_HEAD_INITIALIZER(spdk_accel_module_list); TAILQ_HEAD_INITIALIZER(spdk_accel_module_list);
/* Global array mapping capabilities to engines */ /* Global array mapping capabilities to modules */
static struct spdk_accel_module_if *g_engines_opc[ACCEL_OPC_LAST] = {}; static struct spdk_accel_module_if *g_modules_opc[ACCEL_OPC_LAST] = {};
static char *g_engines_opc_override[ACCEL_OPC_LAST] = {}; static char *g_modules_opc_override[ACCEL_OPC_LAST] = {};
struct accel_io_channel { struct accel_io_channel {
struct spdk_io_channel *engine_ch[ACCEL_OPC_LAST]; struct spdk_io_channel *module_ch[ACCEL_OPC_LAST];
void *task_pool_base; void *task_pool_base;
TAILQ_HEAD(, spdk_accel_task) task_pool; TAILQ_HEAD(, spdk_accel_task) task_pool;
}; };
int int
spdk_accel_get_opc_engine_name(enum accel_opcode opcode, const char **engine_name) spdk_accel_get_opc_module_name(enum accel_opcode opcode, const char **module_name)
{ {
if (opcode >= ACCEL_OPC_LAST) { if (opcode >= ACCEL_OPC_LAST) {
/* invalid opcode */ /* invalid opcode */
return -EINVAL; return -EINVAL;
} }
if (g_engines_opc[opcode]) { if (g_modules_opc[opcode]) {
*engine_name = g_engines_opc[opcode]->name; *module_name = g_modules_opc[opcode]->name;
} else { } else {
return -ENOENT; return -ENOENT;
} }
@ -67,20 +67,20 @@ spdk_accel_get_opc_engine_name(enum accel_opcode opcode, const char **engine_nam
} }
void void
_accel_for_each_engine(struct engine_info *info, _accel_for_each_engine_fn fn) _accel_for_each_module(struct module_info *info, _accel_for_each_module_fn fn)
{ {
struct spdk_accel_module_if *accel_engine; struct spdk_accel_module_if *accel_module;
enum accel_opcode opcode; enum accel_opcode opcode;
int j = 0; int j = 0;
TAILQ_FOREACH(accel_engine, &spdk_accel_module_list, tailq) { TAILQ_FOREACH(accel_module, &spdk_accel_module_list, tailq) {
for (opcode = 0; opcode < ACCEL_OPC_LAST; opcode++) { for (opcode = 0; opcode < ACCEL_OPC_LAST; opcode++) {
if (accel_engine->supports_opcode(opcode)) { if (accel_module->supports_opcode(opcode)) {
info->ops[j] = opcode; info->ops[j] = opcode;
j++; j++;
} }
} }
info->name = accel_engine->name; info->name = accel_module->name;
info->num_ops = j; info->num_ops = j;
fn(info); fn(info);
j = 0; j = 0;
@ -90,7 +90,7 @@ _accel_for_each_engine(struct engine_info *info, _accel_for_each_engine_fn fn)
int int
spdk_accel_assign_opc(enum accel_opcode opcode, const char *name) spdk_accel_assign_opc(enum accel_opcode opcode, const char *name)
{ {
if (g_engine_started == true) { if (g_modules_started == true) {
/* we don't allow re-assignment once things have started */ /* we don't allow re-assignment once things have started */
return -EINVAL; return -EINVAL;
} }
@ -100,8 +100,8 @@ spdk_accel_assign_opc(enum accel_opcode opcode, const char *name)
return -EINVAL; return -EINVAL;
} }
/* engine selection will be validated after the framework starts. */ /* module selection will be validated after the framework starts. */
g_engines_opc_override[opcode] = strdup(name); g_modules_opc_override[opcode] = strdup(name);
return 0; return 0;
} }
@ -152,8 +152,8 @@ spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_COPY]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_COPY];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_COPY]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_COPY];
accel_task = _get_task(accel_ch, cb_fn, cb_arg); accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) { if (accel_task == NULL) {
@ -166,7 +166,7 @@ spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src,
accel_task->nbytes = nbytes; accel_task->nbytes = nbytes;
accel_task->flags = flags; accel_task->flags = flags;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
/* Accel framework public API for dual cast copy function */ /* Accel framework public API for dual cast copy function */
@ -177,8 +177,8 @@ spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_DUALCAST]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_DUALCAST];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_DUALCAST]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_DUALCAST];
if ((uintptr_t)dst1 & (ALIGN_4K - 1) || (uintptr_t)dst2 & (ALIGN_4K - 1)) { if ((uintptr_t)dst1 & (ALIGN_4K - 1) || (uintptr_t)dst2 & (ALIGN_4K - 1)) {
SPDK_ERRLOG("Dualcast requires 4K alignment on dst addresses\n"); SPDK_ERRLOG("Dualcast requires 4K alignment on dst addresses\n");
@ -197,7 +197,7 @@ spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1,
accel_task->flags = flags; accel_task->flags = flags;
accel_task->op_code = ACCEL_OPC_DUALCAST; accel_task->op_code = ACCEL_OPC_DUALCAST;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
/* Accel framework public API for compare function */ /* Accel framework public API for compare function */
@ -208,8 +208,8 @@ spdk_accel_submit_compare(struct spdk_io_channel *ch, void *src1,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_COMPARE]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_COMPARE];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_COMPARE]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_COMPARE];
accel_task = _get_task(accel_ch, cb_fn, cb_arg); accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) { if (accel_task == NULL) {
@ -221,7 +221,7 @@ spdk_accel_submit_compare(struct spdk_io_channel *ch, void *src1,
accel_task->nbytes = nbytes; accel_task->nbytes = nbytes;
accel_task->op_code = ACCEL_OPC_COMPARE; accel_task->op_code = ACCEL_OPC_COMPARE;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
/* Accel framework public API for fill function */ /* Accel framework public API for fill function */
@ -232,8 +232,8 @@ spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_FILL]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_FILL];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_FILL]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_FILL];
accel_task = _get_task(accel_ch, cb_fn, cb_arg); accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) { if (accel_task == NULL) {
@ -246,7 +246,7 @@ spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst,
accel_task->flags = flags; accel_task->flags = flags;
accel_task->op_code = ACCEL_OPC_FILL; accel_task->op_code = ACCEL_OPC_FILL;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
/* Accel framework public API for CRC-32C function */ /* Accel framework public API for CRC-32C function */
@ -257,8 +257,8 @@ spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *crc_dst,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_CRC32C]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_CRC32C];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_CRC32C]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_CRC32C];
accel_task = _get_task(accel_ch, cb_fn, cb_arg); accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) { if (accel_task == NULL) {
@ -272,7 +272,7 @@ spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *crc_dst,
accel_task->nbytes = nbytes; accel_task->nbytes = nbytes;
accel_task->op_code = ACCEL_OPC_CRC32C; accel_task->op_code = ACCEL_OPC_CRC32C;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
/* Accel framework public API for chained CRC-32C function */ /* Accel framework public API for chained CRC-32C function */
@ -283,8 +283,8 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_CRC32C]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_CRC32C];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_CRC32C]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_CRC32C];
if (iov == NULL) { if (iov == NULL) {
SPDK_ERRLOG("iov should not be NULL"); SPDK_ERRLOG("iov should not be NULL");
@ -309,7 +309,7 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst,
accel_task->seed = seed; accel_task->seed = seed;
accel_task->op_code = ACCEL_OPC_CRC32C; accel_task->op_code = ACCEL_OPC_CRC32C;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
/* Accel framework public API for copy with CRC-32C function */ /* Accel framework public API for copy with CRC-32C function */
@ -320,8 +320,8 @@ spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_COPY_CRC32C]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_COPY_CRC32C];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_COPY_CRC32C]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_COPY_CRC32C];
accel_task = _get_task(accel_ch, cb_fn, cb_arg); accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) { if (accel_task == NULL) {
@ -337,7 +337,7 @@ spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst,
accel_task->flags = flags; accel_task->flags = flags;
accel_task->op_code = ACCEL_OPC_COPY_CRC32C; accel_task->op_code = ACCEL_OPC_COPY_CRC32C;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
/* Accel framework public API for chained copy + CRC-32C function */ /* Accel framework public API for chained copy + CRC-32C function */
@ -348,8 +348,8 @@ spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst,
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_COPY_CRC32C]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_COPY_CRC32C];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_COPY_CRC32C]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_COPY_CRC32C];
uint64_t nbytes; uint64_t nbytes;
uint32_t i; uint32_t i;
@ -384,7 +384,7 @@ spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst,
accel_task->flags = flags; accel_task->flags = flags;
accel_task->op_code = ACCEL_OPC_COPY_CRC32C; accel_task->op_code = ACCEL_OPC_COPY_CRC32C;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
} }
int int
@ -394,8 +394,8 @@ spdk_accel_submit_compress(struct spdk_io_channel *ch, void *dst, void *src, uin
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_COMPRESS]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_COMPRESS];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_COMPRESS]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_COMPRESS];
accel_task = _get_task(accel_ch, cb_fn, cb_arg); accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) { if (accel_task == NULL) {
@ -410,7 +410,7 @@ spdk_accel_submit_compress(struct spdk_io_channel *ch, void *dst, void *src, uin
accel_task->flags = flags; accel_task->flags = flags;
accel_task->op_code = ACCEL_OPC_COMPRESS; accel_task->op_code = ACCEL_OPC_COMPRESS;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
return 0; return 0;
} }
@ -421,8 +421,8 @@ spdk_accel_submit_decompress(struct spdk_io_channel *ch, void *dst, void *src, u
{ {
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch); struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task; struct spdk_accel_task *accel_task;
struct spdk_accel_module_if *engine = g_engines_opc[ACCEL_OPC_DECOMPRESS]; struct spdk_accel_module_if *module = g_modules_opc[ACCEL_OPC_DECOMPRESS];
struct spdk_io_channel *engine_ch = accel_ch->engine_ch[ACCEL_OPC_DECOMPRESS]; struct spdk_io_channel *module_ch = accel_ch->module_ch[ACCEL_OPC_DECOMPRESS];
accel_task = _get_task(accel_ch, cb_fn, cb_arg); accel_task = _get_task(accel_ch, cb_fn, cb_arg);
if (accel_task == NULL) { if (accel_task == NULL) {
@ -436,7 +436,7 @@ spdk_accel_submit_decompress(struct spdk_io_channel *ch, void *dst, void *src, u
accel_task->flags = flags; accel_task->flags = flags;
accel_task->op_code = ACCEL_OPC_DECOMPRESS; accel_task->op_code = ACCEL_OPC_DECOMPRESS;
return engine->submit_tasks(engine_ch, accel_task); return module->submit_tasks(module_ch, accel_task);
return 0; return 0;
} }
@ -468,7 +468,7 @@ spdk_accel_module_list_add(struct spdk_accel_module_if *accel_module)
/* Make sure that the software module is at the head of the list, this /* Make sure that the software module is at the head of the list, this
* will assure that all opcodes are later assigned to software first and * will assure that all opcodes are later assigned to software first and
* then udpated to HW engines as they are registered. * then udpated to HW modules as they are registered.
*/ */
if (strcmp(accel_module->name, "software") == 0) { if (strcmp(accel_module->name, "software") == 0) {
TAILQ_INSERT_HEAD(&spdk_accel_module_list, accel_module, tailq); TAILQ_INSERT_HEAD(&spdk_accel_module_list, accel_module, tailq);
@ -503,11 +503,11 @@ accel_create_channel(void *io_device, void *ctx_buf)
task_mem += g_max_accel_module_size; task_mem += g_max_accel_module_size;
} }
/* Assign engines and get IO channels for each */ /* Assign modules and get IO channels for each */
for (i = 0; i < ACCEL_OPC_LAST; i++) { for (i = 0; i < ACCEL_OPC_LAST; i++) {
accel_ch->engine_ch[i] = g_engines_opc[i]->get_io_channel(); accel_ch->module_ch[i] = g_modules_opc[i]->get_io_channel();
/* This can happen if idxd runs out of channels. */ /* This can happen if idxd runs out of channels. */
if (accel_ch->engine_ch[i] == NULL) { if (accel_ch->module_ch[i] == NULL) {
goto err; goto err;
} }
} }
@ -515,7 +515,7 @@ accel_create_channel(void *io_device, void *ctx_buf)
return 0; return 0;
err: err:
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
spdk_put_io_channel(accel_ch->engine_ch[j]); spdk_put_io_channel(accel_ch->module_ch[j]);
} }
free(accel_ch->task_pool_base); free(accel_ch->task_pool_base);
return -ENOMEM; return -ENOMEM;
@ -529,9 +529,9 @@ accel_destroy_channel(void *io_device, void *ctx_buf)
int i; int i;
for (i = 0; i < ACCEL_OPC_LAST; i++) { for (i = 0; i < ACCEL_OPC_LAST; i++) {
assert(accel_ch->engine_ch[i] != NULL); assert(accel_ch->module_ch[i] != NULL);
spdk_put_io_channel(accel_ch->engine_ch[i]); spdk_put_io_channel(accel_ch->module_ch[i]);
accel_ch->engine_ch[i] = NULL; accel_ch->module_ch[i] = NULL;
} }
free(accel_ch->task_pool_base); free(accel_ch->task_pool_base);
@ -546,10 +546,10 @@ spdk_accel_get_io_channel(void)
static void static void
accel_module_initialize(void) accel_module_initialize(void)
{ {
struct spdk_accel_module_if *accel_engine_module; struct spdk_accel_module_if *accel_module;
TAILQ_FOREACH(accel_engine_module, &spdk_accel_module_list, tailq) { TAILQ_FOREACH(accel_module, &spdk_accel_module_list, tailq) {
accel_engine_module->module_init(); accel_module->module_init();
} }
} }
@ -559,19 +559,19 @@ spdk_accel_initialize(void)
enum accel_opcode op; enum accel_opcode op;
struct spdk_accel_module_if *accel_module = NULL; struct spdk_accel_module_if *accel_module = NULL;
g_engine_started = true; g_modules_started = true;
accel_module_initialize(); accel_module_initialize();
/* Create our priority global map of opcodes to engines, we populate starting /* Create our priority global map of opcodes to modules, we populate starting
* with the software engine (guaranteed to be first on the list) and then * with the software module (guaranteed to be first on the list) and then
* updating opcodes with HW engines that have been initilaized. * updating opcodes with HW modules that have been initilaized.
* NOTE: all opcodes must be suported by software in the event that no HW * NOTE: all opcodes must be suported by software in the event that no HW
* engines are initilaized to support the operation. * modules are initilaized to support the operation.
*/ */
TAILQ_FOREACH(accel_module, &spdk_accel_module_list, tailq) { TAILQ_FOREACH(accel_module, &spdk_accel_module_list, tailq) {
for (op = 0; op < ACCEL_OPC_LAST; op++) { for (op = 0; op < ACCEL_OPC_LAST; op++) {
if (accel_module->supports_opcode(op)) { if (accel_module->supports_opcode(op)) {
g_engines_opc[op] = accel_module; g_modules_opc[op] = accel_module;
SPDK_DEBUGLOG(accel, "OPC 0x%x now assigned to %s\n", op, accel_module->name); SPDK_DEBUGLOG(accel, "OPC 0x%x now assigned to %s\n", op, accel_module->name);
} }
} }
@ -579,23 +579,23 @@ spdk_accel_initialize(void)
/* Now lets check for overrides and apply all that exist */ /* Now lets check for overrides and apply all that exist */
for (op = 0; op < ACCEL_OPC_LAST; op++) { for (op = 0; op < ACCEL_OPC_LAST; op++) {
if (g_engines_opc_override[op] != NULL) { if (g_modules_opc_override[op] != NULL) {
accel_module = _module_find_by_name(g_engines_opc_override[op]); accel_module = _module_find_by_name(g_modules_opc_override[op]);
if (accel_module == NULL) { if (accel_module == NULL) {
SPDK_ERRLOG("Invalid module name of %s\n", g_engines_opc_override[op]); SPDK_ERRLOG("Invalid module name of %s\n", g_modules_opc_override[op]);
return -EINVAL; return -EINVAL;
} }
if (accel_module->supports_opcode(op) == false) { if (accel_module->supports_opcode(op) == false) {
SPDK_ERRLOG("Engine %s does not support op code %d\n", accel_module->name, op); SPDK_ERRLOG("Module %s does not support op code %d\n", accel_module->name, op);
return -EINVAL; return -EINVAL;
} }
g_engines_opc[op] = accel_module; g_modules_opc[op] = accel_module;
} }
} }
#ifdef DEBUG #ifdef DEBUG
for (op = 0; op < ACCEL_OPC_LAST; op++) { for (op = 0; op < ACCEL_OPC_LAST; op++) {
assert(g_engines_opc[op] != NULL); assert(g_modules_opc[op] != NULL);
} }
#endif #endif
/* /*
@ -621,16 +621,16 @@ accel_module_finish_cb(void)
void void
spdk_accel_write_config_json(struct spdk_json_write_ctx *w) spdk_accel_write_config_json(struct spdk_json_write_ctx *w)
{ {
struct spdk_accel_module_if *accel_engine_module; struct spdk_accel_module_if *accel_module;
/* /*
* The accel fw has no config, there may be some in * The accel fw has no config, there may be some in
* the engines/modules though. * the modules though.
*/ */
spdk_json_write_array_begin(w); spdk_json_write_array_begin(w);
TAILQ_FOREACH(accel_engine_module, &spdk_accel_module_list, tailq) { TAILQ_FOREACH(accel_module, &spdk_accel_module_list, tailq) {
if (accel_engine_module->write_config_json) { if (accel_module->write_config_json) {
accel_engine_module->write_config_json(w); accel_module->write_config_json(w);
} }
} }
spdk_json_write_array_end(w); spdk_json_write_array_end(w);
@ -639,19 +639,19 @@ spdk_accel_write_config_json(struct spdk_json_write_ctx *w)
void void
spdk_accel_module_finish(void) spdk_accel_module_finish(void)
{ {
if (!g_accel_engine_module) { if (!g_accel_module) {
g_accel_engine_module = TAILQ_FIRST(&spdk_accel_module_list); g_accel_module = TAILQ_FIRST(&spdk_accel_module_list);
} else { } else {
g_accel_engine_module = TAILQ_NEXT(g_accel_engine_module, tailq); g_accel_module = TAILQ_NEXT(g_accel_module, tailq);
} }
if (!g_accel_engine_module) { if (!g_accel_module) {
accel_module_finish_cb(); accel_module_finish_cb();
return; return;
} }
if (g_accel_engine_module->module_fini) { if (g_accel_module->module_fini) {
spdk_thread_send_msg(spdk_get_thread(), g_accel_engine_module->module_fini, NULL); spdk_thread_send_msg(spdk_get_thread(), g_accel_module->module_fini, NULL);
} else { } else {
spdk_accel_module_finish(); spdk_accel_module_finish();
} }
@ -668,11 +668,11 @@ spdk_accel_finish(spdk_accel_fini_cb cb_fn, void *cb_arg)
g_fini_cb_arg = cb_arg; g_fini_cb_arg = cb_arg;
for (op = 0; op < ACCEL_OPC_LAST; op++) { for (op = 0; op < ACCEL_OPC_LAST; op++) {
if (g_engines_opc_override[op] != NULL) { if (g_modules_opc_override[op] != NULL) {
free(g_engines_opc_override[op]); free(g_modules_opc_override[op]);
g_engines_opc_override[op] = NULL; g_modules_opc_override[op] = NULL;
} }
g_engines_opc[op] = NULL; g_modules_opc[op] = NULL;
} }
spdk_io_device_unregister(&spdk_accel_module_list, NULL); spdk_io_device_unregister(&spdk_accel_module_list, NULL);

View File

@ -12,14 +12,14 @@
#include "spdk/queue.h" #include "spdk/queue.h"
#include "spdk/config.h" #include "spdk/config.h"
struct engine_info { struct module_info {
struct spdk_json_write_ctx *w; struct spdk_json_write_ctx *w;
const char *name; const char *name;
enum accel_opcode ops[ACCEL_OPC_LAST]; enum accel_opcode ops[ACCEL_OPC_LAST];
uint32_t num_ops; uint32_t num_ops;
}; };
typedef void (*_accel_for_each_engine_fn)(struct engine_info *info); typedef void (*_accel_for_each_module_fn)(struct module_info *info);
void _accel_for_each_engine(struct engine_info *info, _accel_for_each_engine_fn fn); void _accel_for_each_module(struct module_info *info, _accel_for_each_module_fn fn);
#endif #endif

View File

@ -37,7 +37,7 @@ rpc_accel_get_opc_assignments(struct spdk_jsonrpc_request *request,
{ {
struct spdk_json_write_ctx *w; struct spdk_json_write_ctx *w;
enum accel_opcode opcode; enum accel_opcode opcode;
const char *name, *engine_name; const char *name, *module_name;
int rc; int rc;
if (params != NULL) { if (params != NULL) {
@ -52,13 +52,13 @@ rpc_accel_get_opc_assignments(struct spdk_jsonrpc_request *request,
for (opcode = 0; opcode < ACCEL_OPC_LAST; opcode++) { for (opcode = 0; opcode < ACCEL_OPC_LAST; opcode++) {
rc = _get_opc_name(opcode, &name); rc = _get_opc_name(opcode, &name);
if (rc == 0) { if (rc == 0) {
rc = spdk_accel_get_opc_engine_name(opcode, &engine_name); rc = spdk_accel_get_opc_module_name(opcode, &module_name);
if (rc != 0) { if (rc != 0) {
/* This isn't fatal but throw an informational message if we /* This isn't fatal but throw an informational message if we
* cant get an engine name right now */ * cant get an module name right now */
SPDK_NOTICELOG("FYI error (%d) getting engine name.\n", rc); SPDK_NOTICELOG("FYI error (%d) getting module name.\n", rc);
} }
spdk_json_write_named_string(w, name, engine_name); spdk_json_write_named_string(w, name, module_name);
} else { } else {
/* this should never happen */ /* this should never happen */
SPDK_ERRLOG("Invalid opcode (%d)).\n", opcode); SPDK_ERRLOG("Invalid opcode (%d)).\n", opcode);
@ -73,7 +73,7 @@ SPDK_RPC_REGISTER("accel_get_opc_assignments", rpc_accel_get_opc_assignments,
SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME) SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
static void static void
rpc_dump_engine_info(struct engine_info *info) rpc_dump_module_info(struct module_info *info)
{ {
struct spdk_json_write_ctx *w = info->w; struct spdk_json_write_ctx *w = info->w;
const char *name; const char *name;
@ -82,8 +82,8 @@ rpc_dump_engine_info(struct engine_info *info)
spdk_json_write_object_begin(w); spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "engine", info->name); spdk_json_write_named_string(w, "module", info->name);
spdk_json_write_named_array_begin(w, "suppoerted ops"); spdk_json_write_named_array_begin(w, "supported ops");
for (i = 0; i < info->num_ops; i++) { for (i = 0; i < info->num_ops; i++) {
rc = _get_opc_name(i, &name); rc = _get_opc_name(i, &name);
@ -101,43 +101,44 @@ rpc_dump_engine_info(struct engine_info *info)
} }
static void static void
rpc_accel_get_engine_info(struct spdk_jsonrpc_request *request, rpc_accel_get_module_info(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
struct engine_info info; struct module_info info;
if (params != NULL) { if (params != NULL) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"accel_get_engine_info requires no parameters"); "accel_get_module_info requires no parameters");
return; return;
} }
info.w = spdk_jsonrpc_begin_result(request); info.w = spdk_jsonrpc_begin_result(request);
spdk_json_write_array_begin(info.w); spdk_json_write_array_begin(info.w);
_accel_for_each_engine(&info, rpc_dump_engine_info); _accel_for_each_module(&info, rpc_dump_module_info);
spdk_json_write_array_end(info.w); spdk_json_write_array_end(info.w);
spdk_jsonrpc_end_result(request, info.w); spdk_jsonrpc_end_result(request, info.w);
} }
SPDK_RPC_REGISTER("accel_get_engine_info", rpc_accel_get_engine_info, SPDK_RPC_REGISTER("accel_get_module_info", rpc_accel_get_module_info,
SPDK_RPC_RUNTIME) SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(accel_get_module_info, accel_get_engine_info)
struct rpc_accel_assign_opc { struct rpc_accel_assign_opc {
char *opname; char *opname;
char *engine; char *module;
}; };
static const struct spdk_json_object_decoder rpc_accel_assign_opc_decoders[] = { static const struct spdk_json_object_decoder rpc_accel_assign_opc_decoders[] = {
{"opname", offsetof(struct rpc_accel_assign_opc, opname), spdk_json_decode_string}, {"opname", offsetof(struct rpc_accel_assign_opc, opname), spdk_json_decode_string},
{"engine", offsetof(struct rpc_accel_assign_opc, engine), spdk_json_decode_string}, {"module", offsetof(struct rpc_accel_assign_opc, module), spdk_json_decode_string},
}; };
static void static void
free_accel_assign_opc(struct rpc_accel_assign_opc *r) free_accel_assign_opc(struct rpc_accel_assign_opc *r)
{ {
free(r->opname); free(r->opname);
free(r->engine); free(r->module);
} }
static void static void
@ -172,14 +173,14 @@ rpc_accel_assign_opc(struct spdk_jsonrpc_request *request,
goto cleanup; goto cleanup;
} }
rc = spdk_accel_assign_opc(opcode, req.engine); rc = spdk_accel_assign_opc(opcode, req.module);
if (rc) { if (rc) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"error assigning opcode"); "error assigning opcode");
goto cleanup; goto cleanup;
} }
SPDK_NOTICELOG("Operation %s will be assigned to engine %s\n", req.opname, req.engine); SPDK_NOTICELOG("Operation %s will be assigned to module %s\n", req.opname, req.module);
spdk_jsonrpc_send_bool_response(request, true); spdk_jsonrpc_send_bool_response(request, true);
cleanup: cleanup:

View File

@ -5,7 +5,7 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk_internal/accel_engine.h" #include "spdk_internal/accel_module.h"
#include "spdk/env.h" #include "spdk/env.h"
#include "spdk/likely.h" #include "spdk/likely.h"
@ -287,15 +287,15 @@ sw_accel_submit_tasks(struct spdk_io_channel *ch, struct spdk_accel_task *accel_
} }
static struct spdk_io_channel *sw_accel_get_io_channel(void); static struct spdk_io_channel *sw_accel_get_io_channel(void);
static int sw_accel_engine_init(void); static int sw_accel_module_init(void);
static void sw_accel_engine_fini(void *ctxt); static void sw_accel_module_fini(void *ctxt);
static size_t sw_accel_engine_get_ctx_size(void); static size_t sw_accel_module_get_ctx_size(void);
static struct spdk_accel_module_if g_sw_module = { static struct spdk_accel_module_if g_sw_module = {
.module_init = sw_accel_engine_init, .module_init = sw_accel_module_init,
.module_fini = sw_accel_engine_fini, .module_fini = sw_accel_module_fini,
.write_config_json = NULL, .write_config_json = NULL,
.get_ctx_size = sw_accel_engine_get_ctx_size, .get_ctx_size = sw_accel_module_get_ctx_size,
.name = "software", .name = "software",
.supports_opcode = sw_accel_supports_opcode, .supports_opcode = sw_accel_supports_opcode,
.get_io_channel = sw_accel_get_io_channel, .get_io_channel = sw_accel_get_io_channel,
@ -366,23 +366,23 @@ sw_accel_get_io_channel(void)
} }
static size_t static size_t
sw_accel_engine_get_ctx_size(void) sw_accel_module_get_ctx_size(void)
{ {
return sizeof(struct spdk_accel_task); return sizeof(struct spdk_accel_task);
} }
static int static int
sw_accel_engine_init(void) sw_accel_module_init(void)
{ {
SPDK_NOTICELOG("Accel framework software engine initialized.\n"); SPDK_NOTICELOG("Accel framework software module initialized.\n");
spdk_io_device_register(&g_sw_module, sw_accel_create_cb, sw_accel_destroy_cb, spdk_io_device_register(&g_sw_module, sw_accel_create_cb, sw_accel_destroy_cb,
sizeof(struct sw_accel_io_channel), "sw_accel_engine"); sizeof(struct sw_accel_io_channel), "sw_accel_module");
return 0; return 0;
} }
static void static void
sw_accel_engine_fini(void *ctxt) sw_accel_module_fini(void *ctxt)
{ {
spdk_io_device_unregister(&g_sw_module, NULL); spdk_io_device_unregister(&g_sw_module, NULL);
spdk_accel_module_finish(); spdk_accel_module_finish();

View File

@ -15,7 +15,7 @@
spdk_accel_submit_copy_crc32cv; spdk_accel_submit_copy_crc32cv;
spdk_accel_submit_compress; spdk_accel_submit_compress;
spdk_accel_submit_decompress; spdk_accel_submit_decompress;
spdk_accel_get_opc_engine_name; spdk_accel_get_opc_module_name;
spdk_accel_assign_opc; spdk_accel_assign_opc;
spdk_accel_write_config_json; spdk_accel_write_config_json;

View File

@ -10,7 +10,7 @@ SO_VER := 3
SO_MINOR := 0 SO_MINOR := 0
LIBNAME = accel_dsa LIBNAME = accel_dsa
C_SRCS = accel_engine_dsa.c accel_engine_dsa_rpc.c C_SRCS = accel_dsa.c accel_dsa_rpc.c
SPDK_MAP_FILE = $(SPDK_ROOT_DIR)/mk/spdk_blank.map SPDK_MAP_FILE = $(SPDK_ROOT_DIR)/mk/spdk_blank.map

View File

@ -3,11 +3,11 @@
* All rights reserved. * All rights reserved.
*/ */
#include "accel_engine_dsa.h" #include "accel_dsa.h"
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk_internal/accel_engine.h" #include "spdk_internal/accel_module.h"
#include "spdk/log.h" #include "spdk/log.h"
#include "spdk_internal/idxd.h" #include "spdk_internal/idxd.h"
@ -295,7 +295,7 @@ idxd_poll(void *arg)
} }
static size_t static size_t
accel_engine_dsa_get_ctx_size(void) accel_dsa_get_ctx_size(void)
{ {
return sizeof(struct idxd_task); return sizeof(struct idxd_task);
} }
@ -320,15 +320,15 @@ dsa_supports_opcode(enum accel_opcode opc)
} }
} }
static int accel_engine_dsa_init(void); static int accel_dsa_init(void);
static void accel_engine_dsa_exit(void *ctx); static void accel_dsa_exit(void *ctx);
static void accel_engine_dsa_write_config_json(struct spdk_json_write_ctx *w); static void accel_dsa_write_config_json(struct spdk_json_write_ctx *w);
static struct spdk_accel_module_if g_dsa_module = { static struct spdk_accel_module_if g_dsa_module = {
.module_init = accel_engine_dsa_init, .module_init = accel_dsa_init,
.module_fini = accel_engine_dsa_exit, .module_fini = accel_dsa_exit,
.write_config_json = accel_engine_dsa_write_config_json, .write_config_json = accel_dsa_write_config_json,
.get_ctx_size = accel_engine_dsa_get_ctx_size, .get_ctx_size = accel_dsa_get_ctx_size,
.name = "dsa", .name = "dsa",
.supports_opcode = dsa_supports_opcode, .supports_opcode = dsa_supports_opcode,
.get_io_channel = dsa_get_io_channel, .get_io_channel = dsa_get_io_channel,
@ -394,7 +394,7 @@ attach_cb(void *cb_ctx, struct spdk_idxd_device *idxd)
} }
void void
accel_engine_dsa_enable_probe(bool kernel_mode) accel_dsa_enable_probe(bool kernel_mode)
{ {
g_kernel_mode = kernel_mode; g_kernel_mode = kernel_mode;
g_dsa_enable = true; g_dsa_enable = true;
@ -412,7 +412,7 @@ probe_cb(void *cb_ctx, struct spdk_pci_device *dev)
} }
static int static int
accel_engine_dsa_init(void) accel_dsa_init(void)
{ {
if (!g_dsa_enable) { if (!g_dsa_enable) {
return -EINVAL; return -EINVAL;
@ -429,14 +429,14 @@ accel_engine_dsa_init(void)
} }
g_dsa_initialized = true; g_dsa_initialized = true;
SPDK_NOTICELOG("Accel framework DSA engine initialized.\n"); SPDK_NOTICELOG("Accel framework DSA module initialized.\n");
spdk_io_device_register(&g_dsa_module, dsa_create_cb, dsa_destroy_cb, spdk_io_device_register(&g_dsa_module, dsa_create_cb, dsa_destroy_cb,
sizeof(struct idxd_io_channel), "dsa_accel_engine"); sizeof(struct idxd_io_channel), "dsa_accel_module");
return 0; return 0;
} }
static void static void
accel_engine_dsa_exit(void *ctx) accel_dsa_exit(void *ctx)
{ {
struct idxd_device *dev; struct idxd_device *dev;
@ -456,11 +456,11 @@ accel_engine_dsa_exit(void *ctx)
} }
static void static void
accel_engine_dsa_write_config_json(struct spdk_json_write_ctx *w) accel_dsa_write_config_json(struct spdk_json_write_ctx *w)
{ {
if (g_dsa_enable) { if (g_dsa_enable) {
spdk_json_write_object_begin(w); spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "dsa_scan_accel_engine"); spdk_json_write_named_string(w, "method", "dsa_scan_accel_module");
spdk_json_write_named_object_begin(w, "params"); spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_bool(w, "config_kernel_mode", g_kernel_mode); spdk_json_write_named_bool(w, "config_kernel_mode", g_kernel_mode);
spdk_json_write_object_end(w); spdk_json_write_object_end(w);

View File

@ -8,6 +8,6 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
void accel_engine_dsa_enable_probe(bool kernel_mode); void accel_dsa_enable_probe(bool kernel_mode);
#endif /* SPDK_ACCEL_ENGINE_DSA_H */ #endif /* SPDK_ACCEL_ENGINE_DSA_H */

View File

@ -3,7 +3,7 @@
* All rights reserved. * All rights reserved.
*/ */
#include "accel_engine_dsa.h" #include "accel_dsa.h"
#include "spdk/rpc.h" #include "spdk/rpc.h"
#include "spdk/util.h" #include "spdk/util.h"
@ -11,23 +11,23 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk/env.h" #include "spdk/env.h"
struct rpc_dsa_scan_accel_engine { struct rpc_dsa_scan_accel_module {
bool config_kernel_mode; bool config_kernel_mode;
}; };
static const struct spdk_json_object_decoder rpc_dsa_scan_accel_engine_decoder[] = { static const struct spdk_json_object_decoder rpc_dsa_scan_accel_module_decoder[] = {
{"config_kernel_mode", offsetof(struct rpc_dsa_scan_accel_engine, config_kernel_mode), spdk_json_decode_bool, true}, {"config_kernel_mode", offsetof(struct rpc_dsa_scan_accel_module, config_kernel_mode), spdk_json_decode_bool, true},
}; };
static void static void
rpc_dsa_scan_accel_engine(struct spdk_jsonrpc_request *request, rpc_dsa_scan_accel_module(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
struct rpc_dsa_scan_accel_engine req = {}; struct rpc_dsa_scan_accel_module req = {};
if (params != NULL) { if (params != NULL) {
if (spdk_json_decode_object(params, rpc_dsa_scan_accel_engine_decoder, if (spdk_json_decode_object(params, rpc_dsa_scan_accel_module_decoder,
SPDK_COUNTOF(rpc_dsa_scan_accel_engine_decoder), SPDK_COUNTOF(rpc_dsa_scan_accel_module_decoder),
&req)) { &req)) {
SPDK_ERRLOG("spdk_json_decode_object() failed\n"); SPDK_ERRLOG("spdk_json_decode_object() failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
@ -42,7 +42,8 @@ rpc_dsa_scan_accel_engine(struct spdk_jsonrpc_request *request,
SPDK_NOTICELOG("Enabling DSA user-mode\n"); SPDK_NOTICELOG("Enabling DSA user-mode\n");
} }
accel_engine_dsa_enable_probe(req.config_kernel_mode); accel_dsa_enable_probe(req.config_kernel_mode);
spdk_jsonrpc_send_bool_response(request, true); spdk_jsonrpc_send_bool_response(request, true);
} }
SPDK_RPC_REGISTER("dsa_scan_accel_engine", rpc_dsa_scan_accel_engine, SPDK_RPC_STARTUP) SPDK_RPC_REGISTER("dsa_scan_accel_module", rpc_dsa_scan_accel_module, SPDK_RPC_STARTUP)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(dsa_scan_accel_module, dsa_scan_accel_engine)

View File

@ -10,7 +10,7 @@ SO_VER := 1
SO_MINOR := 0 SO_MINOR := 0
LIBNAME = accel_iaa LIBNAME = accel_iaa
C_SRCS = accel_engine_iaa.c accel_engine_iaa_rpc.c C_SRCS = accel_iaa.c accel_iaa_rpc.c
SPDK_MAP_FILE = $(SPDK_ROOT_DIR)/mk/spdk_blank.map SPDK_MAP_FILE = $(SPDK_ROOT_DIR)/mk/spdk_blank.map

View File

@ -1,13 +0,0 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) Intel Corporation.
* All rights reserved.
*/
#ifndef SPDK_ACCEL_ENGINE_IAA_H
#define SPDK_ACCEL_ENGINE_IAA_H
#include "spdk/stdinc.h"
void accel_engine_iaa_enable_probe(void);
#endif /* SPDK_ACCEL_ENGINE_IAA_H */

View File

@ -3,11 +3,11 @@
* All rights reserved. * All rights reserved.
*/ */
#include "accel_engine_iaa.h" #include "accel_iaa.h"
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk_internal/accel_engine.h" #include "spdk_internal/accel_module.h"
#include "spdk/log.h" #include "spdk/log.h"
#include "spdk_internal/idxd.h" #include "spdk_internal/idxd.h"
@ -239,7 +239,7 @@ idxd_poll(void *arg)
} }
static size_t static size_t
accel_engine_iaa_get_ctx_size(void) accel_iaa_get_ctx_size(void)
{ {
return sizeof(struct idxd_task); return sizeof(struct idxd_task);
} }
@ -260,15 +260,15 @@ iaa_supports_opcode(enum accel_opcode opc)
} }
} }
static int accel_engine_iaa_init(void); static int accel_iaa_init(void);
static void accel_engine_iaa_exit(void *ctx); static void accel_iaa_exit(void *ctx);
static void accel_engine_iaa_write_config_json(struct spdk_json_write_ctx *w); static void accel_iaa_write_config_json(struct spdk_json_write_ctx *w);
static struct spdk_accel_module_if g_iaa_module = { static struct spdk_accel_module_if g_iaa_module = {
.module_init = accel_engine_iaa_init, .module_init = accel_iaa_init,
.module_fini = accel_engine_iaa_exit, .module_fini = accel_iaa_exit,
.write_config_json = accel_engine_iaa_write_config_json, .write_config_json = accel_iaa_write_config_json,
.get_ctx_size = accel_engine_iaa_get_ctx_size, .get_ctx_size = accel_iaa_get_ctx_size,
.name = "iaa", .name = "iaa",
.supports_opcode = iaa_supports_opcode, .supports_opcode = iaa_supports_opcode,
.get_io_channel = iaa_get_io_channel, .get_io_channel = iaa_get_io_channel,
@ -334,7 +334,7 @@ attach_cb(void *cb_ctx, struct spdk_idxd_device *iaa)
} }
void void
accel_engine_iaa_enable_probe(void) accel_iaa_enable_probe(void)
{ {
g_iaa_enable = true; g_iaa_enable = true;
/* TODO initially only support user mode w/IAA */ /* TODO initially only support user mode w/IAA */
@ -352,7 +352,7 @@ caller_probe_cb(void *cb_ctx, struct spdk_pci_device *dev)
} }
static int static int
accel_engine_iaa_init(void) accel_iaa_init(void)
{ {
if (!g_iaa_enable) { if (!g_iaa_enable) {
return -EINVAL; return -EINVAL;
@ -369,14 +369,14 @@ accel_engine_iaa_init(void)
} }
g_iaa_initialized = true; g_iaa_initialized = true;
SPDK_NOTICELOG("Accel framework IAA engine initialized.\n"); SPDK_NOTICELOG("Accel framework IAA module initialized.\n");
spdk_io_device_register(&g_iaa_module, idxd_create_cb, idxd_destroy_cb, spdk_io_device_register(&g_iaa_module, idxd_create_cb, idxd_destroy_cb,
sizeof(struct idxd_io_channel), "iaa_accel_engine"); sizeof(struct idxd_io_channel), "iaa_accel_module");
return 0; return 0;
} }
static void static void
accel_engine_iaa_exit(void *ctx) accel_iaa_exit(void *ctx)
{ {
struct idxd_device *dev; struct idxd_device *dev;
@ -396,11 +396,11 @@ accel_engine_iaa_exit(void *ctx)
} }
static void static void
accel_engine_iaa_write_config_json(struct spdk_json_write_ctx *w) accel_iaa_write_config_json(struct spdk_json_write_ctx *w)
{ {
if (g_iaa_enable) { if (g_iaa_enable) {
spdk_json_write_object_begin(w); spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "iaa_scan_accel_engine"); spdk_json_write_named_string(w, "method", "iaa_scan_accel_module");
spdk_json_write_object_end(w); spdk_json_write_object_end(w);
spdk_json_write_object_end(w); spdk_json_write_object_end(w);
} }

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) Intel Corporation.
* All rights reserved.
*/
#ifndef SPDK_ACCEL_MODULE_IAA_H
#define SPDK_ACCEL_MODULE_IAA_H
#include "spdk/stdinc.h"
void accel_iaa_enable_probe(void);
#endif /* SPDK_ACCEL_MODULE_IAA_H */

View File

@ -3,7 +3,7 @@
* All rights reserved. * All rights reserved.
*/ */
#include "accel_engine_iaa.h" #include "accel_iaa.h"
#include "spdk/rpc.h" #include "spdk/rpc.h"
#include "spdk/util.h" #include "spdk/util.h"
@ -12,17 +12,18 @@
#include "spdk/env.h" #include "spdk/env.h"
static void static void
rpc_iaa_scan_accel_engine(struct spdk_jsonrpc_request *request, rpc_iaa_scan_accel_module(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
if (params != NULL) { if (params != NULL) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"iaa_scan_accel_engine requires no parameters"); "iaa_scan_accel_module requires no parameters");
return; return;
} }
SPDK_NOTICELOG("Enabling IAA user-mode\n"); SPDK_NOTICELOG("Enabling IAA user-mode\n");
accel_engine_iaa_enable_probe(); accel_iaa_enable_probe();
spdk_jsonrpc_send_bool_response(request, true); spdk_jsonrpc_send_bool_response(request, true);
} }
SPDK_RPC_REGISTER("iaa_scan_accel_engine", rpc_iaa_scan_accel_engine, SPDK_RPC_STARTUP) SPDK_RPC_REGISTER("iaa_scan_accel_module", rpc_iaa_scan_accel_module, SPDK_RPC_STARTUP)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(iaa_scan_accel_module, iaa_scan_accel_engine)

View File

@ -10,7 +10,7 @@ SO_VER := 4
SO_MINOR := 0 SO_MINOR := 0
LIBNAME = accel_ioat LIBNAME = accel_ioat
C_SRCS = accel_engine_ioat.c accel_engine_ioat_rpc.c C_SRCS = accel_ioat.c accel_ioat_rpc.c
SPDK_MAP_FILE = $(SPDK_ROOT_DIR)/mk/spdk_blank.map SPDK_MAP_FILE = $(SPDK_ROOT_DIR)/mk/spdk_blank.map

View File

@ -3,11 +3,11 @@
* All rights reserved. * All rights reserved.
*/ */
#include "accel_engine_ioat.h" #include "accel_ioat.h"
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk_internal/accel_engine.h" #include "spdk_internal/accel_module.h"
#include "spdk/log.h" #include "spdk/log.h"
#include "spdk/env.h" #include "spdk/env.h"
@ -67,23 +67,23 @@ ioat_free_device(struct ioat_device *dev)
pthread_mutex_unlock(&g_ioat_mutex); pthread_mutex_unlock(&g_ioat_mutex);
} }
static int accel_engine_ioat_init(void); static int accel_ioat_init(void);
static void accel_engine_ioat_exit(void *ctx); static void accel_ioat_exit(void *ctx);
static bool ioat_supports_opcode(enum accel_opcode opc); static bool ioat_supports_opcode(enum accel_opcode opc);
static struct spdk_io_channel *ioat_get_io_channel(void); static struct spdk_io_channel *ioat_get_io_channel(void);
static int ioat_submit_tasks(struct spdk_io_channel *ch, struct spdk_accel_task *accel_task); static int ioat_submit_tasks(struct spdk_io_channel *ch, struct spdk_accel_task *accel_task);
static size_t static size_t
accel_engine_ioat_get_ctx_size(void) accel_ioat_get_ctx_size(void)
{ {
return sizeof(struct spdk_accel_task); return sizeof(struct spdk_accel_task);
} }
static struct spdk_accel_module_if g_ioat_module = { static struct spdk_accel_module_if g_ioat_module = {
.module_init = accel_engine_ioat_init, .module_init = accel_ioat_init,
.module_fini = accel_engine_ioat_exit, .module_fini = accel_ioat_exit,
.write_config_json = NULL, .write_config_json = NULL,
.get_ctx_size = accel_engine_ioat_get_ctx_size, .get_ctx_size = accel_ioat_get_ctx_size,
.name = "ioat", .name = "ioat",
.supports_opcode = ioat_supports_opcode, .supports_opcode = ioat_supports_opcode,
.get_io_channel = ioat_get_io_channel, .get_io_channel = ioat_get_io_channel,
@ -249,13 +249,13 @@ attach_cb(void *cb_ctx, struct spdk_pci_device *pci_dev, struct spdk_ioat_chan *
} }
void void
accel_engine_ioat_enable_probe(void) accel_ioat_enable_probe(void)
{ {
g_ioat_enable = true; g_ioat_enable = true;
} }
static int static int
accel_engine_ioat_init(void) accel_ioat_init(void)
{ {
if (!g_ioat_enable) { if (!g_ioat_enable) {
return 0; return 0;
@ -272,9 +272,9 @@ accel_engine_ioat_init(void)
} }
g_ioat_initialized = true; g_ioat_initialized = true;
SPDK_NOTICELOG("Accel framework IOAT engine initialized.\n"); SPDK_NOTICELOG("Accel framework IOAT module initialized.\n");
spdk_io_device_register(&g_ioat_module, ioat_create_cb, ioat_destroy_cb, spdk_io_device_register(&g_ioat_module, ioat_create_cb, ioat_destroy_cb,
sizeof(struct ioat_io_channel), "ioat_accel_engine"); sizeof(struct ioat_io_channel), "ioat_accel_module");
return 0; return 0;
} }
@ -304,7 +304,7 @@ _device_unregister_cb(void *io_device)
} }
static void static void
accel_engine_ioat_exit(void *ctx) accel_ioat_exit(void *ctx)
{ {
if (g_ioat_initialized) { if (g_ioat_initialized) {
spdk_io_device_unregister(&g_ioat_module, _device_unregister_cb); spdk_io_device_unregister(&g_ioat_module, _device_unregister_cb);

View File

@ -3,13 +3,13 @@
* All rights reserved. * All rights reserved.
*/ */
#ifndef SPDK_ACCEL_ENGINE_IOAT_H #ifndef SPDK_ACCEL_MODULE_IOAT_H
#define SPDK_ACCEL_ENGINE_IOAT_H #define SPDK_ACCEL_MODULE_IOAT_H
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#define IOAT_MAX_CHANNELS 64 #define IOAT_MAX_CHANNELS 64
void accel_engine_ioat_enable_probe(void); void accel_ioat_enable_probe(void);
#endif /* SPDK_ACCEL_ENGINE_IOAT_H */ #endif /* SPDK_ACCEL_MODULE_IOAT_H */

View File

@ -3,25 +3,26 @@
* All rights reserved. * All rights reserved.
*/ */
#include "accel_engine_ioat.h" #include "accel_ioat.h"
#include "spdk/rpc.h" #include "spdk/rpc.h"
#include "spdk/util.h" #include "spdk/util.h"
#include "spdk/event.h" #include "spdk/event.h"
static void static void
rpc_ioat_scan_accel_engine(struct spdk_jsonrpc_request *request, rpc_ioat_scan_accel_module(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
if (params != NULL) { if (params != NULL) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"ioat_scan_accel_engine requires no parameters"); "ioat_scan_accel_module requires no parameters");
return; return;
} }
SPDK_NOTICELOG("Enabling IOAT\n"); SPDK_NOTICELOG("Enabling IOAT\n");
accel_engine_ioat_enable_probe(); accel_ioat_enable_probe();
spdk_jsonrpc_send_bool_response(request, true); spdk_jsonrpc_send_bool_response(request, true);
} }
SPDK_RPC_REGISTER("ioat_scan_accel_engine", rpc_ioat_scan_accel_engine, SPDK_RPC_STARTUP) SPDK_RPC_REGISTER("ioat_scan_accel_module", rpc_ioat_scan_accel_module, SPDK_RPC_STARTUP)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(ioat_scan_accel_module, ioat_scan_accel_engine)

View File

@ -1,25 +1,29 @@
from spdk.rpc.helpers import deprecated_alias
def accel_get_opc_assignments(client): def accel_get_opc_assignments(client):
"""Get list of opcode name to engine assignments. """Get list of opcode name to module assignments.
""" """
return client.call('accel_get_opc_assignments') return client.call('accel_get_opc_assignments')
def accel_get_engine_info(client): @deprecated_alias('accel_get_engine_info')
"""Get list of valid engine names and their operations. def accel_get_module_info(client):
"""Get list of valid module names and their operations.
""" """
return client.call('accel_get_engine_names') return client.call('accel_get_module_info')
def accel_assign_opc(client, opname, engine): def accel_assign_opc(client, opname, module):
"""Manually assign an operation to an engine. """Manually assign an operation to a module.
Args: Args:
opname: name of operation opname: name of operation
engine: name of engine module: name of module
""" """
params = { params = {
'opname': opname, 'opname': opname,
'engine': engine, 'module': module,
} }
return client.call('accel_assign_opc', params) return client.call('accel_assign_opc', params)

View File

@ -1,5 +1,9 @@
def dsa_scan_accel_engine(client, config_kernel_mode=None): from spdk.rpc.helpers import deprecated_alias
"""Scan and enable DSA accel engine.
@deprecated_alias('dsa_scan_accel_engine')
def dsa_scan_accel_module(client, config_kernel_mode=None):
"""Scan and enable DSA accel module.
Args: Args:
config_kernel_mode: Use kernel DSA driver. (optional) config_kernel_mode: Use kernel DSA driver. (optional)
@ -8,4 +12,4 @@ def dsa_scan_accel_engine(client, config_kernel_mode=None):
if config_kernel_mode is not None: if config_kernel_mode is not None:
params['config_kernel_mode'] = config_kernel_mode params['config_kernel_mode'] = config_kernel_mode
return client.call('dsa_scan_accel_engine', params) return client.call('dsa_scan_accel_module', params)

View File

@ -1,4 +1,8 @@
def iaa_scan_accel_engine(client): from spdk.rpc.helpers import deprecated_alias
"""Scan and enable IAA accel engine.
@deprecated_alias('iaa_scan_accel_engine')
def iaa_scan_accel_module(client):
"""Scan and enable IAA accel module.
""" """
return client.call('iaa_scan_accel_engine') return client.call('iaa_scan_accel_module')

View File

@ -1,4 +1,8 @@
def ioat_scan_accel_engine(client): from spdk.rpc.helpers import deprecated_alias
"""Enable IOAT accel engine.
@deprecated_alias('ioat_scan_accel_engine')
def ioat_scan_accel_module(client):
"""Enable IOAT accel module.
""" """
return client.call('ioat_scan_accel_engine') return client.call('ioat_scan_accel_module')

View File

@ -30,7 +30,7 @@ _get_default_rpc_methods() {
while read -r; do while read -r; do
# Each method name seems to be prefixed with 20h x 4. Then it can # Each method name seems to be prefixed with 20h x 4. Then it can
# be followed with list of aliases enclosed inside (). Example: # be followed with list of aliases enclosed inside (). Example:
# ioat_scan_accel_engine # ioat_scan_accel_module
[[ $REPLY =~ ^\ {4}([a-z]+(_[a-z]+)*)(\ *\((.+)\))? ]] || continue [[ $REPLY =~ ^\ {4}([a-z]+(_[a-z]+)*)(\ *\((.+)\))? ]] || continue
names=("${BASH_REMATCH[1]}") names=("${BASH_REMATCH[1]}")

View File

@ -1272,8 +1272,8 @@ class SPDKTarget(Target):
nvme_adminq_poll_period_us=100000, retry_count=4) nvme_adminq_poll_period_us=100000, retry_count=4)
if self.enable_dsa: if self.enable_dsa:
rpc.dsa.dsa_scan_accel_engine(self.client, config_kernel_mode=None) rpc.dsa.dsa_scan_accel_module(self.client, config_kernel_mode=None)
self.log_print("Target DSA accel engine enabled") self.log_print("Target DSA accel module enabled")
rpc.app.framework_set_scheduler(self.client, name=self.scheduler_name, core_limit=self.scheduler_core_limit) rpc.app.framework_set_scheduler(self.client, name=self.scheduler_name, core_limit=self.scheduler_core_limit)
rpc.framework_start_init(self.client) rpc.framework_start_init(self.client)

View File

@ -2620,47 +2620,47 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
def accel_get_opc_assignments(args): def accel_get_opc_assignments(args):
print_dict(rpc.accel.accel_get_opc_assignments(args.client)) print_dict(rpc.accel.accel_get_opc_assignments(args.client))
p = subparsers.add_parser('accel_get_opc_assignments', help='Get list of opcode name to engine assignments.') p = subparsers.add_parser('accel_get_opc_assignments', help='Get list of opcode name to module assignments.')
p.set_defaults(func=accel_get_opc_assignments) p.set_defaults(func=accel_get_opc_assignments)
def accel_get_engine_info(args): def accel_get_module_info(args):
print_dict(rpc.accel.accel_get_engine_info(args.client)) print_dict(rpc.accel.accel_get_module_info(args.client))
p = subparsers.add_parser('accel_get_engine_info', help='Get list of valid engine names and their operations.') p = subparsers.add_parser('accel_get_module_info', help='Get list of valid module names and their operations.')
p.set_defaults(func=accel_get_engine_info) p.set_defaults(func=accel_get_module_info)
def accel_assign_opc(args): def accel_assign_opc(args):
rpc.accel.accel_assign_opc(args.client, opname=args.opname, engine=args.engine) rpc.accel.accel_assign_opc(args.client, opname=args.opname, module=args.module)
p = subparsers.add_parser('accel_assign_opc', help='Manually assign an operation to an engine.') p = subparsers.add_parser('accel_assign_opc', help='Manually assign an operation to a module.')
p.add_argument('-o', '--opname', help='opname') p.add_argument('-o', '--opname', help='opname')
p.add_argument('-e', '--engine', help='name of engine') p.add_argument('-m', '--module', help='name of module')
p.set_defaults(func=accel_assign_opc) p.set_defaults(func=accel_assign_opc)
# ioat # ioat
def ioat_scan_accel_engine(args): def ioat_scan_accel_module(args):
rpc.ioat.ioat_scan_accel_engine(args.client) rpc.ioat.ioat_scan_accel_module(args.client)
p = subparsers.add_parser('ioat_scan_accel_engine', help='Enable IOAT accel engine offload.') p = subparsers.add_parser('ioat_scan_accel_module', help='Enable IOAT accel module offload.')
p.set_defaults(func=ioat_scan_accel_engine) p.set_defaults(func=ioat_scan_accel_module)
# dsa # dsa
def dsa_scan_accel_engine(args): def dsa_scan_accel_module(args):
rpc.dsa.dsa_scan_accel_engine(args.client, config_kernel_mode=args.config_kernel_mode) rpc.dsa.dsa_scan_accel_module(args.client, config_kernel_mode=args.config_kernel_mode)
p = subparsers.add_parser('dsa_scan_accel_engine', p = subparsers.add_parser('dsa_scan_accel_module',
help='Set config and enable dsa accel engine offload.') help='Set config and enable dsa accel module offload.')
p.add_argument('-k', '--config-kernel-mode', help='Use Kernel mode dsa', p.add_argument('-k', '--config-kernel-mode', help='Use Kernel mode dsa',
action='store_true', dest='config_kernel_mode') action='store_true', dest='config_kernel_mode')
p.set_defaults(func=dsa_scan_accel_engine, config_kernel_mode=None) p.set_defaults(func=dsa_scan_accel_module, config_kernel_mode=None)
# iaa # iaa
def iaa_scan_accel_engine(args): def iaa_scan_accel_module(args):
rpc.iaa.iaa_scan_accel_engine(args.client) rpc.iaa.iaa_scan_accel_module(args.client)
p = subparsers.add_parser('iaa_scan_accel_engine', p = subparsers.add_parser('iaa_scan_accel_module',
help='Set config and enable iaa accel engine offload.') help='Set config and enable iaa accel module offload.')
p.set_defaults(func=iaa_scan_accel_engine) p.set_defaults(func=iaa_scan_accel_module)
# opal # opal
def bdev_nvme_opal_init(args): def bdev_nvme_opal_init(args):

View File

@ -23,7 +23,7 @@ def sort_json_object(o):
def filter_methods(do_remove_global_rpcs): def filter_methods(do_remove_global_rpcs):
global_rpcs = [ global_rpcs = [
'dsa_scan_accel_engine', 'dsa_scan_accel_module',
'iscsi_set_options', 'iscsi_set_options',
'nvmf_set_config', 'nvmf_set_config',
'nvmf_set_max_subsystems', 'nvmf_set_max_subsystems',

View File

@ -6,7 +6,7 @@
#include "spdk_cunit.h" #include "spdk_cunit.h"
#include "spdk_internal/mock.h" #include "spdk_internal/mock.h"
#include "spdk_internal/accel_engine.h" #include "spdk_internal/accel_module.h"
#include "thread/thread_internal.h" #include "thread/thread_internal.h"
#include "common/lib/test_env.c" #include "common/lib/test_env.c"
#include "accel/accel.c" #include "accel/accel.c"
@ -21,11 +21,11 @@ DEFINE_STUB(pmem_memset_persist, void *, (void *pmemdest, int c, size_t len), NU
#endif #endif
/* global vars and setup/cleanup functions used for all test functions */ /* global vars and setup/cleanup functions used for all test functions */
struct spdk_accel_module_if g_accel_module = {}; struct spdk_accel_module_if g_module = {};
struct spdk_io_channel *g_ch = NULL; struct spdk_io_channel *g_ch = NULL;
struct accel_io_channel *g_accel_ch = NULL; struct accel_io_channel *g_accel_ch = NULL;
struct sw_accel_io_channel *g_sw_ch = NULL; struct sw_accel_io_channel *g_sw_ch = NULL;
struct spdk_io_channel *g_engine_ch = NULL; struct spdk_io_channel *g_module_ch = NULL;
static uint64_t g_opc_mask = 0; static uint64_t g_opc_mask = 0;
@ -56,22 +56,22 @@ test_setup(void)
return -1; return -1;
} }
g_accel_ch = (struct accel_io_channel *)((char *)g_ch + sizeof(struct spdk_io_channel)); g_accel_ch = (struct accel_io_channel *)((char *)g_ch + sizeof(struct spdk_io_channel));
g_engine_ch = calloc(1, sizeof(struct spdk_io_channel) + sizeof(struct sw_accel_io_channel)); g_module_ch = calloc(1, sizeof(struct spdk_io_channel) + sizeof(struct sw_accel_io_channel));
if (g_engine_ch == NULL) { if (g_module_ch == NULL) {
CU_ASSERT(false); CU_ASSERT(false);
return -1; return -1;
} }
g_accel_module.submit_tasks = sw_accel_submit_tasks; g_module.submit_tasks = sw_accel_submit_tasks;
g_accel_module.name = "software"; g_module.name = "software";
for (i = 0; i < ACCEL_OPC_LAST; i++) { for (i = 0; i < ACCEL_OPC_LAST; i++) {
g_accel_ch->engine_ch[i] = g_engine_ch; g_accel_ch->module_ch[i] = g_module_ch;
g_engines_opc[i] = &g_accel_module; g_modules_opc[i] = &g_module;
} }
g_sw_ch = (struct sw_accel_io_channel *)((char *)g_engine_ch + sizeof( g_sw_ch = (struct sw_accel_io_channel *)((char *)g_module_ch + sizeof(
struct spdk_io_channel)); struct spdk_io_channel));
TAILQ_INIT(&g_sw_ch->tasks_to_complete); TAILQ_INIT(&g_sw_ch->tasks_to_complete);
g_accel_module.supports_opcode = _supports_opcode; g_module.supports_opcode = _supports_opcode;
return 0; return 0;
} }
@ -79,7 +79,7 @@ static int
test_cleanup(void) test_cleanup(void)
{ {
free(g_ch); free(g_ch);
free(g_engine_ch); free(g_module_ch);
return 0; return 0;
} }
@ -228,7 +228,7 @@ test_spdk_accel_submit_dualcast(void)
SPDK_CU_ASSERT_FATAL(dst1 != NULL); SPDK_CU_ASSERT_FATAL(dst1 != NULL);
dst2 = spdk_dma_zmalloc(nbytes, align, NULL); dst2 = spdk_dma_zmalloc(nbytes, align, NULL);
SPDK_CU_ASSERT_FATAL(dst2 != NULL); SPDK_CU_ASSERT_FATAL(dst2 != NULL);
/* SW engine does the dualcast. */ /* SW module does the dualcast. */
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, flags, NULL, cb_arg); rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, flags, NULL, cb_arg);
CU_ASSERT(rc == 0); CU_ASSERT(rc == 0);
CU_ASSERT(task.dst == dst1); CU_ASSERT(task.dst == dst1);

View File

@ -39,8 +39,8 @@ DEFINE_STUB_V(spdk_nvme_ctrlr_set_remove_cb, (struct spdk_nvme_ctrlr *ctrlr,
DEFINE_STUB(spdk_nvme_ctrlr_get_flags, uint64_t, (struct spdk_nvme_ctrlr *ctrlr), 0); DEFINE_STUB(spdk_nvme_ctrlr_get_flags, uint64_t, (struct spdk_nvme_ctrlr *ctrlr), 0);
DEFINE_STUB(accel_engine_create_cb, int, (void *io_device, void *ctx_buf), 0); DEFINE_STUB(accel_channel_create, int, (void *io_device, void *ctx_buf), 0);
DEFINE_STUB_V(accel_engine_destroy_cb, (void *io_device, void *ctx_buf)); DEFINE_STUB_V(accel_channel_destroy, (void *io_device, void *ctx_buf));
DEFINE_RETURN_MOCK(spdk_nvme_ctrlr_get_memory_domain, int); DEFINE_RETURN_MOCK(spdk_nvme_ctrlr_get_memory_domain, int);
@ -2993,7 +2993,7 @@ test_init_ana_log_page(void)
static void static void
init_accel(void) init_accel(void)
{ {
spdk_io_device_register(g_accel_p, accel_engine_create_cb, accel_engine_destroy_cb, spdk_io_device_register(g_accel_p, accel_channel_create, accel_channel_destroy,
sizeof(int), "accel_p"); sizeof(int), "accel_p");
} }

View File

@ -210,8 +210,8 @@ DEFINE_STUB(nvmf_transport_req_free,
(struct spdk_nvmf_request *req), (struct spdk_nvmf_request *req),
0); 0);
DEFINE_STUB(accel_engine_create_cb, int, (void *io_device, void *ctx_buf), 0); DEFINE_STUB(accel_channel_create, int, (void *io_device, void *ctx_buf), 0);
DEFINE_STUB_V(accel_engine_destroy_cb, (void *io_device, void *ctx_buf)); DEFINE_STUB_V(accel_channel_destroy, (void *io_device, void *ctx_buf));
DEFINE_STUB(spdk_bdev_reset, int, (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, DEFINE_STUB(spdk_bdev_reset, int, (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
spdk_bdev_io_completion_cb cb, void *cb_arg), 0); spdk_bdev_io_completion_cb cb, void *cb_arg), 0);
DEFINE_STUB_V(spdk_bdev_free_io, (struct spdk_bdev_io *bdev_io)); DEFINE_STUB_V(spdk_bdev_free_io, (struct spdk_bdev_io *bdev_io));
@ -448,7 +448,7 @@ test_nvmf_tcp_destroy(void)
static void static void
init_accel(void) init_accel(void)
{ {
spdk_io_device_register(g_accel_p, accel_engine_create_cb, accel_engine_destroy_cb, spdk_io_device_register(g_accel_p, accel_channel_create, accel_channel_destroy,
sizeof(int), "accel_p"); sizeof(int), "accel_p");
} }