net: Move module initialization into event_net

This removes the event framework dependency from the net
library entirely.

Change-Id: I7bc1a6f146437fd3d2dab0289bbd845f0ff61ae8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365726
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-06-14 16:08:01 -07:00
parent 199e4862d2
commit e7485922b0
5 changed files with 44 additions and 15 deletions

View File

@ -44,11 +44,11 @@
#define IDLE_INTERVAL_TIME_IN_US 5000
void spdk_interface_init(void);
int spdk_interface_init(void);
int spdk_interface_destroy(void);
const char *spdk_net_framework_get_name(void);
void spdk_net_framework_start(void);
int spdk_net_framework_start(void);
void spdk_net_framework_clear_socket_association(int sock);
int spdk_net_framework_fini(void);
int spdk_net_framework_idle_time(void);

View File

@ -37,7 +37,41 @@
#include "spdk_internal/event.h"
SPDK_SUBSYSTEM_REGISTER(interface, spdk_interface_init, spdk_interface_destroy, NULL)
static void
spdk_interface_subsystem_init(void)
{
int rc;
SPDK_SUBSYSTEM_REGISTER(net_framework, spdk_net_framework_start, spdk_net_framework_fini, NULL)
rc = spdk_interface_init();
spdk_subsystem_init_next(rc);
}
static int
spdk_interface_subsystem_destroy(void)
{
return spdk_interface_destroy();
}
SPDK_SUBSYSTEM_REGISTER(interface, spdk_interface_subsystem_init,
spdk_interface_subsystem_destroy, NULL)
static void
spdk_net_subsystem_start(void)
{
int rc;
rc = spdk_net_framework_start();
spdk_subsystem_init_next(rc);
}
static int
spdk_net_subsystem_fini(void)
{
return spdk_net_framework_fini();
}
SPDK_SUBSYSTEM_REGISTER(net_framework, spdk_net_subsystem_start,
spdk_net_subsystem_fini, NULL)
SPDK_SUBSYSTEM_DEPEND(net_framework, interface)

View File

@ -36,8 +36,6 @@
#include "spdk/log.h"
#include "spdk/net.h"
#include "spdk_internal/event.h"
#ifdef __linux__ /* Interface management is Linux-specific */
#include <linux/netlink.h>
@ -414,14 +412,14 @@ static void spdk_interface_ip_update(void)
pthread_mutex_unlock(&interface_lock);
}
void
int
spdk_interface_init(void)
{
TAILQ_INIT(&g_interface_head);
spdk_prepare_ifc_list();
spdk_get_ifc_ipv4();
spdk_subsystem_init_next(0);
return 0;
}
int
@ -463,10 +461,10 @@ void *spdk_interface_get_list(void)
#else /* Not Linux */
void
int
spdk_interface_init(void)
{
spdk_subsystem_init_next(0);
return 0;
}
int

View File

@ -33,8 +33,6 @@
#include "spdk/net.h"
#include "spdk_internal/event.h"
__attribute__((weak))
const char *spdk_net_framework_get_name(void)
{
@ -42,9 +40,9 @@ const char *spdk_net_framework_get_name(void)
}
__attribute__((weak))
void spdk_net_framework_start(void)
int spdk_net_framework_start(void)
{
spdk_subsystem_init_next(0);
return 0;
}
__attribute__((weak))

View File

@ -33,7 +33,6 @@
#include "spdk/stdinc.h"
#include "spdk/event.h"
#include "spdk/log.h"
#include "spdk/net.h"