accel: always write JSON with an array of objects for accel modules

Patch below added writing out json configuration for accel modules.
(fad052b0) accel: add write_config json for accel modules

Out of two current modules, only idxd reported its confi out.
When idxd was not compiled in, then "framework_get_config accel"
RPC did not return a valid JSON. Following JSON was returned:
{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":}

Where "result" never had any property given.

This patch adds array object to encompas all accel modules.

Next patch in series will try to address the issue on JSON
level.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib0758db5406896f2a204920417619a3ab6fbde98
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2550
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2020-05-20 07:23:12 -04:00
parent ae8099ca2b
commit e757878190
3 changed files with 3 additions and 5 deletions

View File

@ -257,11 +257,13 @@ spdk_accel_write_config_json(struct spdk_json_write_ctx *w)
* The accel engine has no config, there may be some in
* the modules though.
*/
spdk_json_write_array_begin(w);
TAILQ_FOREACH(accel_engine_module, &spdk_accel_module_list, tailq) {
if (accel_engine_module->write_config_json) {
accel_engine_module->write_config_json(w);
}
}
spdk_json_write_array_end(w);
}
void

View File

@ -62,7 +62,7 @@ DEPDIRS-nvme += rdma
endif
DEPDIRS-blob := log util thread
DEPDIRS-accel := log util thread
DEPDIRS-accel := log util thread json
DEPDIRS-jsonrpc := log util json
DEPDIRS-virtio := log util json thread

View File

@ -645,8 +645,6 @@ accel_engine_idxd_exit(void *ctx)
static void
accel_engine_idxd_write_config_json(struct spdk_json_write_ctx *w)
{
spdk_json_write_array_begin(w);
if (g_idxd_enable) {
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "idxd_scan_accel_engine");
@ -655,8 +653,6 @@ accel_engine_idxd_write_config_json(struct spdk_json_write_ctx *w)
spdk_json_write_object_end(w);
spdk_json_write_object_end(w);
}
spdk_json_write_array_end(w);
}
SPDK_ACCEL_MODULE_REGISTER(accel_engine_idxd_init, accel_engine_idxd_exit,