X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fioam%2Fexport-vxlan-gpe%2Fvxlan_gpe_ioam_export.c;h=976c831fcce6122fdece472db321dd412540c2bc;hb=0d056e5ede136cd0111dc3f9f41ef7b36a938027;hp=f05b5303d3cabe2a025941e416fb5a79408599ef;hpb=fdd81af6afe6c782ad2c1a139210378badec626b;p=vpp.git diff --git a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c index f05b5303d3c..976c831fcce 100644 --- a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c +++ b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c @@ -25,7 +25,6 @@ #include #include -#include #include @@ -53,37 +52,15 @@ #include #undef vl_api_version -/* - * A handy macro to set up a message reply. - * Assumes that the following variables are available: - * mp - pointer to request message - * rmp - pointer to reply message type - * rv - return value - */ - -#define REPLY_MACRO(t) \ -do { \ - unix_shared_memory_queue_t * q = \ - vl_api_client_index_to_input_queue (mp->client_index); \ - if (!q) \ - return; \ - \ - rmp = vl_msg_api_alloc (sizeof (*rmp)); \ - rmp->_vl_msg_id = ntohs((t)+sm->msg_id_base); \ - rmp->context = mp->context; \ - rmp->retval = ntohl(rv); \ - \ - vl_msg_api_send_shmem (q, (u8 *)&rmp); \ -} while(0); - +#define REPLY_MSG_ID_BASE sm->msg_id_base +#include /* List of message types that this plugin understands */ - - #define foreach_vxlan_gpe_ioam_export_plugin_api_msg \ _(VXLAN_GPE_IOAM_EXPORT_ENABLE_DISABLE, vxlan_gpe_ioam_export_enable_disable) ioam_export_main_t vxlan_gpe_ioam_export_main; +extern vlib_node_registration_t vxlan_export_node; extern void vxlan_gpe_set_next_override (uword next); /* Action function shared between message handler and debug CLI */ @@ -177,6 +154,19 @@ vxlan_gpe_ioam_export_plugin_api_hookup (vlib_main_t * vm) return 0; } +#define vl_msg_name_crc_list +#include +#undef vl_msg_name_crc_list + +static void +setup_message_id_table (ioam_export_main_t * sm, api_main_t * am) +{ +#define _(id,n,crc) \ + vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + sm->msg_id_base); + foreach_vl_msg_name_crc_vxlan_gpe_ioam_export; +#undef _ +} + static clib_error_t * set_vxlan_gpe_ioam_export_ipfix_command_fn (vlib_main_t * vm, @@ -255,6 +245,10 @@ vxlan_gpe_ioam_export_init (vlib_main_t * vm) em->vlib_time_0 = vlib_time_now (vm); error = vxlan_gpe_ioam_export_plugin_api_hookup (vm); + + /* Add our API messages to the global name_crc hash table */ + setup_message_id_table (em, &api_main); + em->my_hbh_slot = ~0; em->vlib_main = vm; em->vnet_main = vnet_get_main ();