summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-02-24 11:29:06 -0500
committerDave Barach <dave@barachs.net>2016-02-24 11:30:44 -0500
commit1f49ed666af8b9cb889f9ea61f084341d0b6c4f4 (patch)
tree0e951e3cc6a21f7320084a6b5f0e213f1852b634 /vnet
parent9f50b0b5b12c0e1b01f36cf84070549911197584 (diff)
Link the vpp application against libvnet.so, not libvnet.a
Turn of srp, mainly as an example of how to restructure a featurette for selective disablement. Change-Id: Id3364c58a8711b103939f4434adfa67177380f67 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/Makefile.am14
-rw-r--r--vnet/vnet/ethernet/arp.c4
-rw-r--r--vnet/vnet/ethernet/ethernet.h3
-rw-r--r--vnet/vnet/ethernet/init.c7
-rw-r--r--vnet/vnet/ethernet/node.c16
-rw-r--r--vnet/vnet/srp/node.c9
-rw-r--r--vnet/vnet/srp/srp.h1
7 files changed, 39 insertions, 15 deletions
diff --git a/vnet/Makefile.am b/vnet/Makefile.am
index f44bb12492c..fc5a3ec9b70 100644
--- a/vnet/Makefile.am
+++ b/vnet/Makefile.am
@@ -16,7 +16,6 @@ AUTOMAKE_OPTIONS = foreign subdir-objects
AM_CFLAGS = -Wall @DPDK@ @VIRL@ @IPSEC@ @VCGN@ @IPV6SR@
libvnet_la_SOURCES =
-libvnetplugin_la_SOURCES =
nobase_include_HEADERS =
noinst_PROGRAMS =
@@ -42,6 +41,7 @@ nobase_include_HEADERS += \
vnet/interface_funcs.h \
vnet/l3_types.h \
vnet/pipeline.h \
+ vnet/plugin/plugin.h \
vnet/replication.h \
vnet/rewrite.h \
vnet/vnet.h
@@ -620,17 +620,7 @@ nobase_include_HEADERS += \
vnet/unix/tuntap.h \
vnet/unix/tapcli.h
-########################################
-# Plugin client library
-########################################
-
-libvnetplugin_la_SOURCES += \
- vnet/plugin/p1.c
-
-nobase_include_HEADERS += \
- vnet/plugin/plugin.h
-
-lib_LTLIBRARIES = libvnet.la libvnetplugin.la
+lib_LTLIBRARIES = libvnet.la
dpdk_libs =
diff --git a/vnet/vnet/ethernet/arp.c b/vnet/vnet/ethernet/arp.c
index 3548831688a..3eb6a11391e 100644
--- a/vnet/vnet/ethernet/arp.c
+++ b/vnet/vnet/ethernet/arp.c
@@ -1246,6 +1246,10 @@ static clib_error_t * ethernet_arp_init (vlib_main_t * vm)
{
ethernet_arp_main_t * am = &ethernet_arp_main;
pg_node_t * pn;
+ clib_error_t * error;
+
+ if ((error = vlib_call_init_function (vm, ethernet_init)))
+ return error;
ethernet_register_input_type (vm, ETHERNET_TYPE_ARP, arp_input_node.index);
diff --git a/vnet/vnet/ethernet/ethernet.h b/vnet/vnet/ethernet/ethernet.h
index 266e1d79afb..04e07b71bf7 100644
--- a/vnet/vnet/ethernet/ethernet.h
+++ b/vnet/vnet/ethernet/ethernet.h
@@ -218,6 +218,9 @@ typedef struct {
/* Set to one to use AB.CD.EF instead of A:B:C:D:E:F as ethernet format. */
int format_ethernet_address_16bit;
+ /* debug: make sure we don't wipe out an ethernet registration by mistake */
+ u8 next_by_ethertype_register_called;
+
} ethernet_main_t;
ethernet_main_t ethernet_main;
diff --git a/vnet/vnet/ethernet/init.c b/vnet/vnet/ethernet/init.c
index 4ac14e208be..42788f02c27 100644
--- a/vnet/vnet/ethernet/init.c
+++ b/vnet/vnet/ethernet/init.c
@@ -66,6 +66,13 @@ static clib_error_t * ethernet_init (vlib_main_t * vm)
ethernet_main_t * em = &ethernet_main;
clib_error_t * error;
+ /*
+ * Set up the L2 path now, or we'll wipe out the L2 ARP
+ * registration set up by ethernet_arp_init.
+ */
+ if ((error = vlib_call_init_function(vm, l2_init)))
+ return error;
+
em->vlib_main = vm;
em->type_info_by_name = hash_create_string (0, sizeof (uword));
diff --git a/vnet/vnet/ethernet/node.c b/vnet/vnet/ethernet/node.c
index 9c943992b68..9aed302f407 100644
--- a/vnet/vnet/ethernet/node.c
+++ b/vnet/vnet/ethernet/node.c
@@ -960,6 +960,16 @@ clib_error_t * next_by_ethertype_init (next_by_ethertype_t * l3_next)
l3_next->sparse_index_by_input_next_index[ETHERNET_INPUT_NEXT_PUNT]
= SPARSE_VEC_INVALID_INDEX;
+ /*
+ * Make sure we don't wipe out an ethernet registration by mistake
+ * Can happen if init function ordering constraints are missing.
+ */
+ if (CLIB_DEBUG > 0)
+ {
+ ethernet_main_t * em = &ethernet_main;
+ ASSERT(em->next_by_ethertype_register_called == 0);
+ }
+
return 0;
}
@@ -972,6 +982,12 @@ clib_error_t * next_by_ethertype_register (next_by_ethertype_t * l3_next,
u16 * n;
ethernet_main_t * em = &ethernet_main;
+ if (CLIB_DEBUG > 0)
+ {
+ ethernet_main_t * em = &ethernet_main;
+ em->next_by_ethertype_register_called = 1;
+ }
+
/* Setup ethernet type -> next index sparse vector mapping. */
n = sparse_vec_validate (l3_next->input_next_by_type, ethertype);
n[0] = next_index;
diff --git a/vnet/vnet/srp/node.c b/vnet/vnet/srp/node.c
index 42143ef6e9d..0b23258249f 100644
--- a/vnet/vnet/srp/node.c
+++ b/vnet/vnet/srp/node.c
@@ -269,7 +269,7 @@ static char * srp_error_strings[] = {
#undef _
};
-VLIB_REGISTER_NODE (srp_input_node,static) = {
+vlib_node_registration_t srp_input_node = {
.function = srp_input,
.name = "srp-input",
/* Takes a vector of packets. */
@@ -444,7 +444,7 @@ srp_control_input (vlib_main_t * vm,
return from_frame->n_vectors;
}
-VLIB_REGISTER_NODE (srp_control_input_node,static) = {
+static vlib_node_registration_t srp_control_input_node = {
.function = srp_control_input,
.name = "srp-control",
/* Takes a vector of packets. */
@@ -908,7 +908,7 @@ srp_ips_process (vlib_main_t * vm,
return 0;
}
-VLIB_REGISTER_NODE (srp_ips_process_node) = {
+vlib_node_registration_t srp_ips_process_node = {
.function = srp_ips_process,
.type = VLIB_NODE_TYPE_PROCESS,
.name = "srp-ips-process",
@@ -921,6 +921,9 @@ static clib_error_t * srp_init (vlib_main_t * vm)
sm->default_data_ttl = 255;
sm->vlib_main = vm;
+ vlib_register_node (vm, &srp_ips_process_node);
+ vlib_register_node (vm, &srp_input_node);
+ vlib_register_node (vm, &srp_control_input_node);
srp_setup_node (vm, srp_input_node.index);
return 0;
diff --git a/vnet/vnet/srp/srp.h b/vnet/vnet/srp/srp.h
index 1b241710409..48c447b7bfd 100644
--- a/vnet/vnet/srp/srp.h
+++ b/vnet/vnet/srp/srp.h
@@ -150,6 +150,7 @@ void srp_interface_set_hw_wrap_function (u32 hw_if_index, srp_hw_wrap_function_t
void srp_interface_set_hw_enable_function (u32 hw_if_index, srp_hw_enable_function_t * f);
vlib_node_registration_t srp_ips_process_node;
+vlib_node_registration_t srp_input_node;
/* Called when an IPS control packet is received on given interface. */
void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * ips_packet);