Commit fba209c7 authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

rpc: initialize state to startup



Set lib/rpc g_rpc_state to SPDK_RPC_STARTUP
upon declaration. This renders spdk_rpc_set_state()
in spdk_rpc_initialize() unnecessary and reduces
number of operations it performs.

This change also opens our code to possibility
of calling spdk_rpc_initialize multiple times
in the future without resetting RPC state to
startup each time (spdk_rpc_initialize will be
called multiple times in the following patches).

This is the start of a series of changes that
implement SPDK application initialization with
both JSON config file and subsystem initialiation
delay (--wait-for-rpc).
To achieve this goal the series focuses on a number
of key changes:
 a) introducing new APIs to manage server objects
   instead of working on a single global instance,
 b) deprecating current lib/rpc and lib/init server
   related functions,
 c) moving server instances from lib/rpc to a list
   in lib/init.

Change-Id: I766f0149b9c12940faef3562f2795f5f1e1381db
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21079


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent b0b407ae
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -93,8 +93,6 @@ spdk_rpc_initialize(const char *listen_addr, const struct spdk_rpc_opts *_opts)
		return 0;
	}

	spdk_rpc_set_state(SPDK_RPC_STARTUP);

	rpc_opts_get_default(&opts, sizeof(opts));
	if (_opts != NULL) {
		rpc_opts_copy(&opts, _opts, _opts->size);
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ static char g_rpc_lock_path[sizeof(g_rpc_listen_addr_unix.sun_path) + sizeof(".l
static int g_rpc_lock_fd = -1;

static struct spdk_jsonrpc_server *g_jsonrpc_server = NULL;
static uint32_t g_rpc_state;
static uint32_t g_rpc_state = SPDK_RPC_STARTUP;
static bool g_rpcs_correct = true;
static char **g_rpcs_allowlist = NULL;

+2 −1
Original line number Diff line number Diff line
@@ -196,7 +196,8 @@ rpc_test_method_null_params(struct spdk_jsonrpc_request *request,

	spdk_jsonrpc_send_bool_response(request, true);
}
SPDK_RPC_REGISTER("test_null_params", rpc_test_method_null_params, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER("test_null_params", rpc_test_method_null_params,
		  SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)

static bool g_conn_close_detected;