nvmf: move conf file parsing to nvmf_tgt app
Change-Id: Iaf09d39046bceae023739d49e31804e150bb19d4 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
0b3bd6a9c5
commit
0c00baf9bc
@ -43,7 +43,7 @@ CFLAGS += $(DPDK_INC)
|
|||||||
# TODO: remove this once NVMf has a public API header
|
# TODO: remove this once NVMf has a public API header
|
||||||
CFLAGS += -I$(SPDK_ROOT_DIR)/lib
|
CFLAGS += -I$(SPDK_ROOT_DIR)/lib
|
||||||
|
|
||||||
C_SRCS := nvmf_tgt.c
|
C_SRCS := conf.c nvmf_tgt.c
|
||||||
|
|
||||||
SPDK_LIBS = \
|
SPDK_LIBS = \
|
||||||
$(SPDK_ROOT_DIR)/lib/nvmf/libspdk_nvmf.a \
|
$(SPDK_ROOT_DIR)/lib/nvmf/libspdk_nvmf.a \
|
||||||
|
@ -40,9 +40,8 @@
|
|||||||
#include <rte_lcore.h>
|
#include <rte_lcore.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "nvmf_internal.h"
|
#include "nvmf/subsystem.h"
|
||||||
#include "subsystem.h"
|
#include "nvmf/transport.h"
|
||||||
#include "transport.h"
|
|
||||||
#include "spdk/conf.h"
|
#include "spdk/conf.h"
|
||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
|
|
@ -42,6 +42,8 @@
|
|||||||
#include <rte_memzone.h>
|
#include <rte_memzone.h>
|
||||||
#include <rte_mempool.h>
|
#include <rte_mempool.h>
|
||||||
|
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
#include "spdk/event.h"
|
#include "spdk/event.h"
|
||||||
|
|
||||||
#include "nvmf/transport.h"
|
#include "nvmf/transport.h"
|
||||||
@ -95,6 +97,18 @@ spdk_nvmf_startup(spdk_event_t event)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
rc = spdk_nvmf_parse_conf();
|
||||||
|
if (rc < 0) {
|
||||||
|
SPDK_ERRLOG("spdk_nvmf_parse_conf() failed\n");
|
||||||
|
goto initialize_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = spdk_nvmf_transport_init();
|
||||||
|
if (rc <= 0) {
|
||||||
|
SPDK_ERRLOG("Transport initialization failed\n");
|
||||||
|
goto initialize_error;
|
||||||
|
}
|
||||||
|
|
||||||
/* start the rdma poller that will listen
|
/* start the rdma poller that will listen
|
||||||
on all available ports */
|
on all available ports */
|
||||||
rc = spdk_nvmf_acceptor_start();
|
rc = spdk_nvmf_acceptor_start();
|
||||||
|
@ -36,7 +36,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
|||||||
|
|
||||||
CFLAGS += $(DPDK_INC)
|
CFLAGS += $(DPDK_INC)
|
||||||
LIBNAME = nvmf
|
LIBNAME = nvmf
|
||||||
C_SRCS = subsystem.c conf.c nvmf.c \
|
C_SRCS = subsystem.c nvmf.c \
|
||||||
request.c session.c transport.c \
|
request.c session.c transport.c \
|
||||||
direct.c
|
direct.c
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
#include "spdk/conf.h"
|
#include "spdk/conf.h"
|
||||||
#include "conf.h"
|
|
||||||
#include "subsystem.h"
|
#include "subsystem.h"
|
||||||
#include "transport.h"
|
#include "transport.h"
|
||||||
#include "spdk/trace.h"
|
#include "spdk/trace.h"
|
||||||
@ -151,24 +150,6 @@ nvmf_tgt_init(uint16_t max_queue_depth, uint16_t max_queues_per_sess,
|
|||||||
static int
|
static int
|
||||||
nvmf_tgt_subsystem_initialize(void)
|
nvmf_tgt_subsystem_initialize(void)
|
||||||
{
|
{
|
||||||
int rc;
|
|
||||||
|
|
||||||
/* initialize from configuration file */
|
|
||||||
rc = spdk_nvmf_parse_conf();
|
|
||||||
if (rc < 0) {
|
|
||||||
SPDK_ERRLOG("spdk_nvmf_parse_conf() failed\n");
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize with the NVMf transport */
|
|
||||||
rc = spdk_nvmf_transport_init(g_nvmf_tgt.max_queue_depth,
|
|
||||||
g_nvmf_tgt.max_io_size,
|
|
||||||
g_nvmf_tgt.in_capsule_data_size);
|
|
||||||
if (rc <= 0) {
|
|
||||||
SPDK_ERRLOG("Transport initialization failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
#include "spdk/queue.h"
|
#include "spdk/queue.h"
|
||||||
|
|
||||||
|
#include "nvmf_internal.h"
|
||||||
|
|
||||||
static const struct spdk_nvmf_transport *const g_transports[] = {
|
static const struct spdk_nvmf_transport *const g_transports[] = {
|
||||||
#ifdef SPDK_CONFIG_RDMA
|
#ifdef SPDK_CONFIG_RDMA
|
||||||
&spdk_nvmf_transport_rdma,
|
&spdk_nvmf_transport_rdma,
|
||||||
@ -48,15 +50,14 @@ static const struct spdk_nvmf_transport *const g_transports[] = {
|
|||||||
#define NUM_TRANSPORTS (sizeof(g_transports) / sizeof(*g_transports))
|
#define NUM_TRANSPORTS (sizeof(g_transports) / sizeof(*g_transports))
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvmf_transport_init(uint16_t max_queue_depth, uint32_t max_io_size,
|
spdk_nvmf_transport_init(void)
|
||||||
uint32_t in_capsule_data_size)
|
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (i = 0; i != NUM_TRANSPORTS; i++) {
|
for (i = 0; i != NUM_TRANSPORTS; i++) {
|
||||||
if (g_transports[i]->transport_init(max_queue_depth, max_io_size,
|
if (g_transports[i]->transport_init(g_nvmf_tgt.max_queue_depth, g_nvmf_tgt.max_io_size,
|
||||||
in_capsule_data_size) < 0) {
|
g_nvmf_tgt.in_capsule_data_size) < 0) {
|
||||||
SPDK_NOTICELOG("%s transport init failed\n", g_transports[i]->name);
|
SPDK_NOTICELOG("%s transport init failed\n", g_transports[i]->name);
|
||||||
} else {
|
} else {
|
||||||
count++;
|
count++;
|
||||||
|
@ -111,8 +111,7 @@ struct spdk_nvmf_transport {
|
|||||||
struct spdk_nvmf_discovery_log_page_entry *entry);
|
struct spdk_nvmf_discovery_log_page_entry *entry);
|
||||||
};
|
};
|
||||||
|
|
||||||
int spdk_nvmf_transport_init(uint16_t max_queue_depth, uint32_t max_io_size,
|
int spdk_nvmf_transport_init(void);
|
||||||
uint32_t in_capsule_data_size);
|
|
||||||
int spdk_nvmf_transport_fini(void);
|
int spdk_nvmf_transport_fini(void);
|
||||||
const struct spdk_nvmf_transport *spdk_nvmf_transport_get(const char *name);
|
const struct spdk_nvmf_transport *spdk_nvmf_transport_get(const char *name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user