subsystem/accel: add entry point for .write_config_json

Write config json for setting the selected accel module.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ife11d4d4a776254b56fa6d24dc817481beb78c3c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/664
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
paul luse 2020-02-08 18:23:09 +00:00 committed by Tomasz Zawadzki
parent e753402aa1
commit 9e1b82ac9c
5 changed files with 32 additions and 1 deletions

View File

@ -140,6 +140,15 @@ int spdk_accel_submit_fill(struct spdk_accel_task *accel_req, struct spdk_io_cha
*/
size_t spdk_accel_task_size(void);
struct spdk_json_write_ctx;
/**
* Write Acceleration subsystem configuration into provided JSON context.
*
* \param w JSON write context
*/
void spdk_accel_write_config_json(struct spdk_json_write_ctx *w);
#ifdef __cplusplus
}
#endif

View File

@ -39,6 +39,7 @@
#include "spdk/event.h"
#include "spdk/log.h"
#include "spdk/thread.h"
#include "spdk/json.h"
/* Accelerator Engine Framework: The following provides a top level
* generic API for the accelerator functions defined here. Modules,
@ -230,6 +231,19 @@ spdk_accel_engine_module_finish_cb(void)
g_fini_cb_arg = NULL;
}
void
spdk_accel_write_config_json(struct spdk_json_write_ctx *w)
{
spdk_json_write_array_begin(w);
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "accel_set_module");
spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_uint32(w, "module", g_active_accel_module);
spdk_json_write_object_end(w);
spdk_json_write_object_end(w);
spdk_json_write_array_end(w);
}
void
spdk_accel_engine_module_finish(void)
{

View File

@ -60,11 +60,18 @@ spdk_accel_engine_subsystem_finish(void)
spdk_accel_engine_finish(spdk_accel_engine_subsystem_finish_done, NULL);
}
static void
spdk_accel_engine_subsystem_write_config_json(struct spdk_json_write_ctx *w)
{
spdk_accel_write_config_json(w);
}
static struct spdk_subsystem g_spdk_subsystem_accel = {
.name = "accel",
.init = spdk_accel_engine_subsystem_initialize,
.fini = spdk_accel_engine_subsystem_finish,
.config = spdk_accel_engine_config_text,
.write_config_json = spdk_accel_engine_subsystem_write_config_json,
};
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_accel);

View File

@ -2,7 +2,7 @@
"subsystems": [
{
"subsystem": "accel",
"config": null
"config": []
},
{
"subsystem": "interface",

View File

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