diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/abf/abf_api.c | 46 | ||||
-rw-r--r-- | src/plugins/acl/acl.c | 12 | ||||
-rw-r--r-- | src/plugins/igmp/igmp_api.c | 42 | ||||
-rw-r--r-- | src/plugins/ioam/lib-trace/trace_api.c | 70 | ||||
-rw-r--r-- | src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c | 59 | ||||
-rw-r--r-- | src/plugins/nat/nat_api.c | 22 | ||||
-rw-r--r-- | src/plugins/nsh/nsh_api.c | 36 | ||||
-rw-r--r-- | src/plugins/svs/svs_api.c | 29 |
8 files changed, 104 insertions, 212 deletions
diff --git a/src/plugins/abf/abf_api.c b/src/plugins/abf/abf_api.c index bf2566901c4..9da08394fe6 100644 --- a/src/plugins/abf/abf_api.c +++ b/src/plugins/abf/abf_api.c @@ -72,24 +72,20 @@ static void vl_api_abf_plugin_get_version_t_handler (vl_api_abf_plugin_get_version_t * mp) { vl_api_abf_plugin_get_version_reply_t *rmp; - int msg_size = sizeof (*rmp); - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; - rmp = vl_msg_api_alloc (msg_size); - clib_memset (rmp, 0, msg_size); + rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_ABF_PLUGIN_GET_VERSION_REPLY + abf_base_msg_id); rmp->context = mp->context; rmp->major = htonl (ABF_PLUGIN_VERSION_MAJOR); rmp->minor = htonl (ABF_PLUGIN_VERSION_MINOR); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (rp, (u8 *) rmp); } static void @@ -155,7 +151,7 @@ vl_api_abf_itf_attach_add_del_t_handler (vl_api_abf_itf_attach_add_del_t * mp) typedef struct abf_dump_walk_ctx_t_ { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; u32 context; } abf_dump_walk_ctx_t; @@ -194,7 +190,7 @@ abf_policy_send_details (u32 api, void *args) fp++; } - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->rp, (u8 *) mp); return (1); } @@ -202,16 +198,14 @@ abf_policy_send_details (u32 api, void *args) static void vl_api_abf_policy_dump_t_handler (vl_api_abf_policy_dump_t * mp) { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; abf_dump_walk_ctx_t ctx = { - .q = q, + .rp = rp, .context = mp->context, }; @@ -239,7 +233,7 @@ abf_itf_attach_send_details (u32 aiai, void *args) mp->attach.priority = htonl (aia->aia_prio); mp->attach.is_ipv6 = (aia->aia_proto == FIB_PROTOCOL_IP6); - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->rp, (u8 *) mp); return (1); } @@ -247,16 +241,14 @@ abf_itf_attach_send_details (u32 aiai, void *args) static void vl_api_abf_itf_attach_dump_t_handler (vl_api_abf_itf_attach_dump_t * mp) { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; abf_dump_walk_ctx_t ctx = { - .q = q, + .rp = rp, .context = mp->context, }; diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c index 396fe1fd114..63aafec6daf 100644 --- a/src/plugins/acl/acl.c +++ b/src/plugins/acl/acl.c @@ -305,13 +305,11 @@ static void acl_main_t *am = &acl_main; vl_api_acl_plugin_get_conn_table_max_entries_reply_t *rmp; int msg_size = sizeof (*rmp); - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; rmp = vl_msg_api_alloc (msg_size); memset (rmp, 0, msg_size); @@ -321,7 +319,7 @@ static void rmp->context = mp->context; rmp->conn_table_max_entries = __bswap_64 (am->fa_conn_table_max_entries); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (rp, (u8 *) rmp); } static void diff --git a/src/plugins/igmp/igmp_api.c b/src/plugins/igmp/igmp_api.c index 0149b2af127..d619abdd893 100644 --- a/src/plugins/igmp/igmp_api.c +++ b/src/plugins/igmp/igmp_api.c @@ -160,7 +160,7 @@ static void } static void -send_igmp_details (unix_shared_memory_queue_t * q, igmp_main_t * im, +send_igmp_details (vl_api_registration_t * rp, igmp_main_t * im, igmp_config_t * config, igmp_group_t * group, igmp_src_t * src, u32 context) { @@ -175,12 +175,12 @@ send_igmp_details (unix_shared_memory_queue_t * q, igmp_main_t * im, clib_memcpy (&mp->saddr, &src->key->ip4, sizeof (src->key->ip4)); clib_memcpy (&mp->gaddr, &group->key->ip4, sizeof (group->key->ip4)); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (rp, (u8 *) mp); } static void igmp_config_dump (igmp_main_t * im, - unix_shared_memory_queue_t * q, + vl_api_registration_t * rp, u32 context, igmp_config_t * config) { igmp_group_t *group; @@ -191,7 +191,7 @@ igmp_config_dump (igmp_main_t * im, ({ FOR_EACH_SRC (src, group, IGMP_FILTER_MODE_INCLUDE, ({ - send_igmp_details (q, im, config, group, src, context); + send_igmp_details (rp, im, config, group, src, context); })); })); /* *INDENT-ON* */ @@ -200,13 +200,13 @@ igmp_config_dump (igmp_main_t * im, static void vl_api_igmp_dump_t_handler (vl_api_igmp_dump_t * mp) { - unix_shared_memory_queue_t *q; igmp_main_t *im = &igmp_main; igmp_config_t *config; u32 sw_if_index; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) return; sw_if_index = ntohl (mp->sw_if_index); @@ -215,7 +215,7 @@ vl_api_igmp_dump_t_handler (vl_api_igmp_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (config, im->configs, ({ - igmp_config_dump(im, q, mp->context, config); + igmp_config_dump(im, rp, mp->context, config); })); /* *INDENT-ON* */ } @@ -224,7 +224,7 @@ vl_api_igmp_dump_t_handler (vl_api_igmp_dump_t * mp) config = igmp_config_lookup (sw_if_index); if (config) { - igmp_config_dump (im, q, mp->context, config); + igmp_config_dump (im, rp, mp->context, config); } } } @@ -286,7 +286,7 @@ vl_api_igmp_group_prefix_set_t_handler (vl_api_igmp_group_prefix_set_t * mp) typedef struct igmp_ssm_range_walk_ctx_t_ { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; u32 context; } igmp_ssm_range_walk_ctx_t; @@ -305,7 +305,7 @@ igmp_ssm_range_walk_dump (const fib_prefix_t * pfx, mp->gp.type = igmp_group_type_int_to_api (type); ip_prefix_encode (pfx, &mp->gp.prefix); - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->rp, (u8 *) mp); return (WALK_CONTINUE); } @@ -313,14 +313,14 @@ igmp_ssm_range_walk_dump (const fib_prefix_t * pfx, static void vl_api_igmp_group_prefix_dump_t_handler (vl_api_igmp_dump_t * mp) { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) return; igmp_ssm_range_walk_ctx_t ctx = { - .q = q, + .rp = rp, .context = mp->context, }; @@ -398,7 +398,7 @@ want_igmp_events_reaper (u32 client_index) VL_MSG_API_REAPER_FUNCTION (want_igmp_events_reaper); void -send_igmp_event (unix_shared_memory_queue_t * q, +send_igmp_event (vl_api_registration_t * rp, u32 context, igmp_filter_mode_t filter, u32 sw_if_index, @@ -414,7 +414,7 @@ send_igmp_event (unix_shared_memory_queue_t * q, clib_memcpy (&mp->saddr, &saddr->ip4, sizeof (ip4_address_t)); clib_memcpy (&mp->gaddr, &gaddr->ip4, sizeof (ip4_address_t)); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (rp, (u8 *) mp); } void @@ -423,7 +423,7 @@ igmp_event (igmp_filter_mode_t filter, const ip46_address_t * saddr, const ip46_address_t * gaddr) { vpe_client_registration_t *api_client; - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; igmp_main_t *im; im = &igmp_main; @@ -438,9 +438,9 @@ igmp_event (igmp_filter_mode_t filter, /* *INDENT-OFF* */ pool_foreach (api_client, im->api_clients, ({ - q = vl_api_client_index_to_input_queue (api_client->client_index); - if (q) - send_igmp_event (q, 0, filter, sw_if_index, saddr, gaddr); + rp = vl_api_client_index_to_registration (api_client->client_index); + if (rp) + send_igmp_event (rp, 0, filter, sw_if_index, saddr, gaddr); })); /* *INDENT-ON* */ } diff --git a/src/plugins/ioam/lib-trace/trace_api.c b/src/plugins/ioam/lib-trace/trace_api.c index bb043f7c831..f74d4e7f43b 100644 --- a/src/plugins/ioam/lib-trace/trace_api.c +++ b/src/plugins/ioam/lib-trace/trace_api.c @@ -23,7 +23,7 @@ #include <vnet/plugin/plugin.h> #include <ioam/lib-trace/trace_util.h> #include <ioam/lib-trace/trace_config.h> - +#include <vlibapi/api_helper_macros.h> #include <vlibapi/api.h> #include <vlibmemory/api.h> @@ -52,47 +52,6 @@ #include <ioam/lib-trace/trace_all_api_h.h> #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 TRACE_REPLY_MACRO(t) \ -do { \ - svm_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); - -/* *INDENT-OFF* */ -#define TRACE_REPLY_MACRO2(t, body) \ -do { \ - svm_queue_t * q; \ - rv = vl_msg_api_pd_handler (mp, rv); \ - 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); \ - do {body;} while (0); \ - vl_msg_api_send_shmem (q, (u8 *)&rmp); \ -} while(0); -/* *INDENT-ON* */ - /* List of message types that this plugin understands */ #define foreach_trace_plugin_api_msg \ @@ -103,7 +62,6 @@ _(TRACE_PROFILE_SHOW_CONFIG, trace_profile_show_config) static void vl_api_trace_profile_add_t_handler (vl_api_trace_profile_add_t * mp) { - trace_main_t *sm = &trace_main; int rv = 0; vl_api_trace_profile_add_reply_t *rmp; trace_profile *profile = NULL; @@ -123,45 +81,43 @@ static void vl_api_trace_profile_add_t_handler rv = -3; } ERROROUT: - TRACE_REPLY_MACRO (VL_API_TRACE_PROFILE_ADD_REPLY); + REPLY_MACRO (VL_API_TRACE_PROFILE_ADD_REPLY); } static void vl_api_trace_profile_del_t_handler (vl_api_trace_profile_del_t * mp) { - trace_main_t *sm = &trace_main; int rv = 0; vl_api_trace_profile_del_reply_t *rmp; clear_trace_profiles (); - TRACE_REPLY_MACRO (VL_API_TRACE_PROFILE_DEL_REPLY); + REPLY_MACRO (VL_API_TRACE_PROFILE_DEL_REPLY); } static void vl_api_trace_profile_show_config_t_handler (vl_api_trace_profile_show_config_t * mp) { - trace_main_t *sm = &trace_main; vl_api_trace_profile_show_config_reply_t *rmp; int rv = 0; trace_profile *profile = trace_profile_find (); if (profile->valid) { - TRACE_REPLY_MACRO2 (VL_API_TRACE_PROFILE_SHOW_CONFIG_REPLY, - rmp->trace_type = profile->trace_type; - rmp->num_elts = profile->num_elts; - rmp->trace_tsp = profile->trace_tsp; - rmp->node_id = htonl (profile->node_id); - rmp->app_data = htonl (profile->app_data); + REPLY_MACRO2 (VL_API_TRACE_PROFILE_SHOW_CONFIG_REPLY, + rmp->trace_type = profile->trace_type; + rmp->num_elts = profile->num_elts; + rmp->trace_tsp = profile->trace_tsp; + rmp->node_id = htonl (profile->node_id); + rmp->app_data = htonl (profile->app_data); ); } else { - TRACE_REPLY_MACRO2 (VL_API_TRACE_PROFILE_SHOW_CONFIG_REPLY, - rmp->trace_type = 0; - rmp->num_elts = 0; rmp->trace_tsp = 0; - rmp->node_id = 0; rmp->app_data = 0; + REPLY_MACRO2 (VL_API_TRACE_PROFILE_SHOW_CONFIG_REPLY, + rmp->trace_type = 0; + rmp->num_elts = 0; rmp->trace_tsp = 0; + rmp->node_id = 0; rmp->app_data = 0; ); } } diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c index 2d9c6bfab3d..e46d0fbf866 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c +++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c @@ -22,7 +22,7 @@ #include <vnet/vnet.h> #include <vnet/plugin/plugin.h> #include <ioam/lib-vxlan-gpe/vxlan_gpe_ioam.h> - +#include <vlibapi/api_helper_macros.h> #include <vlibapi/api.h> #include <vlibmemory/api.h> @@ -51,47 +51,6 @@ #include <ioam/lib-vxlan-gpe/vxlan_gpe_all_api_h.h> #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 VXLAN_GPE_REPLY_MACRO(t) \ -do { \ - svm_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); - -/* *INDENT-OFF* */ -#define VXLAN_GPE_REPLY_MACRO2(t, body) \ -do { \ - svm_queue_t * q; \ - rv = vl_msg_api_pd_handler (mp, rv); \ - 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)); \ - rmp->context = mp->context; \ - rmp->retval = ntohl(rv); \ - do {body;} while (0); \ - vl_msg_api_send_shmem (q, (u8 *)&rmp); \ -} while(0); -/* *INDENT-ON* */ - /* List of message types that this plugin understands */ #define foreach_vxlan_gpe_plugin_api_msg \ @@ -109,7 +68,6 @@ static void vl_api_vxlan_gpe_ioam_enable_t_handler int rv = 0; vl_api_vxlan_gpe_ioam_enable_reply_t *rmp; clib_error_t *error; - vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main; /* Ignoring the profile id as currently a single profile * is supported */ @@ -121,7 +79,7 @@ static void vl_api_vxlan_gpe_ioam_enable_t_handler rv = clib_error_get_code (error); } - VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_ENABLE_REPLY); + REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_ENABLE_REPLY); } static void vl_api_vxlan_gpe_ioam_disable_t_handler @@ -130,7 +88,6 @@ static void vl_api_vxlan_gpe_ioam_disable_t_handler int rv = 0; vl_api_vxlan_gpe_ioam_disable_reply_t *rmp; clib_error_t *error; - vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main; /* Ignoring the profile id as currently a single profile * is supported */ @@ -141,7 +98,7 @@ static void vl_api_vxlan_gpe_ioam_disable_t_handler rv = clib_error_get_code (error); } - VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_DISABLE_REPLY); + REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_DISABLE_REPLY); } static void vl_api_vxlan_gpe_ioam_vni_enable_t_handler @@ -150,7 +107,6 @@ static void vl_api_vxlan_gpe_ioam_vni_enable_t_handler int rv = 0; vl_api_vxlan_gpe_ioam_vni_enable_reply_t *rmp; clib_error_t *error; - vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main; vxlan4_gpe_tunnel_key_t key4; uword *p = NULL; vxlan_gpe_main_t *gm = &vxlan_gpe_main; @@ -190,7 +146,7 @@ static void vl_api_vxlan_gpe_ioam_vni_enable_t_handler rv = clib_error_get_code (error); } - VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_VNI_ENABLE_REPLY); + REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_VNI_ENABLE_REPLY); } @@ -200,7 +156,6 @@ static void vl_api_vxlan_gpe_ioam_vni_disable_t_handler int rv = 0; vl_api_vxlan_gpe_ioam_vni_enable_reply_t *rmp; clib_error_t *error; - vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main; vxlan4_gpe_tunnel_key_t key4; uword *p = NULL; vxlan_gpe_main_t *gm = &vxlan_gpe_main; @@ -238,7 +193,7 @@ static void vl_api_vxlan_gpe_ioam_vni_disable_t_handler } - VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_VNI_DISABLE_REPLY); + REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_VNI_DISABLE_REPLY); } static void vl_api_vxlan_gpe_ioam_transit_enable_t_handler @@ -260,7 +215,7 @@ static void vl_api_vxlan_gpe_ioam_transit_enable_t_handler mp->is_ipv6 ? 0 : 1, 1 /* is_add */ ); - VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_TRANSIT_ENABLE_REPLY); + REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_TRANSIT_ENABLE_REPLY); } static void vl_api_vxlan_gpe_ioam_transit_disable_t_handler @@ -281,7 +236,7 @@ static void vl_api_vxlan_gpe_ioam_transit_disable_t_handler dst_addr, ntohl (mp->outer_fib_index), mp->is_ipv6 ? 0 : 1); - VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_TRANSIT_DISABLE_REPLY); + REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_TRANSIT_DISABLE_REPLY); } /* Set up the API message handling tables */ diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c index 516b27fb6f5..21b2cd44880 100644 --- a/src/plugins/nat/nat_api.c +++ b/src/plugins/nat/nat_api.c @@ -3267,7 +3267,7 @@ static void *vl_api_nat66_add_del_static_mapping_t_print typedef struct nat66_api_walk_ctx_t_ { - svm_queue_t *q; + vl_api_registration_t *rp; u32 context; } nat66_api_walk_ctx_t; @@ -3285,7 +3285,7 @@ nat66_api_interface_walk (snat_interface_t * i, void *arg) rmp->is_inside = nat_interface_is_inside (i); rmp->context = ctx->context; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->rp, (u8 *) rmp); return 0; } @@ -3293,14 +3293,14 @@ nat66_api_interface_walk (snat_interface_t * i, void *arg) static void vl_api_nat66_interface_dump_t_handler (vl_api_nat66_interface_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) return; nat66_api_walk_ctx_t ctx = { - .q = q, + .rp = rp, .context = mp->context, }; @@ -3345,7 +3345,7 @@ nat66_api_static_mapping_walk (nat66_static_mapping_t * m, void *arg) rmp->total_pkts = clib_host_to_net_u64 (vc.packets); rmp->context = ctx->context; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->rp, (u8 *) rmp); return 0; } @@ -3354,14 +3354,14 @@ static void vl_api_nat66_static_mapping_dump_t_handler (vl_api_nat66_static_mapping_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) return; nat66_api_walk_ctx_t ctx = { - .q = q, + .rp = rp, .context = mp->context, }; diff --git a/src/plugins/nsh/nsh_api.c b/src/plugins/nsh/nsh_api.c index cf9fd574b34..e541301614b 100644 --- a/src/plugins/nsh/nsh_api.c +++ b/src/plugins/nsh/nsh_api.c @@ -124,7 +124,7 @@ VNET_DEVICE_CLASS (nsh_device_class, static) = { /* *INDENT-ON* */ static void send_nsh_entry_details - (nsh_entry_t * t, unix_shared_memory_queue_t * q, u32 context) + (nsh_entry_t * t, vl_api_registration_t * rp, u32 context) { vl_api_nsh_entry_details_t *rmp; nsh_main_t *nm = &nsh_main; @@ -157,11 +157,11 @@ static void send_nsh_entry_details rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (rp, (u8 *) rmp); } static void send_nsh_map_details - (nsh_map_t * t, unix_shared_memory_queue_t * q, u32 context) + (nsh_map_t * t, vl_api_registration_t * rp, u32 context) { vl_api_nsh_map_details_t *rmp; nsh_main_t *nm = &nsh_main; @@ -179,22 +179,20 @@ static void send_nsh_map_details rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (rp, (u8 *) rmp); } static void vl_api_nsh_map_dump_t_handler (vl_api_nsh_map_dump_t * mp) { - unix_shared_memory_queue_t *q; nsh_main_t *nm = &nsh_main; nsh_map_t *t; u32 map_index; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; map_index = ntohl (mp->map_index); @@ -202,7 +200,7 @@ vl_api_nsh_map_dump_t_handler (vl_api_nsh_map_dump_t * mp) { pool_foreach (t, nm->nsh_mappings, ( { - send_nsh_map_details (t, q, + send_nsh_map_details (t, rp, mp->context); } )); @@ -214,7 +212,7 @@ vl_api_nsh_map_dump_t_handler (vl_api_nsh_map_dump_t * mp) return; } t = &nm->nsh_mappings[map_index]; - send_nsh_map_details (t, q, mp->context); + send_nsh_map_details (t, rp, mp->context); } } @@ -650,16 +648,14 @@ static void vl_api_nsh_add_del_entry_t_handler static void vl_api_nsh_entry_dump_t_handler (vl_api_nsh_entry_dump_t * mp) { - unix_shared_memory_queue_t *q; nsh_main_t *nm = &nsh_main; nsh_entry_t *t; u32 entry_index; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; entry_index = ntohl (mp->entry_index); @@ -667,7 +663,7 @@ vl_api_nsh_entry_dump_t_handler (vl_api_nsh_entry_dump_t * mp) { pool_foreach (t, nm->nsh_entries, ( { - send_nsh_entry_details (t, q, + send_nsh_entry_details (t, rp, mp->context); } )); @@ -679,7 +675,7 @@ vl_api_nsh_entry_dump_t_handler (vl_api_nsh_entry_dump_t * mp) return; } t = &nm->nsh_entries[entry_index]; - send_nsh_entry_details (t, q, mp->context); + send_nsh_entry_details (t, rp, mp->context); } } diff --git a/src/plugins/svs/svs_api.c b/src/plugins/svs/svs_api.c index 03941fea08e..068d2fa4e76 100644 --- a/src/plugins/svs/svs_api.c +++ b/src/plugins/svs/svs_api.c @@ -54,7 +54,6 @@ * Base message ID fot the plugin */ static u32 svs_base_msg_id; - #include <vlibapi/api_helper_macros.h> /* List of message types that this plugin understands */ @@ -71,13 +70,11 @@ vl_api_svs_plugin_get_version_t_handler (vl_api_svs_plugin_get_version_t * mp) { vl_api_svs_plugin_get_version_reply_t *rmp; int msg_size = sizeof (*rmp); - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; rmp = vl_msg_api_alloc (msg_size); clib_memset (rmp, 0, msg_size); @@ -87,7 +84,7 @@ vl_api_svs_plugin_get_version_t_handler (vl_api_svs_plugin_get_version_t * mp) rmp->major = htonl (SVS_PLUGIN_VERSION_MAJOR); rmp->minor = htonl (SVS_PLUGIN_VERSION_MINOR); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (rp, (u8 *) rmp); } static void @@ -160,7 +157,7 @@ vl_api_svs_enable_disable_t_handler (vl_api_svs_enable_disable_t * mp) typedef struct svs_dump_walk_ctx_t_ { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; u32 context; } svs_dump_walk_ctx_t; @@ -182,7 +179,7 @@ svs_send_details (fib_protocol_t fproto, mp->table_id = htonl (table_id); mp->af = fib_proto_to_api_address_family (fproto); - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->rp, (u8 *) mp); return (WALK_CONTINUE); } @@ -190,16 +187,14 @@ svs_send_details (fib_protocol_t fproto, static void vl_api_svs_dump_t_handler (vl_api_svs_dump_t * mp) { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) + return; svs_dump_walk_ctx_t ctx = { - .q = q, + .rp = rp, .context = mp->context, }; |