_error; \
})
+/* Don't call given init function: used to suppress parts of the netstack */
+#define vlib_mark_init_function_complete(vm, x) \
+ ({ \
+ extern vlib_init_function_t * VLIB_INIT_FUNCTION_SYMBOL (x); \
+ vlib_init_function_t * _f = VLIB_INIT_FUNCTION_SYMBOL (x); \
+ hash_set1 (vm->init_functions_called, _f); \
+ })
+
#define vlib_call_post_graph_init_function(vm, x) \
({ \
extern vlib_init_function_t * VLIB_POST_GRAPH_INIT_FUNCTION_SYMBOL (x); \
return i;
unformat_init_command_line (&input, (char **)vm->argv);
- vm->init_functions_called = hash_create (0, /* value bytes */ 0);
+ if (vm->init_functions_called == 0)
+ vm->init_functions_called = hash_create (0, /* value bytes */ 0);
e = vlib_call_all_config_functions (vm, &input, 1 /* early */);
if (e != 0)
{
AM_CFLAGS = -Wall @DPDK@ @VIRL@ @IPSEC@ @VCGN@ @IPV6SR@
libvnet_la_SOURCES =
-libvnetplugin_la_SOURCES =
nobase_include_HEADERS =
noinst_PROGRAMS =
vnet/interface_funcs.h \
vnet/l3_types.h \
vnet/pipeline.h \
+ vnet/plugin/plugin.h \
vnet/replication.h \
vnet/rewrite.h \
vnet/vnet.h
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 =
{
ethernet_arp_main_t * am = ðernet_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);
/* 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;
ethernet_main_t * em = ðernet_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));
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 = ðernet_main;
+ ASSERT(em->next_by_ethertype_register_called == 0);
+ }
+
return 0;
}
u16 * n;
ethernet_main_t * em = ðernet_main;
+ if (CLIB_DEBUG > 0)
+ {
+ ethernet_main_t * em = ðernet_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;
#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. */
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. */
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",
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;
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);
vpp_LDADD = -lvlibapi -lvlibmemory -lvlib_unix -lvlib
-vpp_LDADD += -l:libvnet.a
+vpp_LDADD += -lvnet
vpp_LDADD += -lsvm -lsvmdb -lrt
-vpp_LDADD += -lvnetplugin
-
if WITH_DPDK
vpp_LDADD += -l:libdpdk.a
endif
*
*/
-static clib_error_t *
+static void
vpe_main_init (vlib_main_t * vm)
{
- clib_error_t * error = 0;
- void vnet_library_plugin_reference(void);
-
if (CLIB_DEBUG > 0)
vlib_unix_cli_set_prompt ("DBGvpp# ");
else
vlib_unix_cli_set_prompt ("vpp# ");
- vnet_library_plugin_reference();
-
- if ((error = vlib_call_init_function (vm, pg_init)))
- return error;
- if ((error = vlib_call_init_function (vm, ip_main_init)))
- return error;
- if ((error = vlib_call_init_function (vm, osi_init)))
- return error;
- if ((error = vlib_call_init_function (vm, l2_init)))
- return error;
- if ((error = vlib_call_init_function (vm, ethernet_init)))
- return error;
- if ((error = vlib_call_init_function (vm, ethernet_arp_init)))
- return error;
- if ((error = vlib_call_init_function (vm, map_init)))
- return error;
- if ((error = vlib_call_init_function (vm, sixrd_init)))
- return error;
- if ((error = vlib_call_init_function (vm, llc_init)))
- return error;
- if ((error = vlib_call_init_function (vm, snap_init)))
- return error;
- if ((error = vlib_call_init_function (vm, cdp_init)))
- return error;
- if ((error = vlib_call_init_function (vm, nsh_gre_init)))
- return error;
- if ((error = vlib_call_init_function (vm, nsh_vxlan_gpe_init)))
- return error;
- if ((error = vlib_call_init_function (vm, lisp_gpe_init)))
- return error;
-
-#if DPDK == 1
- if ((error = vlib_call_init_function (vm, dpdk_init)))
- return error;
- if ((error = vlib_call_init_function (vm, dpdk_thread_init)))
- return error;
- if ((error = vlib_call_init_function (vm, vhost_user_init)))
- return error;
-#if IPSEC > 0
- if ((error = vlib_call_init_function (vm, ipsec_init)))
- return error;
-#endif /* IPSEC */
-#endif
- if ((error = vlib_call_init_function (vm, vlibmemory_init)))
- return error;
- if ((error = vlib_call_init_function (vm, l2tp_init)))
- return error;
- if ((error = vlib_call_init_function (vm, gre_init)))
- return error;
- if ((error = vlib_call_init_function (vm, gre_interface_init)))
- return error;
- if ((error = vlib_call_init_function (vm, mpls_init)))
- return error;
- if ((error = vlib_call_init_function (vm, mpls_interface_init)))
- return error;
- if ((error = vlib_call_init_function (vm, dhcp_proxy_init)))
- return error;
- if ((error = vlib_call_init_function (vm, dhcpv6_proxy_init)))
- return error;
- if ((error = vlib_call_init_function (vm, tapcli_init)))
- return error;
- if ((error = vlib_call_init_function (vm, gdb_func_init)))
- return error;
- if ((error = unix_physmem_init
- (vm, 0 /* fail_if_physical_memory_not_present */)))
- return error;
- if ((error = vlib_call_init_function (vm, tuntap_init)))
- return error;
-#if IPV6SR > 0
- if ((error = vlib_call_init_function (vm, sr_init)))
- return error;
-#endif
- if ((error = vlib_call_init_function (vm, l2_classify_init)))
- return error;
- if ((error = vlib_call_init_function (vm, policer_init)))
- return error;
- if ((error = vlib_call_init_function (vm, vxlan_init)))
- return error;
-#if VCGN > 0
- if ((error = vlib_call_init_function (vm, vcgn_init)))
- return error;
-#endif
- if ((error = vlib_call_init_function (vm, li_init)))
- return error;
- if ((error = vlib_call_init_function (vm, cop_init)))
- return error;
-
- return error;
+ /* Turn off network stack components which we don't want */
+ vlib_mark_init_function_complete (vm, srp_init);
}
-VLIB_INIT_FUNCTION (vpe_main_init);
-
/*
* Load plugins from /usr/lib/vpp_plugins by default
*/
int main (int argc, char * argv[])
{
int i;
+ vlib_main_t * vm = &vlib_global_main;
void vl_msg_api_set_first_available_msg_id (u16);
uword main_heap_size = (1ULL << 30);
u8 * sizep;
/* Allocate main heap */
if (clib_mem_init (0, main_heap_size)) {
+ vm->init_functions_called = hash_create (0, /* value bytes */ 0);
+ vpe_main_init(vm);
vlib_set_get_handoff_structure_cb (&vnet_get_handoff_structure);
return vlib_unix_main (argc, argv);
} else {