Commit 9e1b82ac authored by paul luse's avatar paul luse Committed by Tomasz Zawadzki
Browse files

subsystem/accel: add entry point for .write_config_json



Write config json for setting the selected accel module.

Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: Ife11d4d4a776254b56fa6d24dc817481beb78c3c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/664


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent e753402a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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
+14 −0
Original line number Diff line number Diff line
@@ -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)
{
+7 −0
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
  "subsystems": [
    {
      "subsystem": "accel",
      "config": null
      "config": []
    },
    {
      "subsystem": "interface",
+1 −0
Original line number Diff line number Diff line
@@ -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',