diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2017-03-16 00:07:36 +0800 |
---|---|---|
committer | Hongjun Ni <hongjun.ni@intel.com> | 2017-03-23 22:45:52 +0800 |
commit | aa609dfe9072323483c8c0a95460b1be4ca05383 (patch) | |
tree | acb406b260e824fcb444be7b82b878820b9d2a38 /nsh-plugin/nsh | |
parent | 48473a840103b7f75a0749d371d0493337bd173b (diff) |
Hc2vpp failed to load libjvpp_nsh.so
Modify code to adapt new API registration mechanism
Change-Id: I968199e86278a01ff01267e55468099886689d12
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'nsh-plugin/nsh')
-rw-r--r-- | nsh-plugin/nsh/nsh.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c index 67ddaba..6ff60c8 100644 --- a/nsh-plugin/nsh/nsh.c +++ b/nsh-plugin/nsh/nsh.c @@ -51,6 +51,10 @@ #include <vpp-api/nsh_all_api_h.h> #undef vl_api_version +#define vl_msg_name_crc_list +#include <vpp-api/nsh_all_api_h.h> +#undef vl_msg_name_crc_list + /* * A handy macro to set up a message reply. * Assumes that the following variables are available: @@ -1378,7 +1382,7 @@ VLIB_CLI_COMMAND (show_nsh_entry_command, static) = { static clib_error_t * nsh_plugin_api_hookup (vlib_main_t *vm) { - nsh_main_t * nm = &nsh_main; + nsh_main_t * nm __attribute__ ((unused)) = &nsh_main; #define _(N,n) \ vl_msg_api_set_handlers((VL_API_##N + nm->msg_id_base), \ #n, \ @@ -1393,6 +1397,15 @@ nsh_plugin_api_hookup (vlib_main_t *vm) return 0; } +static void +setup_message_id_table (nsh_main_t * nm, api_main_t * am) +{ +#define _(id,n,crc) \ + vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + nm->msg_id_base); + foreach_vl_msg_name_crc_nsh; +#undef _ +} + always_inline void nsh_md2_encap (vlib_buffer_t * b, nsh_base_header_t *hdr, nsh_entry_t * nsh_entry) @@ -2304,6 +2317,9 @@ clib_error_t *nsh_init (vlib_main_t *vm) error = nsh_plugin_api_hookup (vm); + /* Add our API messages to the global name_crc hash table */ + setup_message_id_table (nm, &api_main); + /* Add dispositions to nodes that feed nsh-input */ //alagalah - validate we don't really need to use the node value next_node = vlib_node_add_next (vm, vxlan4_gpe_input_node.index, nsh_input_node.index); |