From a72e5a1cb6637486794da3fbcdd728d5e37fb5ff Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Fri, 17 Jun 2016 11:16:31 -0700 Subject: Add input node wiring for vxlan4-gpe-input, vxlan6-gpe-input, gre Change-Id: Ie7b132924f36a0522e956a80d3f6f2b5fcca84f0 Signed-off-by: Keith Burns (alagalah) --- nsh-plugin/Makefile.am | 4 +-- nsh-plugin/nsh/nsh.c | 81 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 54 insertions(+), 31 deletions(-) (limited to 'nsh-plugin') diff --git a/nsh-plugin/Makefile.am b/nsh-plugin/Makefile.am index 99c607e..e34e903 100644 --- a/nsh-plugin/Makefile.am +++ b/nsh-plugin/Makefile.am @@ -42,9 +42,9 @@ nsh_test_plugin_la_LDFLAGS = -module install-data-hook: mkdir $(prefix)/lib/vpp_plugins || true mkdir $(prefix)/lib/vpp_api_test_plugins || true - cp $(prefix)/lib/nsh_plugin.so.*.*.* $(prefix)/lib/vpp_plugins + cp $(prefix)/lib/nsh_plugin.so.*.*.* $(prefix)/lib/vpp_plugins/nsh_plugin.so cp $(prefix)/lib/nsh_test_plugin.so.*.*.* \ - $(prefix)/lib/vpp_api_test_plugins + $(prefix)/lib/vpp_api_test_plugins/nsh_test_plugin.so rm -f $(prefix)/lib/nsh_plugin.* rm -f $(prefix)/lib/nsh_test_plugin.* diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c index 10cd60f..e937204 100644 --- a/nsh-plugin/nsh/nsh.c +++ b/nsh-plugin/nsh/nsh.c @@ -612,35 +612,6 @@ nsh_plugin_api_hookup (vlib_main_t *vm) return 0; } -clib_error_t *nsh_init (vlib_main_t *vm) -{ - nsh_main_t *nm = &nsh_main; - clib_error_t * error = 0; - u8 * name; - - nm->nsh_mapping_by_key - = hash_create_mem (0, sizeof(u32), sizeof (uword)); - - nm->nsh_mapping_by_mapped_key - = hash_create_mem (0, sizeof(u32), sizeof (uword)); - - nm->nsh_entry_by_key - = hash_create_mem (0, sizeof(u32), sizeof (uword)); - - name = format (0, "nsh_%08x%c", api_version, 0); - - - nm->msg_id_base = vl_msg_api_get_msg_ids - ((char *) name, VL_MSG_FIRST_AVAILABLE); - - error = nsh_plugin_api_hookup (vm); - - vec_free(name); - - return error; -} - -VLIB_INIT_FUNCTION(nsh_init); @@ -881,3 +852,55 @@ VLIB_REGISTER_NODE (nsh_input_node) = { #undef _ }, }; + +clib_error_t *nsh_init (vlib_main_t *vm) +{ + nsh_main_t *nm = &nsh_main; + clib_error_t * error = 0; + vlib_node_t * vxlan4_gpe_input_node = 0; + vlib_node_t * vxlan6_gpe_input_node = 0; + vlib_node_t * gre_input_node = 0; + u8 * name; + + /* Init the main structures from VPP */ + nm->vlib_main = vm; + nm->vnet_main = vnet_get_main(); + + /* Various state maintenance mappings */ + nm->nsh_mapping_by_key + = hash_create_mem (0, sizeof(u32), sizeof (uword)); + + nm->nsh_mapping_by_mapped_key + = hash_create_mem (0, sizeof(u32), sizeof (uword)); + + nm->nsh_entry_by_key + = hash_create_mem (0, sizeof(u32), sizeof (uword)); + + name = format (0, "nsh_%08x%c", api_version, 0); + + /* Set up the API */ + nm->msg_id_base = vl_msg_api_get_msg_ids + ((char *) name, VL_MSG_FIRST_AVAILABLE); + + error = nsh_plugin_api_hookup (vm); + + /* Add dispositions to nodes that feed nsh-input */ + vxlan4_gpe_input_node = vlib_get_node_by_name (vm, (u8 *)"vxlan4-gpe-input"); + ASSERT(vxlan4_gpe_input_node); + //alagalah - validate we don't really need to use the node value + vlib_node_add_next (vm, vxlan4_gpe_input_node->index, nsh_input_node.index); + + vxlan6_gpe_input_node = vlib_get_node_by_name (vm, (u8 *)"vxlan6-gpe-input"); + ASSERT(vxlan6_gpe_input_node); + vlib_node_add_next (vm, vxlan6_gpe_input_node->index, nsh_input_node.index); + + gre_input_node = vlib_get_node_by_name (vm, (u8 *)"gre-input"); + ASSERT(gre_input_node); + vlib_node_add_next (vm, gre_input_node->index, nsh_input_node.index); + + vec_free(name); + + return error; +} + +VLIB_INIT_FUNCTION(nsh_init); -- cgit 1.2.3-korg