From e757878190f9c5b8faa34d9df17047cbbd56f41a Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Wed, 20 May 2020 07:23:12 -0400 Subject: [PATCH] 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 Change-Id: Ib0758db5406896f2a204920417619a3ab6fbde98 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2550 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Jim Harris Reviewed-by: Reviewed-by: Aleksey Marchuk Reviewed-by: Shuhei Matsumoto --- lib/accel/accel_engine.c | 2 ++ mk/spdk.lib_deps.mk | 2 +- module/accel/idxd/accel_engine_idxd.c | 4 ---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/accel/accel_engine.c b/lib/accel/accel_engine.c index a21112a84..49e323c54 100644 --- a/lib/accel/accel_engine.c +++ b/lib/accel/accel_engine.c @@ -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 diff --git a/mk/spdk.lib_deps.mk b/mk/spdk.lib_deps.mk index 6ad9af526..1b5f75040 100644 --- a/mk/spdk.lib_deps.mk +++ b/mk/spdk.lib_deps.mk @@ -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 diff --git a/module/accel/idxd/accel_engine_idxd.c b/module/accel/idxd/accel_engine_idxd.c index d2770b59c..c7345cf79 100644 --- a/module/accel/idxd/accel_engine_idxd.c +++ b/module/accel/idxd/accel_engine_idxd.c @@ -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,