event: Move RPC server initialization to init
I'm not sure whether this should go into lib/init or to lib/rpc directly, but I've chosen lib/init for now. This is to support applications that want to run the SPDK JSON RPC server, but aren't using the SPDK application framework. Signed-off-by: Ben Walker <benjamin.walker@intel.com> Change-Id: I79ca39aa0ca6e1a3a6905b0bf73e6cc99b086e55 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6644 Reviewed-by: Tom Nabarro <tom.nabarro@outlook.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
dc9374dd2f
commit
9f62796127
@ -44,6 +44,7 @@
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/cpuset.h"
|
||||
#include "spdk/init.h"
|
||||
#include "spdk/queue.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/thread.h"
|
||||
@ -82,8 +83,6 @@ typedef void (*spdk_app_shutdown_cb)(void);
|
||||
*/
|
||||
typedef void (*spdk_sighandler_t)(int signal);
|
||||
|
||||
#define SPDK_DEFAULT_RPC_ADDR "/var/tmp/spdk.sock"
|
||||
|
||||
/**
|
||||
* \brief Event framework initialization options
|
||||
*/
|
||||
|
@ -45,6 +45,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SPDK_DEFAULT_RPC_ADDR "/var/tmp/spdk.sock"
|
||||
|
||||
/**
|
||||
* Create the SPDK JSON-RPC server and listen at the provided address. The RPC server is optional and is
|
||||
* independent of subsystem initialization. The RPC server can be started and stopped at any time.
|
||||
*
|
||||
* \param listen_addr Path to a unix domain socket to listen on
|
||||
*
|
||||
* \return Negated errno on failure. 0 on success.
|
||||
*/
|
||||
int spdk_rpc_initialize(const char *listen_addr);
|
||||
|
||||
/**
|
||||
* Shut down the SPDK JSON-RPC target
|
||||
*/
|
||||
void spdk_rpc_finish(void);
|
||||
|
||||
typedef void (*spdk_subsystem_init_fn)(int rc, void *ctx);
|
||||
|
||||
/**
|
||||
|
@ -170,9 +170,6 @@ void spdk_app_json_config_load(const char *json_config_file, const char *rpc_add
|
||||
spdk_app_init_fn cb_fn, void *cb_arg,
|
||||
bool stop_on_error);
|
||||
|
||||
int spdk_rpc_initialize(const char *listen_addr);
|
||||
void spdk_rpc_finish(void);
|
||||
|
||||
struct spdk_governor_capabilities {
|
||||
bool freq_change;
|
||||
bool freq_getset;
|
||||
|
@ -40,7 +40,7 @@ SO_MINOR := 0
|
||||
CFLAGS += $(ENV_CFLAGS)
|
||||
|
||||
LIBNAME = event
|
||||
C_SRCS = app.c reactor.c rpc.c json_config.c log_rpc.c \
|
||||
C_SRCS = app.c reactor.c json_config.c log_rpc.c \
|
||||
app_rpc.c scheduler_static.c
|
||||
|
||||
# Do not compile schedulers and governors based on DPDK env
|
||||
|
@ -26,8 +26,6 @@
|
||||
spdk_for_each_reactor;
|
||||
spdk_reactor_set_interrupt_mode;
|
||||
spdk_app_json_config_load;
|
||||
spdk_rpc_initialize;
|
||||
spdk_rpc_finish;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
@ -37,7 +37,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
SO_VER := 1
|
||||
SO_MINOR := 0
|
||||
|
||||
C_SRCS = subsystem.c subsystem_rpc.c
|
||||
C_SRCS = subsystem.c subsystem_rpc.c rpc.c
|
||||
LIBNAME = init
|
||||
|
||||
SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_init.map)
|
||||
|
@ -34,12 +34,11 @@
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/init.h"
|
||||
#include "spdk/thread.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/event.h"
|
||||
|
||||
#define RPC_SELECT_INTERVAL 4000 /* 4ms */
|
||||
|
||||
static struct spdk_poller *g_rpc_poller = NULL;
|
@ -9,5 +9,8 @@
|
||||
spdk_subsystem_init_next;
|
||||
spdk_subsystem_fini_next;
|
||||
|
||||
spdk_rpc_initialize;
|
||||
spdk_rpc_finish;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user