net: Remove the net_framework subsystem

This was not used by anything. It was intended for use by user-space
TCP stacks.

Change-Id: I416589e421784882c693bcc5b03fe1dbcc4b1bd3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4297
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ben Walker 2020-09-17 15:05:16 -07:00 committed by Tomasz Zawadzki
parent 47c45d243a
commit 336157bb8f
5 changed files with 2 additions and 196 deletions

View File

@ -48,28 +48,6 @@ extern "C" {
struct spdk_sock;
struct spdk_net_framework {
const char *name;
void (*init)(void);
void (*fini)(void);
STAILQ_ENTRY(spdk_net_framework) link;
};
/**
* Register a net framework.
*
* \param frame Net framework to register.
*/
void spdk_net_framework_register(struct spdk_net_framework *frame);
#define SPDK_NET_FRAMEWORK_REGISTER(name, frame) \
static void __attribute__((constructor)) net_framework_register_##name(void) \
{ \
spdk_net_framework_register(frame); \
}
/**
* Initialize the network interfaces by getting information through netlink socket.
*
@ -82,37 +60,6 @@ int spdk_interface_init(void);
*/
void spdk_interface_destroy(void);
/**
* Net framework initialization callback.
*
* \param cb_arg Callback argument.
* \param rc 0 if net framework initialized successfully or negative errno if it failed.
*/
typedef void (*spdk_net_init_cb)(void *cb_arg, int rc);
/**
* Net framework finish callback.
*
* \param cb_arg Callback argument.
*/
typedef void (*spdk_net_fini_cb)(void *cb_arg);
void spdk_net_framework_init_next(int rc);
/**
* Start all registered frameworks.
*
* \return 0 on success.
*/
void spdk_net_framework_start(spdk_net_init_cb cb_fn, void *cb_arg);
void spdk_net_framework_fini_next(void);
/**
* Stop all registered frameworks.
*/
void spdk_net_framework_fini(spdk_net_fini_cb cb_fn, void *cb_arg);
#ifdef __cplusplus
}
#endif

View File

@ -37,7 +37,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 5
SO_MINOR := 0
C_SRCS = sock.c net_framework.c sock_rpc.c
C_SRCS = sock.c sock_rpc.c
LIBNAME = sock

View File

@ -1,107 +0,0 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/log.h"
#include "spdk/net.h"
#include "spdk/queue.h"
static STAILQ_HEAD(, spdk_net_framework) g_net_frameworks =
STAILQ_HEAD_INITIALIZER(g_net_frameworks);
static spdk_net_init_cb g_init_cb_fn = NULL;
static void *g_init_cb_arg = NULL;
static spdk_net_fini_cb g_fini_cb_fn = NULL;
static void *g_fini_cb_arg = NULL;
struct spdk_net_framework *g_next_net_framework = NULL;
static inline struct spdk_net_framework *
get_next_net_framework(struct spdk_net_framework *net)
{
return net ? STAILQ_NEXT(net, link) : STAILQ_FIRST(&g_net_frameworks);
}
void
spdk_net_framework_init_next(int rc)
{
if (rc) {
SPDK_ERRLOG("Net framework %s failed to initalize with error %d\n", g_next_net_framework->name, rc);
g_init_cb_fn(g_init_cb_arg, rc);
return;
}
g_next_net_framework = get_next_net_framework(g_next_net_framework);
if (g_next_net_framework == NULL) {
g_init_cb_fn(g_init_cb_arg, 0);
return;
}
g_next_net_framework->init();
}
void
spdk_net_framework_start(spdk_net_init_cb cb_fn, void *cb_arg)
{
g_init_cb_fn = cb_fn;
g_init_cb_arg = cb_arg;
spdk_net_framework_init_next(0);
}
void
spdk_net_framework_fini_next(void)
{
g_next_net_framework = get_next_net_framework(g_next_net_framework);
if (g_next_net_framework == NULL) {
g_fini_cb_fn(g_fini_cb_arg);
return;
}
g_next_net_framework->fini();
}
void
spdk_net_framework_fini(spdk_net_fini_cb cb_fn, void *cb_arg)
{
g_fini_cb_fn = cb_fn;
g_fini_cb_arg = cb_arg;
spdk_net_framework_fini_next();
}
void
spdk_net_framework_register(struct spdk_net_framework *frame)
{
STAILQ_INSERT_TAIL(&g_net_frameworks, frame, link);
}

View File

@ -162,7 +162,7 @@ DEPDIRS-app_rpc := log util thread event $(JSON_LIBS)
# are not related to symbols, but are defined directly in
# the SPDK event subsystem code.
DEPDIRS-event_accel := accel event
DEPDIRS-event_net := sock net event
DEPDIRS-event_net := net event
DEPDIRS-event_vmd := vmd conf $(JSON_LIBS) event log thread
DEPDIRS-event_bdev := bdev event event_accel event_vmd event_sock

View File

@ -62,37 +62,3 @@ static struct spdk_subsystem g_spdk_subsystem_interface = {
};
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_interface);
static void
net_start_complete(void *cb_arg, int rc)
{
spdk_subsystem_init_next(rc);
}
static void
net_subsystem_start(void)
{
spdk_net_framework_start(net_start_complete, NULL);
}
static void
net_fini_done(void *cb_arg)
{
spdk_subsystem_fini_next();
}
static void
net_subsystem_fini(void)
{
spdk_net_framework_fini(net_fini_done, NULL);
}
static struct spdk_subsystem g_spdk_subsystem_net_framework = {
.name = "net_framework",
.init = net_subsystem_start,
.fini = net_subsystem_fini,
.config = NULL,
};
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_net_framework);
SPDK_SUBSYSTEM_DEPEND(net_framework, interface)