diff options
Diffstat (limited to 'src')
38 files changed, 808 insertions, 895 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c index b93d3bca1c4..2a2aaa08d7e 100644 --- a/src/plugins/acl/acl.c +++ b/src/plugins/acl/acl.c @@ -138,13 +138,11 @@ vl_api_acl_plugin_get_version_t_handler (vl_api_acl_plugin_get_version_t * mp) acl_main_t *am = &acl_main; vl_api_acl_plugin_get_version_reply_t *rmp; int msg_size = sizeof (*rmp); - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; rmp = vl_msg_api_alloc (msg_size); memset (rmp, 0, msg_size); @@ -154,7 +152,7 @@ vl_api_acl_plugin_get_version_t_handler (vl_api_acl_plugin_get_version_t * mp) rmp->major = htonl (ACL_PLUGIN_VERSION_MAJOR); rmp->minor = htonl (ACL_PLUGIN_VERSION_MINOR); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -1871,7 +1869,7 @@ copy_acl_rule_to_api_rule (vl_api_acl_rule_t * api_rule, acl_rule_t * r) } static void -send_acl_details (acl_main_t * am, svm_queue_t * q, +send_acl_details (acl_main_t * am, vl_api_registration_t * reg, acl_list_t * acl, u32 context) { vl_api_acl_details_t *mp; @@ -1897,7 +1895,7 @@ send_acl_details (acl_main_t * am, svm_queue_t * q, } clib_mem_set_heap (oldheap); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } @@ -1907,15 +1905,12 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp) acl_main_t *am = &acl_main; u32 acl_index; acl_list_t *acl; - int rv = -1; - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->acl_index == ~0) { @@ -1923,7 +1918,7 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp) /* Just dump all ACLs */ pool_foreach (acl, am->acls, ({ - send_acl_details(am, q, acl, mp->context); + send_acl_details(am, reg, acl, mp->context); })); /* *INDENT-ON* */ } @@ -1933,7 +1928,7 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp) if (!pool_is_free_index (am->acls, acl_index)) { acl = pool_elt_at_index (am->acls, acl_index); - send_acl_details (am, q, acl, mp->context); + send_acl_details (am, reg, acl, mp->context); } } @@ -1946,7 +1941,7 @@ vl_api_acl_dump_t_handler (vl_api_acl_dump_t * mp) static void send_acl_interface_list_details (acl_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, u32 sw_if_index, u32 context) { vl_api_acl_interface_list_details_t *mp; @@ -1987,7 +1982,7 @@ send_acl_interface_list_details (acl_main_t * am, htonl (am->output_acl_vec_by_sw_if_index[sw_if_index][i]); } clib_mem_set_heap (oldheap); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -1999,20 +1994,18 @@ vl_api_acl_interface_list_dump_t_handler (vl_api_acl_interface_list_dump_t * vnet_interface_main_t *im = &am->vnet_main->interface_main; u32 sw_if_index; - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->sw_if_index == ~0) { /* *INDENT-OFF* */ pool_foreach (swif, im->sw_interfaces, ({ - send_acl_interface_list_details(am, q, swif->sw_if_index, mp->context); + send_acl_interface_list_details(am, reg, swif->sw_if_index, mp->context); })); /* *INDENT-ON* */ } @@ -2020,7 +2013,7 @@ vl_api_acl_interface_list_dump_t_handler (vl_api_acl_interface_list_dump_t * { sw_if_index = ntohl (mp->sw_if_index); if (!pool_is_free_index (im->sw_interfaces, sw_if_index)) - send_acl_interface_list_details (am, q, sw_if_index, mp->context); + send_acl_interface_list_details (am, reg, sw_if_index, mp->context); } } @@ -2113,7 +2106,7 @@ static void } static void -send_macip_acl_details (acl_main_t * am, svm_queue_t * q, +send_macip_acl_details (acl_main_t * am, vl_api_registration_t * reg, macip_acl_list_t * acl, u32 context) { vl_api_macip_acl_details_t *mp; @@ -2158,7 +2151,7 @@ send_macip_acl_details (acl_main_t * am, svm_queue_t * q, mp->count = 0; } - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } @@ -2168,22 +2161,21 @@ vl_api_macip_acl_dump_t_handler (vl_api_macip_acl_dump_t * mp) acl_main_t *am = &acl_main; macip_acl_list_t *acl; - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->acl_index == ~0) { /* Just dump all ACLs for now, with sw_if_index = ~0 */ pool_foreach (acl, am->macip_acls, ( { - send_macip_acl_details (am, q, acl, - mp-> - context);} + send_macip_acl_details (am, reg, + acl, + mp->context); + } )); /* *INDENT-ON* */ } @@ -2193,7 +2185,7 @@ vl_api_macip_acl_dump_t_handler (vl_api_macip_acl_dump_t * mp) if (!pool_is_free_index (am->macip_acls, acl_index)) { acl = pool_elt_at_index (am->macip_acls, acl_index); - send_macip_acl_details (am, q, acl, mp->context); + send_macip_acl_details (am, reg, acl, mp->context); } } } @@ -2206,14 +2198,12 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t * vl_api_macip_acl_interface_get_reply_t *rmp; u32 count = vec_len (am->macip_acl_by_sw_if_index); int msg_size = sizeof (*rmp) + sizeof (rmp->acls[0]) * count; - svm_queue_t *q; + vl_api_registration_t *reg; int i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; rmp = vl_msg_api_alloc (msg_size); memset (rmp, 0, msg_size); @@ -2226,12 +2216,12 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t * rmp->acls[i] = htonl (am->macip_acl_by_sw_if_index[i]); } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void send_macip_acl_interface_list_details (acl_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, u32 sw_if_index, u32 acl_index, u32 context) { @@ -2250,22 +2240,20 @@ send_macip_acl_interface_list_details (acl_main_t * am, rmp->sw_if_index = htonl (sw_if_index); rmp->acls[0] = htonl (acl_index); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_macip_acl_interface_list_dump_t_handler (vl_api_macip_acl_interface_list_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; acl_main_t *am = &acl_main; u32 sw_if_index = ntohl (mp->sw_if_index); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (sw_if_index == ~0) { @@ -2273,7 +2261,7 @@ static void { if (~0 != am->macip_acl_by_sw_if_index[sw_if_index]) { - send_macip_acl_interface_list_details (am, q, sw_if_index, + send_macip_acl_interface_list_details (am, reg, sw_if_index, am->macip_acl_by_sw_if_index [sw_if_index], mp->context); @@ -2284,7 +2272,7 @@ static void { if (vec_len (am->macip_acl_by_sw_if_index) > sw_if_index) { - send_macip_acl_interface_list_details (am, q, sw_if_index, + send_macip_acl_interface_list_details (am, reg, sw_if_index, am->macip_acl_by_sw_if_index [sw_if_index], mp->context); } diff --git a/src/plugins/gtpu/gtpu_api.c b/src/plugins/gtpu/gtpu_api.c index 1b93578a95d..502720df179 100644 --- a/src/plugins/gtpu/gtpu_api.c +++ b/src/plugins/gtpu/gtpu_api.c @@ -148,7 +148,7 @@ out: } static void send_gtpu_tunnel_details - (gtpu_tunnel_t * t, svm_queue_t * q, u32 context) + (gtpu_tunnel_t * t, vl_api_registration_t * reg, u32 context) { vl_api_gtpu_tunnel_details_t *rmp; ip4_main_t *im4 = &ip4_main; @@ -177,22 +177,20 @@ static void send_gtpu_tunnel_details rmp->is_ipv6 = is_ipv6; rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_gtpu_tunnel_dump_t_handler (vl_api_gtpu_tunnel_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; gtpu_main_t *gtm = >pu_main; gtpu_tunnel_t *t; u32 sw_if_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; sw_if_index = ntohl (mp->sw_if_index); @@ -201,7 +199,7 @@ vl_api_gtpu_tunnel_dump_t_handler (vl_api_gtpu_tunnel_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (t, gtm->tunnels, ({ - send_gtpu_tunnel_details(t, q, mp->context); + send_gtpu_tunnel_details(t, reg, mp->context); })); /* *INDENT-ON* */ } @@ -213,7 +211,7 @@ vl_api_gtpu_tunnel_dump_t_handler (vl_api_gtpu_tunnel_dump_t * mp) return; } t = >m->tunnels[gtm->tunnel_index_by_sw_if_index[sw_if_index]]; - send_gtpu_tunnel_details (t, q, mp->context); + send_gtpu_tunnel_details (t, reg, mp->context); } } diff --git a/src/plugins/memif/memif_api.c b/src/plugins/memif/memif_api.c index 068fd3d69f0..f9f74ccdcb3 100644 --- a/src/plugins/memif/memif_api.c +++ b/src/plugins/memif/memif_api.c @@ -219,7 +219,7 @@ vl_api_memif_delete_t_handler (vl_api_memif_delete_t * mp) } static void -send_memif_details (svm_queue_t * q, +send_memif_details (vl_api_registration_t * reg, memif_if_t * mif, vnet_sw_interface_t * swif, u8 * interface_name, u32 context) @@ -255,7 +255,7 @@ send_memif_details (svm_queue_t * q, mp->admin_up_down = (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? 1 : 0; mp->link_up_down = (hwif->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) ? 1 : 0; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } /** @@ -270,10 +270,10 @@ vl_api_memif_dump_t_handler (vl_api_memif_dump_t * mp) vnet_sw_interface_t *swif; memif_if_t *mif; u8 *if_name = 0; - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ @@ -285,7 +285,7 @@ vl_api_memif_dump_t_handler (vl_api_memif_dump_t * mp) format_vnet_sw_interface_name, vnm, swif, 0); - send_memif_details (q, mif, swif, if_name, mp->context); + send_memif_details (reg, mif, swif, if_name, mp->context); _vec_len (if_name) = 0; })); /* *INDENT-ON* */ diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c index dc9fc5d9a6d..f3d353fa20e 100644 --- a/src/plugins/nat/nat_api.c +++ b/src/plugins/nat/nat_api.c @@ -174,7 +174,8 @@ vl_api_nat_set_workers_t_print (vl_api_nat_set_workers_t * mp, void *handle) } static void -send_nat_worker_details (u32 worker_index, svm_queue_t * q, u32 context) +send_nat_worker_details (u32 worker_index, vl_api_registration_t * reg, + u32 context) { vl_api_nat_worker_details_t *rmp; snat_main_t *sm = &snat_main; @@ -189,23 +190,23 @@ send_nat_worker_details (u32 worker_index, svm_queue_t * q, u32 context) rmp->lcore_id = htonl (w->lcore_id); strncpy ((char *) rmp->name, (char *) w->name, ARRAY_LEN (rmp->name) - 1); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat_worker_dump_t_handler (vl_api_nat_worker_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; u32 *worker_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ vec_foreach (worker_index, sm->workers) - send_nat_worker_details(*worker_index, q, mp->context); + send_nat_worker_details(*worker_index, reg, mp->context); /* *INDENT-ON* */ } @@ -315,7 +316,7 @@ vl_api_nat_get_reass_t_print (vl_api_nat_get_reass_t * mp, void *handle) typedef struct nat_api_walk_ctx_t_ { - svm_queue_t *q; + vl_api_registration_t *reg; u32 context; } nat_api_walk_ctx_t; @@ -337,7 +338,7 @@ nat_ip4_reass_walk_api (nat_reass_ip4_t * reass, void *arg) rmp->frag_n = reass->frag_n; rmp->is_ip4 = 1; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->reg, (u8 *) rmp); return 0; } @@ -360,7 +361,7 @@ nat_ip6_reass_walk_api (nat_reass_ip6_t * reass, void *arg) rmp->frag_n = reass->frag_n; rmp->is_ip4 = 0; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->reg, (u8 *) rmp); return 0; } @@ -368,14 +369,14 @@ nat_ip6_reass_walk_api (nat_reass_ip6_t * reass, void *arg) static void vl_api_nat_reass_dump_t_handler (vl_api_nat_reass_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; nat_api_walk_ctx_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; @@ -468,7 +469,8 @@ static void *vl_api_nat44_add_del_address_range_t_print static void send_nat44_address_details (snat_address_t * a, - svm_queue_t * q, u32 context, u8 twice_nat) + vl_api_registration_t * reg, u32 context, + u8 twice_nat) { vl_api_nat44_address_details_t *rmp; snat_main_t *sm = &snat_main; @@ -487,25 +489,25 @@ send_nat44_address_details (snat_address_t * a, rmp->twice_nat = twice_nat; rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_address_dump_t_handler (vl_api_nat44_address_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_address_t *a; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ vec_foreach (a, sm->addresses) - send_nat44_address_details (a, q, mp->context, 0); + send_nat44_address_details (a, reg, mp->context, 0); vec_foreach (a, sm->twice_nat_addresses) - send_nat44_address_details (a, q, mp->context, 1); + send_nat44_address_details (a, reg, mp->context, 1); /* *INDENT-ON* */ } @@ -554,7 +556,7 @@ static void *vl_api_nat44_interface_add_del_feature_t_print static void send_nat44_interface_details (snat_interface_t * i, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_nat44_interface_details_t *rmp; snat_main_t *sm = &snat_main; @@ -568,24 +570,24 @@ send_nat44_interface_details (snat_interface_t * i, nat_interface_is_inside (i); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_interface_dump_t_handler (vl_api_nat44_interface_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_interface_t *i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach (i, sm->interfaces, ({ - send_nat44_interface_details(i, q, mp->context); + send_nat44_interface_details(i, reg, mp->context); })); /* *INDENT-ON* */ } @@ -636,7 +638,8 @@ static void *vl_api_nat44_interface_add_del_output_feature_t_print static void send_nat44_interface_output_feature_details (snat_interface_t * i, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, + u32 context) { vl_api_nat44_interface_output_feature_details_t *rmp; snat_main_t *sm = &snat_main; @@ -649,25 +652,25 @@ send_nat44_interface_output_feature_details (snat_interface_t * i, rmp->context = context; rmp->is_inside = nat_interface_is_inside (i); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_interface_output_feature_dump_t_handler (vl_api_nat44_interface_output_feature_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_interface_t *i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach (i, sm->output_feature_interfaces, ({ - send_nat44_interface_output_feature_details(i, q, mp->context); + send_nat44_interface_output_feature_details(i, reg, mp->context); })); /* *INDENT-ON* */ } @@ -742,7 +745,7 @@ static void *vl_api_nat44_add_del_static_mapping_t_print static void send_nat44_static_mapping_details (snat_static_mapping_t * m, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_nat44_static_mapping_details_t *rmp; snat_main_t *sm = &snat_main; @@ -762,12 +765,13 @@ send_nat44_static_mapping_details (snat_static_mapping_t * m, rmp->context = context; rmp->twice_nat = m->twice_nat; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, + u32 context) { vl_api_nat44_static_mapping_details_t *rmp; snat_main_t *sm = &snat_main; @@ -786,28 +790,28 @@ send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m, rmp->context = context; rmp->twice_nat = m->twice_nat; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_static_mapping_dump_t_handler (vl_api_nat44_static_mapping_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_static_mapping_t *m; snat_static_map_resolve_t *rp; int j; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach (m, sm->static_mappings, ({ if (!vec_len(m->locals) && (m->local_addr.as_u32 != m->external_addr.as_u32)) - send_nat44_static_mapping_details (m, q, mp->context); + send_nat44_static_mapping_details (m, reg, mp->context); })); /* *INDENT-ON* */ @@ -815,7 +819,7 @@ vl_api_nat44_static_mapping_dump_t_handler (vl_api_nat44_static_mapping_dump_t { rp = sm->to_resolve + j; if (rp->l_addr.as_u32 != 0) - send_nat44_static_map_resolve_details (rp, q, mp->context); + send_nat44_static_map_resolve_details (rp, reg, mp->context); } } @@ -886,7 +890,7 @@ static void *vl_api_nat44_add_del_identity_mapping_t_print static void send_nat44_identity_mapping_details (snat_static_mapping_t * m, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_nat44_identity_mapping_details_t *rmp; snat_main_t *sm = &snat_main; @@ -903,12 +907,13 @@ send_nat44_identity_mapping_details (snat_static_mapping_t * m, rmp->protocol = snat_proto_to_ip_proto (m->proto); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, + u32 context) { vl_api_nat44_identity_mapping_details_t *rmp; snat_main_t *sm = &snat_main; @@ -924,28 +929,28 @@ send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m, rmp->protocol = snat_proto_to_ip_proto (m->proto); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_identity_mapping_dump_t_handler (vl_api_nat44_identity_mapping_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_static_mapping_t *m; snat_static_map_resolve_t *rp; int j; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach (m, sm->static_mappings, ({ if (!vec_len(m->locals) && (m->local_addr.as_u32 == m->external_addr.as_u32)) - send_nat44_identity_mapping_details (m, q, mp->context); + send_nat44_identity_mapping_details (m, reg, mp->context); })); /* *INDENT-ON* */ @@ -953,7 +958,7 @@ static void { rp = sm->to_resolve + j; if (rp->l_addr.as_u32 == 0) - send_nat44_identity_map_resolve_details (rp, q, mp->context); + send_nat44_identity_map_resolve_details (rp, reg, mp->context); } } @@ -1001,7 +1006,8 @@ static void *vl_api_nat44_add_del_interface_addr_t_print static void send_nat44_interface_addr_details (u32 sw_if_index, - svm_queue_t * q, u32 context, u8 twice_nat) + vl_api_registration_t * reg, u32 context, + u8 twice_nat) { vl_api_nat44_interface_addr_details_t *rmp; snat_main_t *sm = &snat_main; @@ -1014,26 +1020,26 @@ send_nat44_interface_addr_details (u32 sw_if_index, rmp->twice_nat = twice_nat; rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_interface_addr_dump_t_handler (vl_api_nat44_interface_addr_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; u32 *i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ vec_foreach (i, sm->auto_add_sw_if_indices) - send_nat44_interface_addr_details(*i, q, mp->context, 0); + send_nat44_interface_addr_details(*i, reg, mp->context, 0); vec_foreach (i, sm->auto_add_sw_if_indices_twice_nat) - send_nat44_interface_addr_details(*i, q, mp->context, 1); + send_nat44_interface_addr_details(*i, reg, mp->context, 1); /* *INDENT-ON* */ } @@ -1049,7 +1055,8 @@ vl_api_nat44_interface_addr_dump_t_print (vl_api_nat44_interface_addr_dump_t * } static void -send_nat44_user_details (snat_user_t * u, svm_queue_t * q, u32 context) +send_nat44_user_details (snat_user_t * u, vl_api_registration_t * reg, + u32 context) { vl_api_nat44_user_details_t *rmp; snat_main_t *sm = &snat_main; @@ -1066,25 +1073,25 @@ send_nat44_user_details (snat_user_t * u, svm_queue_t * q, u32 context) rmp->nstaticsessions = ntohl (u->nstaticsessions); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_user_dump_t_handler (vl_api_nat44_user_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_main_per_thread_data_t *tsm; snat_user_t *u; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ vec_foreach (tsm, sm->per_thread_data) vec_foreach (u, tsm->users) - send_nat44_user_details (u, q, mp->context); + send_nat44_user_details (u, reg, mp->context); /* *INDENT-ON* */ } @@ -1100,7 +1107,7 @@ vl_api_nat44_user_dump_t_print (vl_api_nat44_user_dump_t * mp, void *handle) static void send_nat44_user_session_details (snat_session_t * s, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_nat44_user_session_details_t *rmp; snat_main_t *sm = &snat_main; @@ -1129,14 +1136,14 @@ send_nat44_user_session_details (snat_session_t * s, rmp->protocol = ntohs (snat_proto_to_ip_proto (s->in2out.protocol)); } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_main_per_thread_data_t *tsm; snat_session_t *s; @@ -1147,8 +1154,8 @@ vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t * dlist_elt_t *head, *elt; ip4_header_t ip; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; clib_memcpy (&ukey.addr, mp->ip_address, 4); @@ -1176,7 +1183,7 @@ vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t * { s = pool_elt_at_index (tsm->sessions, session_index); - send_nat44_user_session_details (s, q, mp->context); + send_nat44_user_session_details (s, reg, mp->context); elt_index = elt->next; elt = pool_elt_at_index (tsm->list_pool, elt_index); @@ -1260,7 +1267,8 @@ static void *vl_api_nat44_add_del_lb_static_mapping_t_print static void send_nat44_lb_static_mapping_details (snat_static_mapping_t * m, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, + u32 context) { vl_api_nat44_lb_static_mapping_details_t *rmp; snat_main_t *sm = &snat_main; @@ -1292,26 +1300,26 @@ send_nat44_lb_static_mapping_details (snat_static_mapping_t * m, rmp->local_num++; } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat44_lb_static_mapping_dump_t_handler (vl_api_nat44_lb_static_mapping_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_static_mapping_t *m; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach (m, sm->static_mappings, ({ if (vec_len(m->locals)) - send_nat44_lb_static_mapping_details (m, q, mp->context); + send_nat44_lb_static_mapping_details (m, reg, mp->context); })); /* *INDENT-ON* */ } @@ -1390,12 +1398,12 @@ static void vl_api_nat44_forwarding_is_enabled_t_handler (vl_api_nat44_forwarding_is_enabled_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; vl_api_nat44_forwarding_is_enabled_reply_t *rmp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -1406,7 +1414,7 @@ static void rmp->enabled = sm->forwarding_enabled; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void *vl_api_nat44_forwarding_is_enabled_t_print @@ -1555,7 +1563,8 @@ vl_api_nat_det_reverse_t_print (vl_api_nat_det_reverse_t * mp, void *handle) } static void -sent_nat_det_map_details (snat_det_map_t * m, svm_queue_t * q, u32 context) +sent_nat_det_map_details (snat_det_map_t * m, vl_api_registration_t * reg, + u32 context) { vl_api_nat_det_map_details_t *rmp; snat_main_t *sm = &snat_main; @@ -1573,23 +1582,23 @@ sent_nat_det_map_details (snat_det_map_t * m, svm_queue_t * q, u32 context) rmp->ses_num = htonl (m->ses_num); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat_det_map_dump_t_handler (vl_api_nat_det_map_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; snat_det_map_t *m; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ vec_foreach(m, sm->det_maps) - sent_nat_det_map_details(m, q, mp->context); + sent_nat_det_map_details(m, reg, mp->context); /* *INDENT-ON* */ } @@ -1770,7 +1779,7 @@ vl_api_nat_det_close_session_in_t_print (vl_api_nat_det_close_session_in_t * static void send_nat_det_session_details (snat_det_session_t * s, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_nat_det_session_details_t *rmp; snat_main_t *sm = &snat_main; @@ -1786,21 +1795,21 @@ send_nat_det_session_details (snat_det_session_t * s, rmp->expire = ntohl (s->expire); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; snat_main_t *sm = &snat_main; ip4_address_t user_addr; snat_det_map_t *dm; snat_det_session_t *s, empty_ses; u16 i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; if (!mp->is_nat44) return; @@ -1815,7 +1824,7 @@ vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp) for (i = 0; i < SNAT_DET_SES_PER_USER; i++) { if (s->out.as_u64) - send_nat_det_session_details (s, q, mp->context); + send_nat_det_session_details (s, reg, mp->context); s++; } } @@ -1888,7 +1897,7 @@ static void *vl_api_nat64_add_del_pool_addr_range_t_print typedef struct nat64_api_walk_ctx_t_ { - svm_queue_t *q; + vl_api_registration_t *reg; u32 context; nat64_db_t *db; } nat64_api_walk_ctx_t; @@ -1915,7 +1924,7 @@ nat64_api_pool_walk (snat_address_t * a, void *arg) rmp->vrf_id = ~0; rmp->context = ctx->context; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->reg, (u8 *) rmp); return 0; } @@ -1923,14 +1932,14 @@ nat64_api_pool_walk (snat_address_t * a, void *arg) static void vl_api_nat64_pool_addr_dump_t_handler (vl_api_nat64_pool_addr_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; nat64_api_walk_ctx_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; @@ -1997,7 +2006,7 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg) nat_interface_is_inside (i); rmp->context = ctx->context; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->reg, (u8 *) rmp); return 0; } @@ -2005,14 +2014,14 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg) static void vl_api_nat64_interface_dump_t_handler (vl_api_nat64_interface_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; nat64_api_walk_ctx_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; @@ -2095,7 +2104,7 @@ nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg) rmp->is_static = bibe->is_static; rmp->ses_num = ntohl (bibe->ses_num); - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->reg, (u8 *) rmp); return 0; } @@ -2103,16 +2112,16 @@ nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg) static void vl_api_nat64_bib_dump_t_handler (vl_api_nat64_bib_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; nat64_main_t *nm = &nat64_main; nat64_db_t *db; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; nat64_api_walk_ctx_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; @@ -2228,7 +2237,7 @@ nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg) rmp->vrf_id = ntohl (fib->ft_table_id); rmp->proto = ste->proto; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->reg, (u8 *) rmp); return 0; } @@ -2236,16 +2245,16 @@ nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg) static void vl_api_nat64_st_dump_t_handler (vl_api_nat64_st_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; nat64_main_t *nm = &nat64_main; nat64_db_t *db; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; nat64_api_walk_ctx_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; @@ -2312,7 +2321,7 @@ nat64_api_prefix_walk (nat64_prefix_t * p, void *arg) rmp->vrf_id = ntohl (p->vrf_id); rmp->context = ctx->context; - vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); + vl_api_send_msg (ctx->reg, (u8 *) rmp); return 0; } @@ -2320,14 +2329,14 @@ nat64_api_prefix_walk (nat64_prefix_t * p, void *arg) static void vl_api_nat64_prefix_dump_t_handler (vl_api_nat64_prefix_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; nat64_api_walk_ctx_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; diff --git a/src/plugins/pppoe/pppoe_api.c b/src/plugins/pppoe/pppoe_api.c index f8a02279cc9..4c65ec4ebd6 100644 --- a/src/plugins/pppoe/pppoe_api.c +++ b/src/plugins/pppoe/pppoe_api.c @@ -118,7 +118,7 @@ out: } static void send_pppoe_session_details - (pppoe_session_t * t, svm_queue_t * q, u32 context) + (pppoe_session_t * t, vl_api_registration_t * reg, u32 context) { vl_api_pppoe_session_details_t *rmp; ip4_main_t *im4 = &ip4_main; @@ -146,22 +146,20 @@ static void send_pppoe_session_details rmp->is_ipv6 = is_ipv6; rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_pppoe_session_dump_t_handler (vl_api_pppoe_session_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; pppoe_main_t *pem = &pppoe_main; pppoe_session_t *t; u32 sw_if_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; sw_if_index = ntohl (mp->sw_if_index); @@ -170,7 +168,7 @@ vl_api_pppoe_session_dump_t_handler (vl_api_pppoe_session_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (t, pem->sessions, ({ - send_pppoe_session_details(t, q, mp->context); + send_pppoe_session_details(t, reg, mp->context); })); /* *INDENT-ON* */ } @@ -182,7 +180,7 @@ vl_api_pppoe_session_dump_t_handler (vl_api_pppoe_session_dump_t * mp) return; } t = &pem->sessions[pem->session_index_by_sw_if_index[sw_if_index]]; - send_pppoe_session_details (t, q, mp->context); + send_pppoe_session_details (t, reg, mp->context); } } diff --git a/src/vlibmemory/vlib_api.c b/src/vlibmemory/vlib_api.c index 9465cfc30d6..1067bf3b4ba 100644 --- a/src/vlibmemory/vlib_api.c +++ b/src/vlibmemory/vlib_api.c @@ -134,13 +134,13 @@ vl_api_api_versions_t_handler (vl_api_api_versions_t * mp) { api_main_t *am = &api_main; vl_api_api_versions_reply_t *rmp; - svm_queue_t *q; + vl_api_registration_t *reg; u32 nmsg = vec_len (am->api_version_list); int msg_size = sizeof (*rmp) + sizeof (rmp->api_versions[0]) * nmsg; int i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (msg_size); @@ -160,7 +160,7 @@ vl_api_api_versions_t_handler (vl_api_api_versions_t * mp) strncpy ((char *) rmp->api_versions[i].name, vl->name, 64 - 1); } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } #define foreach_vlib_api_msg \ diff --git a/src/vnet/bfd/bfd_api.c b/src/vnet/bfd/bfd_api.c index 0d5d1239626..48fcdefd91f 100644 --- a/src/vnet/bfd/bfd_api.c +++ b/src/vnet/bfd/bfd_api.c @@ -140,7 +140,7 @@ vl_api_bfd_udp_del_t_handler (vl_api_bfd_udp_del_t * mp) } void -send_bfd_udp_session_details (svm_queue_t * q, u32 context, +send_bfd_udp_session_details (vl_api_registration_t * reg, u32 context, bfd_session_t * bs) { if (bs->transport != BFD_TRANSPORT_UDP4 && @@ -191,7 +191,7 @@ send_bfd_udp_session_details (svm_queue_t * q, u32 context, clib_host_to_net_u32 (bs->config_required_min_rx_usec); mp->desired_min_tx = clib_host_to_net_u32 (bs->config_desired_min_tx_usec); mp->detect_mult = bs->local_detect_mult; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } void @@ -199,41 +199,40 @@ bfd_event (bfd_main_t * bm, bfd_session_t * bs) { vpe_api_main_t *vam = &vpe_api_main; vpe_client_registration_t *reg; - svm_queue_t *q; + vl_api_registration_t *vl_reg; /* *INDENT-OFF* */ pool_foreach (reg, vam->bfd_events_registrations, ({ - q = vl_api_client_index_to_input_queue (reg->client_index); - if (q) - { - switch (bs->transport) - { - case BFD_TRANSPORT_UDP4: - /* fallthrough */ - case BFD_TRANSPORT_UDP6: - send_bfd_udp_session_details (q, 0, bs); - } - } - })); + vl_reg = vl_api_client_index_to_registration (reg->client_index); + if (vl_reg) + { + switch (bs->transport) + { + case BFD_TRANSPORT_UDP4: + /* fallthrough */ + case BFD_TRANSPORT_UDP6: + send_bfd_udp_session_details (vl_reg, 0, bs); + } + } + })); /* *INDENT-ON* */ } static void vl_api_bfd_udp_session_dump_t_handler (vl_api_bfd_udp_session_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; bfd_session_t *bs = NULL; /* *INDENT-OFF* */ pool_foreach (bs, bfd_main.sessions, ({ - if (bs->transport == BFD_TRANSPORT_UDP4 || - bs->transport == BFD_TRANSPORT_UDP6) - send_bfd_udp_session_details (q, mp->context, bs); - })); + if (bs->transport == BFD_TRANSPORT_UDP4 || + bs->transport == BFD_TRANSPORT_UDP6) + send_bfd_udp_session_details (reg, mp->context, bs); + })); /* *INDENT-ON* */ } @@ -274,11 +273,10 @@ vl_api_bfd_auth_del_key_t_handler (vl_api_bfd_auth_del_key_t * mp) static void vl_api_bfd_auth_keys_dump_t_handler (vl_api_bfd_auth_keys_dump_t * mp) { - svm_queue_t *q; - - q = vl_api_client_index_to_input_queue (mp->client_index); + vl_api_registration_t *reg; - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; bfd_auth_key_t *key = NULL; @@ -286,15 +284,15 @@ vl_api_bfd_auth_keys_dump_t_handler (vl_api_bfd_auth_keys_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (key, bfd_main.auth_keys, ({ - rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_BFD_AUTH_KEYS_DETAILS); - rmp->context = mp->context; - rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id); - rmp->auth_type = key->auth_type; - rmp->use_count = clib_host_to_net_u32 (key->use_count); - vl_msg_api_send_shmem (q, (u8 *)&rmp); - })); + rmp = vl_msg_api_alloc (sizeof (*rmp)); + memset (rmp, 0, sizeof (*rmp)); + rmp->_vl_msg_id = ntohs (VL_API_BFD_AUTH_KEYS_DETAILS); + rmp->context = mp->context; + rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id); + rmp->auth_type = key->auth_type; + rmp->use_count = clib_host_to_net_u32 (key->use_count); + vl_api_send_msg (reg, (u8 *)&rmp); + })); /* *INDENT-ON* */ } diff --git a/src/vnet/bier/bier_api.c b/src/vnet/bier/bier_api.c index f4d37321c53..840c33b7a37 100644 --- a/src/vnet/bier/bier_api.c +++ b/src/vnet/bier/bier_api.c @@ -106,7 +106,7 @@ vl_api_bier_table_add_del_t_handler (vl_api_bier_table_add_del_t * mp) } static void -send_bier_table_details (svm_queue_t * q, +send_bier_table_details (vl_api_registration_t * reg, u32 context, const bier_table_t *bt) { @@ -124,18 +124,18 @@ send_bier_table_details (svm_queue_t * q, mp->bt_tbl_id.bt_sub_domain = bt->bt_id.bti_sub_domain; mp->bt_tbl_id.bt_hdr_len_id = bt->bt_id.bti_hdr_len; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_bier_table_dump_t_handler (vl_api_bier_table_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; bier_table_t *bt; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; pool_foreach(bt, bier_table_pool, ({ @@ -144,7 +144,7 @@ vl_api_bier_table_dump_t_handler (vl_api_bier_table_dump_t * mp) */ if (bier_table_is_main(bt)) { - send_bier_table_details(q, mp->context, bt); + send_bier_table_details(reg, mp->context, bt); } })); } @@ -252,7 +252,7 @@ done: typedef struct bier_route_details_walk_t_ { - svm_queue_t * q; + vl_api_registration_t * reg; u32 context; } bier_route_details_walk_t; @@ -296,17 +296,17 @@ send_bier_route_details (const bier_table_t *bt, fp++; } - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->reg, (u8 *) mp); } static void vl_api_bier_route_dump_t_handler (vl_api_bier_route_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; bier_table_id_t bti = { .bti_set = mp->br_tbl_id.bt_set, @@ -316,7 +316,7 @@ vl_api_bier_route_dump_t_handler (vl_api_bier_route_dump_t * mp) .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN, }; bier_route_details_walk_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; bier_table_walk(&bti, send_bier_route_details, &ctx); @@ -371,7 +371,7 @@ vl_api_bier_imp_del_t_handler (vl_api_bier_imp_del_t * mp) } static void -send_bier_imp_details (svm_queue_t * q, +send_bier_imp_details (vl_api_registration_t * reg, u32 context, const bier_imp_t *bi) { @@ -400,22 +400,22 @@ send_bier_imp_details (svm_queue_t * q, mp->bi_n_bytes = n_bytes; memcpy(mp->bi_bytes, bi->bi_bits.bits, n_bytes); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_bier_imp_dump_t_handler (vl_api_bier_imp_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; bier_imp_t *bi; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; pool_foreach(bi, bier_imp_pool, ({ - send_bier_imp_details(q, mp->context, bi); + send_bier_imp_details(reg, mp->context, bi); })); } @@ -446,7 +446,7 @@ vl_api_bier_disp_table_add_del_t_handler (vl_api_bier_disp_table_add_del_t * mp) } static void -send_bier_disp_table_details (svm_queue_t * q, +send_bier_disp_table_details (vl_api_registration_t * reg, u32 context, const bier_disp_table_t *bdt) { @@ -461,22 +461,22 @@ send_bier_disp_table_details (svm_queue_t * q, mp->bdt_tbl_id = htonl(bdt->bdt_table_id); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_bier_disp_table_dump_t_handler (vl_api_bier_disp_table_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; bier_disp_table_t *bdt; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; pool_foreach(bdt, bier_disp_table_pool, ({ - send_bier_disp_table_details(q, mp->context, bdt); + send_bier_disp_table_details(reg, mp->context, bdt); })); } @@ -603,7 +603,7 @@ done: typedef struct bier_disp_entry_details_walk_t_ { - svm_queue_t * q; + vl_api_registration_t * reg; u32 context; } bier_disp_entry_details_walk_t; @@ -653,7 +653,7 @@ send_bier_disp_entry_details (const bier_disp_table_t *bdt, fp++; } - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->reg, (u8 *) mp); } } } @@ -661,14 +661,14 @@ send_bier_disp_entry_details (const bier_disp_table_t *bdt, static void vl_api_bier_disp_entry_dump_t_handler (vl_api_bier_disp_entry_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; bier_disp_entry_details_walk_t ctx = { - .q = q, + .reg = reg, .context = mp->context, }; bier_disp_table_walk(ntohl(mp->bde_tbl_id), diff --git a/src/vnet/classify/classify_api.c b/src/vnet/classify/classify_api.c index 94340f8729a..1893f6e7191 100644 --- a/src/vnet/classify/classify_api.c +++ b/src/vnet/classify/classify_api.c @@ -182,7 +182,8 @@ static void static void send_policer_classify_details (u32 sw_if_index, - u32 table_index, svm_queue_t * q, u32 context) + u32 table_index, vl_api_registration_t * reg, + u32 context) { vl_api_policer_classify_details_t *mp; @@ -193,19 +194,19 @@ send_policer_classify_details (u32 sw_if_index, mp->sw_if_index = htonl (sw_if_index); mp->table_index = htonl (table_index); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_policer_classify_dump_t_handler (vl_api_policer_classify_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; policer_classify_main_t *pcm = &policer_classify_main; u32 *vec_tbl; int i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type]; @@ -217,7 +218,7 @@ vl_api_policer_classify_dump_t_handler (vl_api_policer_classify_dump_t * mp) if (vec_elt (vec_tbl, i) == ~0) continue; - send_policer_classify_details (i, vec_elt (vec_tbl, i), q, + send_policer_classify_details (i, vec_elt (vec_tbl, i), reg, mp->context); } } @@ -226,10 +227,10 @@ vl_api_policer_classify_dump_t_handler (vl_api_policer_classify_dump_t * mp) static void vl_api_classify_table_ids_t_handler (vl_api_classify_table_ids_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; vnet_classify_main_t *cm = &vnet_classify_main; @@ -253,7 +254,7 @@ vl_api_classify_table_ids_t_handler (vl_api_classify_table_ids_t * mp) clib_memcpy (rmp->ids, table_ids, count * sizeof (u32)); rmp->retval = 0; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); vec_free (table_ids); } @@ -311,10 +312,10 @@ static void static void vl_api_classify_table_info_t_handler (vl_api_classify_table_info_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; vl_api_classify_table_info_reply_t *rmp = 0; @@ -355,11 +356,11 @@ vl_api_classify_table_info_t_handler (vl_api_classify_table_info_t * mp) rmp->retval = ntohl (VNET_API_ERROR_CLASSIFY_TABLE_NOT_FOUND); } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void -send_classify_session_details (svm_queue_t * q, +send_classify_session_details (vl_api_registration_t * reg, u32 table_id, u32 match_length, vnet_classify_entry_t * e, u32 context) @@ -377,20 +378,20 @@ send_classify_session_details (svm_queue_t * q, rmp->match_length = ntohl (match_length); clib_memcpy (rmp->match, e->key, match_length); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_classify_session_dump_t_handler (vl_api_classify_session_dump_t * mp) { vnet_classify_main_t *cm = &vnet_classify_main; - svm_queue_t *q; + vl_api_registration_t *reg; u32 table_id = ntohl (mp->table_id); vnet_classify_table_t *t; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ @@ -419,7 +420,7 @@ vl_api_classify_session_dump_t_handler (vl_api_classify_session_dump_t * mp) continue; send_classify_session_details - (q, table_id, t->match_n_vectors * sizeof (u32x4), + (reg, table_id, t->match_n_vectors * sizeof (u32x4), v, mp->context); } } @@ -455,7 +456,8 @@ static void static void send_flow_classify_details (u32 sw_if_index, - u32 table_index, svm_queue_t * q, u32 context) + u32 table_index, vl_api_registration_t * reg, + u32 context) { vl_api_flow_classify_details_t *mp; @@ -466,19 +468,19 @@ send_flow_classify_details (u32 sw_if_index, mp->sw_if_index = htonl (sw_if_index); mp->table_index = htonl (table_index); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_flow_classify_dump_t_handler (vl_api_flow_classify_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; flow_classify_main_t *pcm = &flow_classify_main; u32 *vec_tbl; int i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type]; @@ -490,7 +492,7 @@ vl_api_flow_classify_dump_t_handler (vl_api_flow_classify_dump_t * mp) if (vec_elt (vec_tbl, i) == ~0) continue; - send_flow_classify_details (i, vec_elt (vec_tbl, i), q, + send_flow_classify_details (i, vec_elt (vec_tbl, i), reg, mp->context); } } diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c index e161ed6c397..9f46884ca8c 100644 --- a/src/vnet/devices/tap/tapv2_api.c +++ b/src/vnet/devices/tap/tapv2_api.c @@ -54,7 +54,7 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp) { vlib_main_t *vm = vlib_get_main (); vl_api_tap_create_v2_reply_t *rmp; - svm_queue_t *q; + vl_api_registration_t *reg; tap_create_if_args_t _a, *ap = &_a; memset (ap, 0, sizeof (*ap)); @@ -98,9 +98,9 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp) tap_create_if (vm, ap); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return;; rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_TAP_CREATE_V2_REPLY); @@ -108,12 +108,13 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp) rmp->retval = ntohl (ap->rv); rmp->sw_if_index = ntohl (ap->sw_if_index); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void tap_send_sw_interface_event_deleted (vpe_api_main_t * am, - svm_queue_t * q, u32 sw_if_index) + vl_api_registration_t * reg, + u32 sw_if_index) { vl_api_sw_interface_event_t *mp; @@ -125,7 +126,7 @@ tap_send_sw_interface_event_deleted (vpe_api_main_t * am, mp->admin_up_down = 0; mp->link_up_down = 0; mp->deleted = 1; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -135,13 +136,13 @@ vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp) int rv; vpe_api_main_t *vam = &vpe_api_main; vl_api_tap_delete_v2_reply_t *rmp; - svm_queue_t *q; + vl_api_registration_t *reg; u32 sw_if_index = ntohl (mp->sw_if_index); rv = tap_delete_if (vm, sw_if_index); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -149,15 +150,15 @@ vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp) rmp->context = mp->context; rmp->retval = ntohl (rv); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); if (!rv) - tap_send_sw_interface_event_deleted (vam, q, sw_if_index); + tap_send_sw_interface_event_deleted (vam, reg, sw_if_index); } static void tap_send_sw_interface_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, tap_interface_details_t * tap_if, u32 context) { vl_api_sw_interface_tap_v2_details_t *mp; @@ -189,7 +190,7 @@ tap_send_sw_interface_details (vpe_api_main_t * am, mp->host_ip6_prefix_len = tap_if->host_ip6_prefix_len; mp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -198,12 +199,12 @@ vl_api_sw_interface_tap_v2_dump_t_handler (vl_api_sw_interface_tap_v2_dump_t * { int rv; vpe_api_main_t *am = &vpe_api_main; - svm_queue_t *q; + vl_api_registration_t *reg; tap_interface_details_t *tapifs = NULL; tap_interface_details_t *tap_if = NULL; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rv = tap_dump_ifs (&tapifs); @@ -212,7 +213,7 @@ vl_api_sw_interface_tap_v2_dump_t_handler (vl_api_sw_interface_tap_v2_dump_t * vec_foreach (tap_if, tapifs) { - tap_send_sw_interface_details (am, q, tap_if, mp->context); + tap_send_sw_interface_details (am, reg, tap_if, mp->context); } vec_free (tapifs); diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c index 9ddd3387a72..442d9146945 100644 --- a/src/vnet/devices/virtio/vhost_user_api.c +++ b/src/vnet/devices/virtio/vhost_user_api.c @@ -53,7 +53,7 @@ _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) */ static void send_sw_interface_event_deleted (vpe_api_main_t * am, - svm_queue_t * q, u32 sw_if_index) + vl_api_registration_t * reg, u32 sw_if_index) { vl_api_sw_interface_event_t *mp; @@ -65,7 +65,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am, mp->admin_up_down = 0; mp->link_up_down = 0; mp->deleted = 1; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -127,6 +127,7 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp) vl_api_delete_vhost_user_if_reply_t *rmp; vpe_api_main_t *vam = &vpe_api_main; u32 sw_if_index = ntohl (mp->sw_if_index); + vl_api_registration_t *reg; vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); @@ -136,18 +137,18 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp) REPLY_MACRO (VL_API_DELETE_VHOST_USER_IF_REPLY); if (!rv) { - svm_queue_t *q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; vnet_clear_sw_interface_tag (vnm, sw_if_index); - send_sw_interface_event_deleted (vam, q, sw_if_index); + send_sw_interface_event_deleted (vam, reg, sw_if_index); } } static void send_sw_interface_vhost_user_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, vhost_user_intf_details_t * vui, u32 context) { @@ -169,7 +170,7 @@ send_sw_interface_vhost_user_details (vpe_api_main_t * am, strncpy ((char *) mp->interface_name, (char *) vui->if_name, ARRAY_LEN (mp->interface_name) - 1); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -182,10 +183,10 @@ static void vlib_main_t *vm = vlib_get_main (); vhost_user_intf_details_t *ifaces = NULL; vhost_user_intf_details_t *vuid = NULL; - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rv = vhost_user_dump_ifs (vnm, vm, &ifaces); @@ -194,7 +195,7 @@ static void vec_foreach (vuid, ifaces) { - send_sw_interface_vhost_user_details (am, q, vuid, mp->context); + send_sw_interface_vhost_user_details (am, reg, vuid, mp->context); } vec_free (ifaces); } diff --git a/src/vnet/dhcp/dhcp_api.c b/src/vnet/dhcp/dhcp_api.c index 24411af9b5c..8e210cdd5b0 100644 --- a/src/vnet/dhcp/dhcp_api.c +++ b/src/vnet/dhcp/dhcp_api.c @@ -110,14 +110,14 @@ static void vl_api_dhcp_proxy_config_t_handler static void vl_api_dhcp_proxy_dump_t_handler (vl_api_dhcp_proxy_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return;; dhcp_proxy_dump ((mp->is_ip6 == 1 ? - FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4), q, mp->context); + FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4), reg, mp->context); } void @@ -125,7 +125,7 @@ dhcp_send_details (fib_protocol_t proto, void *opaque, u32 context, dhcp_proxy_t * proxy) { vl_api_dhcp_proxy_details_t *mp; - svm_queue_t *q = opaque; + vl_api_registration_t *reg = opaque; vl_api_dhcp_server_t *v_server; dhcp_server_t *server; fib_table_t *s_fib; @@ -200,7 +200,7 @@ dhcp_send_details (fib_protocol_t proto, /* put the address in the first bytes */ memcpy (mp->dhcp_src_address, &proxy->dhcp_src_address.ip4, 4); } - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } void @@ -208,12 +208,12 @@ dhcp_compl_event_callback (u32 client_index, u32 pid, u8 * hostname, u8 mask_width, u8 is_ipv6, u8 * host_address, u8 * router_address, u8 * host_mac) { - svm_queue_t *q; + vl_api_registration_t *reg; vl_api_dhcp_compl_event_t *mp; u32 len; - q = vl_api_client_index_to_input_queue (client_index); - if (!q) + reg = vl_api_client_index_to_registration (client_index); + if (!reg) return; mp = vl_msg_api_alloc (sizeof (*mp)); @@ -232,7 +232,7 @@ dhcp_compl_event_callback (u32 client_index, u32 pid, u8 * hostname, mp->_vl_msg_id = ntohs (VL_API_DHCP_COMPL_EVENT); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_dhcp_client_config_t_handler diff --git a/src/vnet/flow/flow_api.c b/src/vnet/flow/flow_api.c index 4aa025314f7..d1eb2c008c5 100644 --- a/src/vnet/flow/flow_api.c +++ b/src/vnet/flow/flow_api.c @@ -148,14 +148,14 @@ static void vl_api_ipfix_exporter_dump_t_handler (vl_api_ipfix_exporter_dump_t * mp) { flow_report_main_t *frm = &flow_report_main; - svm_queue_t *q; + vl_api_registration_t *reg; vl_api_ipfix_exporter_details_t *rmp; ip4_main_t *im = &ip4_main; u32 vrf_id; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return;; rmp = vl_msg_api_alloc (sizeof (*rmp)); memset (rmp, 0, sizeof (*rmp)); @@ -175,7 +175,7 @@ vl_api_ipfix_exporter_dump_t_handler (vl_api_ipfix_exporter_dump_t * mp) rmp->template_interval = htonl (frm->template_interval); rmp->udp_checksum = (frm->udp_checksum != 0); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -211,11 +211,11 @@ static void (vl_api_ipfix_classify_stream_dump_t * mp) { flow_report_classify_main_t *fcm = &flow_report_classify_main; - svm_queue_t *q; + vl_api_registration_t *reg; vl_api_ipfix_classify_stream_details_t *rmp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -225,7 +225,7 @@ static void rmp->domain_id = htonl (fcm->domain_id); rmp->src_port = htons (fcm->src_port); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -308,7 +308,7 @@ out: static void send_ipfix_classify_table_details (u32 table_index, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { flow_report_classify_main_t *fcm = &flow_report_classify_main; vl_api_ipfix_classify_table_details_t *mp; @@ -323,7 +323,7 @@ send_ipfix_classify_table_details (u32 table_index, mp->ip_version = table->ip_version; mp->transport_protocol = table->transport_protocol; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -331,16 +331,16 @@ static void (vl_api_ipfix_classify_table_dump_t * mp) { flow_report_classify_main_t *fcm = &flow_report_classify_main; - svm_queue_t *q; + vl_api_registration_t *reg; u32 i; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; for (i = 0; i < vec_len (fcm->tables); i++) if (ipfix_classify_table_index_valid (i)) - send_ipfix_classify_table_details (i, q, mp->context); + send_ipfix_classify_table_details (i, reg, mp->context); } /* diff --git a/src/vnet/geneve/geneve_api.c b/src/vnet/geneve/geneve_api.c index 2708d15f99e..9d0830c1ce5 100644 --- a/src/vnet/geneve/geneve_api.c +++ b/src/vnet/geneve/geneve_api.c @@ -113,7 +113,7 @@ out: } static void send_geneve_tunnel_details - (geneve_tunnel_t * t, svm_queue_t * q, u32 context) + (geneve_tunnel_t * t, vl_api_registration_t * reg, u32 context) { vl_api_geneve_tunnel_details_t *rmp; ip4_main_t *im4 = &ip4_main; @@ -142,22 +142,20 @@ static void send_geneve_tunnel_details rmp->is_ipv6 = is_ipv6; rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_geneve_tunnel_dump_t_handler (vl_api_geneve_tunnel_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; geneve_main_t *vxm = &geneve_main; geneve_tunnel_t *t; u32 sw_if_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; sw_if_index = ntohl (mp->sw_if_index); @@ -166,7 +164,7 @@ static void vl_api_geneve_tunnel_dump_t_handler /* *INDENT-OFF* */ pool_foreach (t, vxm->tunnels, ({ - send_geneve_tunnel_details(t, q, mp->context); + send_geneve_tunnel_details(t, reg, mp->context); })); /* *INDENT-ON* */ } @@ -178,7 +176,7 @@ static void vl_api_geneve_tunnel_dump_t_handler return; } t = &vxm->tunnels[vxm->tunnel_index_by_sw_if_index[sw_if_index]]; - send_geneve_tunnel_details (t, q, mp->context); + send_geneve_tunnel_details (t, reg, mp->context); } } diff --git a/src/vnet/gre/gre_api.c b/src/vnet/gre/gre_api.c index baccc5fa601..4dad6147fcf 100644 --- a/src/vnet/gre/gre_api.c +++ b/src/vnet/gre/gre_api.c @@ -94,7 +94,7 @@ out: } static void send_gre_tunnel_details - (gre_tunnel_t * t, svm_queue_t * q, u32 context) + (gre_tunnel_t * t, vl_api_registration_t * reg, u32 context) { vl_api_gre_tunnel_details_t *rmp; u8 is_ipv6 = t->tunnel_dst.fp_proto == FIB_PROTOCOL_IP6 ? 1 : 0; @@ -122,22 +122,20 @@ static void send_gre_tunnel_details rmp->context = context; rmp->is_ipv6 = is_ipv6; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_gre_tunnel_dump_t_handler (vl_api_gre_tunnel_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; gre_main_t *gm = &gre_main; gre_tunnel_t *t; u32 sw_if_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; sw_if_index = ntohl (mp->sw_if_index); @@ -146,7 +144,7 @@ vl_api_gre_tunnel_dump_t_handler (vl_api_gre_tunnel_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (t, gm->tunnels, ({ - send_gre_tunnel_details(t, q, mp->context); + send_gre_tunnel_details(t, reg, mp->context); })); /* *INDENT-ON* */ } @@ -158,7 +156,7 @@ vl_api_gre_tunnel_dump_t_handler (vl_api_gre_tunnel_dump_t * mp) return; } t = &gm->tunnels[gm->tunnel_index_by_sw_if_index[sw_if_index]]; - send_gre_tunnel_details (t, q, mp->context); + send_gre_tunnel_details (t, reg, mp->context); } } diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c index d3f170ff94b..0541f311bc2 100644 --- a/src/vnet/interface_api.c +++ b/src/vnet/interface_api.c @@ -529,7 +529,7 @@ ip_table_bind (fib_protocol_t fproto, } static void -send_sw_interface_get_table_reply (svm_queue_t * q, +send_sw_interface_get_table_reply (vl_api_registration_t * reg, u32 context, int retval, u32 vrf_id) { vl_api_sw_interface_get_table_reply_t *mp; @@ -541,13 +541,13 @@ send_sw_interface_get_table_reply (svm_queue_t * q, mp->retval = htonl (retval); mp->vrf_id = htonl (vrf_id); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_sw_interface_get_table_t_handler (vl_api_sw_interface_get_table_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; fib_table_t *fib_table = 0; u32 sw_if_index = ~0; u32 fib_index = ~0; @@ -555,8 +555,8 @@ vl_api_sw_interface_get_table_t_handler (vl_api_sw_interface_get_table_t * mp) fib_protocol_t fib_proto = FIB_PROTOCOL_IP4; int rv = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; VALIDATE_SW_IF_INDEX (mp); @@ -575,7 +575,7 @@ vl_api_sw_interface_get_table_t_handler (vl_api_sw_interface_get_table_t * mp) BAD_SW_IF_INDEX_LABEL; - send_sw_interface_get_table_reply (q, mp->context, rv, table_id); + send_sw_interface_get_table_reply (reg, mp->context, rv, table_id); } static void vl_api_sw_interface_set_unnumbered_t_handler @@ -724,7 +724,8 @@ event_data_cmp (void *a1, void *a2) static void send_sw_interface_event (vpe_api_main_t * am, vpe_client_registration_t * reg, - svm_queue_t * q, vnet_sw_interface_t * swif) + vl_api_registration_t * vl_reg, + vnet_sw_interface_t * swif) { vl_api_sw_interface_event_t *mp; vnet_main_t *vnm = am->vnet_main; @@ -740,7 +741,7 @@ send_sw_interface_event (vpe_api_main_t * am, mp->admin_up_down = (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? 1 : 0; mp->link_up_down = (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) ? 1 : 0; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (vl_reg, (u8 *) mp); } static uword @@ -754,7 +755,7 @@ link_state_process (vlib_main_t * vm, vpe_client_registration_t *reg; int i; u32 prev_sw_if_index; - svm_queue_t *q; + vl_api_registration_t *vl_reg; vam->link_state_process_up = 1; @@ -783,15 +784,15 @@ link_state_process (vlib_main_t * vm, /* *INDENT-OFF* */ pool_foreach(reg, vam->interface_events_registrations, ({ - q = vl_api_client_index_to_input_queue (reg->client_index); - if (q) + vl_reg = vl_api_client_index_to_registration (reg->client_index); + if (vl_reg) { /* sw_interface may be deleted already */ if (!pool_is_free_index (vnm->interface_main.sw_interfaces, event_data[i])) { swif = vnet_get_sw_interface (vnm, event_data[i]); - send_sw_interface_event (vam, reg, q, swif); + send_sw_interface_event (vam, reg, vl_reg, swif); } } })); @@ -948,7 +949,7 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp) uword *p; vnet_interface_main_t *im = &vnm->interface_main; u64 sup_and_sub_key; - svm_queue_t *q; + vl_api_registration_t *reg; clib_error_t *error; VALIDATE_SW_IF_INDEX (mp); @@ -1003,8 +1004,8 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp) BAD_SW_IF_INDEX_LABEL; out: - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -1012,7 +1013,7 @@ out: rmp->context = mp->context; rmp->retval = htonl (rv); rmp->sw_if_index = htonl (sw_if_index); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c index d0982e94f9e..2ea1e411764 100644 --- a/src/vnet/ip/ip_api.c +++ b/src/vnet/ip/ip_api.c @@ -107,7 +107,8 @@ send_ip_neighbor_details (u32 sw_if_index, u8 is_ipv6, u8 is_static, u8 * mac_address, - u8 * ip_address, svm_queue_t * q, u32 context) + u8 * ip_address, vl_api_registration_t * reg, + u32 context) { vl_api_ip_neighbor_details_t *mp; @@ -121,16 +122,16 @@ send_ip_neighbor_details (u32 sw_if_index, memcpy (mp->mac_address, mac_address, 6); memcpy (mp->ip_address, ip_address, (is_ipv6) ? 16 : 4); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_ip_neighbor_dump_t_handler (vl_api_ip_neighbor_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; u32 sw_if_index = ntohl (mp->sw_if_index); @@ -148,7 +149,7 @@ vl_api_ip_neighbor_dump_t_handler (vl_api_ip_neighbor_dump_t * mp) ((n->flags & IP6_NEIGHBOR_FLAG_STATIC) ? 1 : 0), (u8 *) n->link_layer_address, (u8 *) & (n->key.ip6_address.as_u8), - q, mp->context); + reg, mp->context); } /* *INDENT-ON* */ vec_free (ns); @@ -165,7 +166,7 @@ vl_api_ip_neighbor_dump_t_handler (vl_api_ip_neighbor_dump_t * mp) ((n->flags & ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC) ? 1 : 0), (u8*) n->ethernet_address, (u8*) & (n->ip4_address.as_u8), - q, mp->context); + reg, mp->context); } /* *INDENT-ON* */ vec_free (ns); @@ -201,7 +202,7 @@ copy_fib_next_hop (fib_route_path_encode_t * api_rpath, void *fp_arg) static void send_ip_fib_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, const fib_table_t * table, const fib_prefix_t * pfx, fib_route_path_encode_t * api_rpaths, u32 context) @@ -264,7 +265,7 @@ send_ip_fib_details (vpe_api_main_t * am, fp++; } - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } typedef struct vl_api_ip_fib_dump_walk_ctx_t_ @@ -286,7 +287,7 @@ static void vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp) { vpe_api_main_t *am = &vpe_api_main; - svm_queue_t *q; + vl_api_registration_t *reg; ip4_main_t *im = &ip4_main; fib_table_t *fib_table; fib_node_index_t *lfeip; @@ -297,8 +298,8 @@ vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp) .feis = NULL, }; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ @@ -320,7 +321,7 @@ vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp) fib_table = fib_table_get (fib_index, pfx.fp_proto); api_rpaths = NULL; fib_entry_encode (*lfeip, &api_rpaths); - send_ip_fib_details (am, q, fib_table, &pfx, api_rpaths, mp->context); + send_ip_fib_details (am, reg, fib_table, &pfx, api_rpaths, mp->context); vec_free (api_rpaths); } @@ -329,7 +330,7 @@ vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp) static void send_ip6_fib_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, const fib_table_t * table, const fib_prefix_t * pfx, fib_route_path_encode_t * api_rpaths, u32 context) @@ -392,7 +393,7 @@ send_ip6_fib_details (vpe_api_main_t * am, fp++; } - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } typedef struct apt_ip6_fib_show_ctx_t_ @@ -413,7 +414,7 @@ api_ip6_fib_table_put_entries (clib_bihash_kv_24_8_t * kvp, void *arg) } static void -api_ip6_fib_table_get_all (svm_queue_t * q, +api_ip6_fib_table_get_all (vl_api_registration_t * reg, vl_api_ip6_fib_dump_t * mp, fib_table_t * fib_table) { @@ -438,7 +439,7 @@ api_ip6_fib_table_get_all (svm_queue_t * q, fib_entry_get_prefix (*fib_entry_index, &pfx); api_rpaths = NULL; fib_entry_encode (*fib_entry_index, &api_rpaths); - send_ip6_fib_details (am, q, fib_table, &pfx, api_rpaths, mp->context); + send_ip6_fib_details (am, reg, fib_table, &pfx, api_rpaths, mp->context); vec_free (api_rpaths); } @@ -448,24 +449,24 @@ api_ip6_fib_table_get_all (svm_queue_t * q, static void vl_api_ip6_fib_dump_t_handler (vl_api_ip6_fib_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; ip6_main_t *im6 = &ip6_main; fib_table_t *fib_table; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach (fib_table, im6->fibs, ({ - api_ip6_fib_table_get_all(q, mp, fib_table); + api_ip6_fib_table_get_all(reg, mp, fib_table); })); /* *INDENT-ON* */ } static void -send_ip_mfib_details (svm_queue_t * q, +send_ip_mfib_details (vl_api_registration_t * reg, u32 context, u32 table_id, fib_node_index_t mfei) { fib_route_path_encode_t *api_rpath, *api_rpaths = NULL; @@ -509,7 +510,7 @@ send_ip_mfib_details (svm_queue_t * q, } vec_free (api_rpaths); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } typedef struct vl_api_ip_mfib_dump_ctc_t_ @@ -530,7 +531,7 @@ vl_api_ip_mfib_table_dump_walk (fib_node_index_t fei, void *arg) static void vl_api_ip_mfib_dump_t_handler (vl_api_ip_mfib_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; ip4_main_t *im = &ip4_main; mfib_table_t *mfib_table; fib_node_index_t *mfeip; @@ -538,11 +539,10 @@ vl_api_ip_mfib_dump_t_handler (vl_api_ip_mfib_dump_t * mp) .entries = NULL, }; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; - /* *INDENT-OFF* */ pool_foreach (mfib_table, im->mfibs, ({ @@ -554,7 +554,7 @@ vl_api_ip_mfib_dump_t_handler (vl_api_ip_mfib_dump_t * mp) vec_foreach (mfeip, ctx.entries) { - send_ip_mfib_details (q, mp->context, + send_ip_mfib_details (reg, mp->context, mfib_table->mft_table_id, *mfeip); } @@ -568,7 +568,7 @@ vl_api_ip_mfib_dump_t_handler (vl_api_ip_mfib_dump_t * mp) static void send_ip6_mfib_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, u32 table_id, mfib_prefix_t * pfx, fib_route_path_encode_t * api_rpaths, u32 context) @@ -605,7 +605,7 @@ send_ip6_mfib_details (vpe_api_main_t * am, fp++; } - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } typedef struct vl_api_ip6_mfib_dump_ctc_t_ @@ -627,7 +627,7 @@ static void vl_api_ip6_mfib_dump_t_handler (vl_api_ip6_mfib_dump_t * mp) { vpe_api_main_t *am = &vpe_api_main; - svm_queue_t *q; + vl_api_registration_t *reg; ip6_main_t *im = &ip6_main; mfib_table_t *mfib_table; fib_node_index_t *mfeip; @@ -637,8 +637,8 @@ vl_api_ip6_mfib_dump_t_handler (vl_api_ip6_mfib_dump_t * mp) .entries = NULL, }; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; @@ -655,7 +655,7 @@ vl_api_ip6_mfib_dump_t_handler (vl_api_ip6_mfib_dump_t * mp) { mfib_entry_get_prefix (*mfeip, &pfx); mfib_entry_encode (*mfeip, &api_rpaths); - send_ip6_mfib_details (am, q, + send_ip6_mfib_details (am, reg, mfib_table->mft_table_id, &pfx, api_rpaths, mp->context); @@ -1418,7 +1418,8 @@ vl_api_ip_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp) static void send_ip_details (vpe_api_main_t * am, - svm_queue_t * q, u32 sw_if_index, u8 is_ipv6, u32 context) + vl_api_registration_t * reg, u32 sw_if_index, u8 is_ipv6, + u32 context) { vl_api_ip_details_t *mp; @@ -1430,12 +1431,12 @@ send_ip_details (vpe_api_main_t * am, mp->is_ipv6 = is_ipv6; mp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void send_ip_address_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, u8 * ip, u16 prefix_length, u32 sw_if_index, u8 is_ipv6, u32 context) { @@ -1459,14 +1460,14 @@ send_ip_address_details (vpe_api_main_t * am, mp->sw_if_index = htonl (sw_if_index); mp->is_ipv6 = is_ipv6; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_ip_address_dump_t_handler (vl_api_ip_address_dump_t * mp) { vpe_api_main_t *am = &vpe_api_main; - svm_queue_t *q; + vl_api_registration_t *reg; ip6_address_t *r6; ip4_address_t *r4; ip6_main_t *im6 = &ip6_main; @@ -1481,8 +1482,8 @@ vl_api_ip_address_dump_t_handler (vl_api_ip_address_dump_t * mp) sw_if_index = ntohl (mp->sw_if_index); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; if (mp->is_ipv6) @@ -1493,7 +1494,7 @@ vl_api_ip_address_dump_t_handler (vl_api_ip_address_dump_t * mp) ({ r6 = ip_interface_address_get_address (lm6, ia); u16 prefix_length = ia->address_length; - send_ip_address_details(am, q, (u8*)r6, prefix_length, + send_ip_address_details(am, reg, (u8*)r6, prefix_length, sw_if_index, 1, mp->context); })); /* *INDENT-ON* */ @@ -1506,7 +1507,7 @@ vl_api_ip_address_dump_t_handler (vl_api_ip_address_dump_t * mp) ({ r4 = ip_interface_address_get_address (lm4, ia); u16 prefix_length = ia->address_length; - send_ip_address_details(am, q, (u8*)r4, prefix_length, + send_ip_address_details(am, reg, (u8*)r4, prefix_length, sw_if_index, 0, mp->context); })); /* *INDENT-ON* */ @@ -1521,15 +1522,13 @@ vl_api_ip_dump_t_handler (vl_api_ip_dump_t * mp) vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); vnet_interface_main_t *im = &vnm->interface_main; - svm_queue_t *q; + vl_api_registration_t *reg; vnet_sw_interface_t *si, *sorted_sis; u32 sw_if_index = ~0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; /* Gather interfaces. */ sorted_sis = vec_new (vnet_sw_interface_t, pool_elts (im->sw_interfaces)); @@ -1550,7 +1549,7 @@ vl_api_ip_dump_t_handler (vl_api_ip_dump_t * mp) continue; } sw_if_index = si->sw_if_index; - send_ip_details (am, q, sw_if_index, mp->is_ipv6, mp->context); + send_ip_details (am, reg, sw_if_index, mp->is_ipv6, mp->context); } } } @@ -1668,7 +1667,7 @@ static void } static void -send_ip6nd_proxy_details (svm_queue_t * q, +send_ip6nd_proxy_details (vl_api_registration_t * reg, u32 context, const ip46_address_t * addr, u32 sw_if_index) { @@ -1681,7 +1680,7 @@ send_ip6nd_proxy_details (svm_queue_t * q, mp->sw_if_index = htonl (sw_if_index); memcpy (mp->address, addr, 16); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } typedef struct api_ip6nd_proxy_fib_table_walk_ctx_t_ @@ -1712,13 +1711,11 @@ vl_api_ip6nd_proxy_dump_t_handler (vl_api_ip6nd_proxy_dump_t * mp) }; fib_node_index_t *feip; fib_prefix_t pfx; - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; /* *INDENT-OFF* */ pool_foreach (fib_table, im6->fibs, @@ -1736,7 +1733,7 @@ vl_api_ip6nd_proxy_dump_t_handler (vl_api_ip6nd_proxy_dump_t * mp) { fib_entry_get_prefix (*feip, &pfx); - send_ip6nd_proxy_details (q, + send_ip6nd_proxy_details (reg, mp->context, &pfx.fp_addr, fib_entry_get_resolving_interface (*feip)); diff --git a/src/vnet/ip/punt_api.c b/src/vnet/ip/punt_api.c index 33fc3f931a7..55ab838b167 100644 --- a/src/vnet/ip/punt_api.c +++ b/src/vnet/ip/punt_api.c @@ -70,7 +70,7 @@ vl_api_punt_socket_register_t_handler (vl_api_punt_socket_register_t * mp) vlib_main_t *vm = vlib_get_main (); int rv = 0; clib_error_t *error; - svm_queue_t *q; + vl_api_registration_t *reg; error = vnet_punt_socket_add (vm, ntohl (mp->header_version), mp->is_ip4, mp->l4_protocol, @@ -81,8 +81,8 @@ vl_api_punt_socket_register_t_handler (vl_api_punt_socket_register_t * mp) clib_error_report (error); } - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -92,7 +92,7 @@ vl_api_punt_socket_register_t_handler (vl_api_punt_socket_register_t * mp) char *p = vnet_punt_get_server_pathname (); /* Abstract pathnames start with \0 */ memcpy ((char *) rmp->pathname, p, sizeof (rmp->pathname)); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -102,7 +102,7 @@ vl_api_punt_socket_deregister_t_handler (vl_api_punt_socket_deregister_t * mp) vlib_main_t *vm = vlib_get_main (); int rv = 0; clib_error_t *error; - svm_queue_t *q; + vl_api_registration_t *reg; error = vnet_punt_socket_del (vm, mp->is_ip4, mp->l4_protocol, ntohs (mp->l4_port)); @@ -112,15 +112,15 @@ vl_api_punt_socket_deregister_t_handler (vl_api_punt_socket_deregister_t * mp) clib_error_report (error); } - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = htons (VL_API_PUNT_SOCKET_DEREGISTER_REPLY); rmp->context = mp->context; rmp->retval = htonl (rv); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } #define vl_msg_name_crc_list diff --git a/src/vnet/ipsec-gre/ipsec_gre_api.c b/src/vnet/ipsec-gre/ipsec_gre_api.c index af3003004b9..01cc6d75d41 100644 --- a/src/vnet/ipsec-gre/ipsec_gre_api.c +++ b/src/vnet/ipsec-gre/ipsec_gre_api.c @@ -83,7 +83,7 @@ out: } static void send_ipsec_gre_tunnel_details - (ipsec_gre_tunnel_t * t, svm_queue_t * q, u32 context) + (ipsec_gre_tunnel_t * t, vl_api_registration_t * reg, u32 context) { vl_api_ipsec_gre_tunnel_details_t *rmp; @@ -97,22 +97,20 @@ static void send_ipsec_gre_tunnel_details rmp->remote_sa_id = htonl (t->remote_sa_id); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_ipsec_gre_tunnel_dump_t_handler (vl_api_ipsec_gre_tunnel_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; ipsec_gre_main_t *igm = &ipsec_gre_main; ipsec_gre_tunnel_t *t; u32 sw_if_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; sw_if_index = ntohl (mp->sw_if_index); @@ -121,7 +119,7 @@ static void vl_api_ipsec_gre_tunnel_dump_t_handler /* *INDENT-OFF* */ pool_foreach (t, igm->tunnels, ({ - send_ipsec_gre_tunnel_details(t, q, mp->context); + send_ipsec_gre_tunnel_details(t, reg, mp->context); })); /* *INDENT-ON* */ } @@ -133,7 +131,7 @@ static void vl_api_ipsec_gre_tunnel_dump_t_handler return; } t = &igm->tunnels[igm->tunnel_index_by_sw_if_index[sw_if_index]]; - send_ipsec_gre_tunnel_details (t, q, mp->context); + send_ipsec_gre_tunnel_details (t, reg, mp->context); } } diff --git a/src/vnet/ipsec/ipsec_api.c b/src/vnet/ipsec/ipsec_api.c index 361bddbc8d0..da78f3d2496 100644 --- a/src/vnet/ipsec/ipsec_api.c +++ b/src/vnet/ipsec/ipsec_api.c @@ -252,7 +252,8 @@ out: } static void -send_ipsec_spd_details (ipsec_policy_t * p, svm_queue_t * q, u32 context) +send_ipsec_spd_details (ipsec_policy_t * p, vl_api_registration_t * reg, + u32 context) { vl_api_ipsec_spd_details_t *mp; @@ -289,21 +290,21 @@ send_ipsec_spd_details (ipsec_policy_t * p, svm_queue_t * q, u32 context) mp->bytes = clib_host_to_net_u64 (p->counter.bytes); mp->packets = clib_host_to_net_u64 (p->counter.packets); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_ipsec_spd_dump_t_handler (vl_api_ipsec_spd_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; ipsec_main_t *im = &ipsec_main; ipsec_policy_t *policy; ipsec_spd_t *spd; uword *p; u32 spd_index; #if WITH_LIBSSL > 0 - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; p = hash_get (im->spd_index_by_spd_id, ntohl (mp->spd_id)); @@ -317,7 +318,7 @@ vl_api_ipsec_spd_dump_t_handler (vl_api_ipsec_spd_dump_t * mp) pool_foreach (policy, spd->policies, ({ if (mp->sa_id == ~(0) || ntohl (mp->sa_id) == policy->sa_id) - send_ipsec_spd_details (policy, q, + send_ipsec_spd_details (policy, reg, mp->context);} )); /* *INDENT-ON* */ @@ -399,7 +400,7 @@ vl_api_ipsec_tunnel_if_add_del_t_handler (vl_api_ipsec_tunnel_if_add_del_t * } static void -send_ipsec_sa_details (ipsec_sa_t * sa, svm_queue_t * q, +send_ipsec_sa_details (ipsec_sa_t * sa, vl_api_registration_t * reg, u32 context, u32 sw_if_index) { vl_api_ipsec_sa_details_t *mp; @@ -455,14 +456,14 @@ send_ipsec_sa_details (ipsec_sa_t * sa, svm_queue_t * q, mp->replay_window = clib_host_to_net_u64 (sa->replay_window); mp->total_data_size = clib_host_to_net_u64 (sa->total_data_size); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_ipsec_sa_dump_t_handler (vl_api_ipsec_sa_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; ipsec_main_t *im = &ipsec_main; vnet_main_t *vnm = im->vnet_main; ipsec_sa_t *sa; @@ -470,8 +471,8 @@ vl_api_ipsec_sa_dump_t_handler (vl_api_ipsec_sa_dump_t * mp) u32 *sa_index_to_tun_if_index = 0; #if WITH_LIBSSL > 0 - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0 || pool_elts (im->sad) == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg || pool_elts (im->sad) == 0) return; vec_validate_init_empty (sa_index_to_tun_if_index, vec_len (im->sad) - 1, @@ -492,7 +493,7 @@ vl_api_ipsec_sa_dump_t_handler (vl_api_ipsec_sa_dump_t * mp) pool_foreach (sa, im->sad, ({ if (mp->sa_id == ~(0) || ntohl (mp->sa_id) == sa->id) - send_ipsec_sa_details (sa, q, mp->context, + send_ipsec_sa_details (sa, reg, mp->context, sa_index_to_tun_if_index[sa - im->sad]); })); /* *INDENT-ON* */ diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c index 206b41f142c..0fe119b0db0 100644 --- a/src/vnet/l2/l2_api.c +++ b/src/vnet/l2/l2_api.c @@ -72,7 +72,7 @@ _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \ _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) static void -send_l2_xconnect_details (svm_queue_t * q, u32 context, +send_l2_xconnect_details (vl_api_registration_t * reg, u32 context, u32 rx_sw_if_index, u32 tx_sw_if_index) { vl_api_l2_xconnect_details_t *mp; @@ -84,21 +84,21 @@ send_l2_xconnect_details (svm_queue_t * q, u32 context, mp->rx_sw_if_index = htonl (rx_sw_if_index); mp->tx_sw_if_index = htonl (tx_sw_if_index); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_l2_xconnect_dump_t_handler (vl_api_l2_xconnect_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; vnet_main_t *vnm = vnet_get_main (); vnet_interface_main_t *im = &vnm->interface_main; l2input_main_t *l2im = &l2input_main; vnet_sw_interface_t *swif; l2_input_config_t *config; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ @@ -106,7 +106,7 @@ vl_api_l2_xconnect_dump_t_handler (vl_api_l2_xconnect_dump_t * mp) ({ config = vec_elt_at_index (l2im->configs, swif->sw_if_index); if (config->xconnect) - send_l2_xconnect_details (q, mp->context, swif->sw_if_index, + send_l2_xconnect_details (reg, mp->context, swif->sw_if_index, config->output_sw_if_index); })); /* *INDENT-ON* */ @@ -126,7 +126,7 @@ vl_api_l2_fib_clear_table_t_handler (vl_api_l2_fib_clear_table_t * mp) static void send_l2fib_table_entry (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, l2fib_entry_key_t * l2fe_key, l2fib_entry_result_t * l2fe_res, u32 context) { @@ -146,7 +146,7 @@ send_l2fib_table_entry (vpe_api_main_t * am, mp->bvi_mac = l2fe_res->fields.bvi; mp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -158,11 +158,11 @@ vl_api_l2_fib_table_dump_t_handler (vl_api_l2_fib_table_dump_t * mp) l2fib_entry_result_t *l2fe_res = NULL; u32 ni, bd_id = ntohl (mp->bd_id); u32 bd_index; - svm_queue_t *q; + vl_api_registration_t *reg; uword *p; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* see l2fib_table_dump: ~0 means "any" */ @@ -181,7 +181,7 @@ vl_api_l2_fib_table_dump_t_handler (vl_api_l2_fib_table_dump_t * mp) vec_foreach_index (ni, l2fe_key) { - send_l2fib_table_entry (am, q, vec_elt_at_index (l2fe_key, ni), + send_l2fib_table_entry (am, reg, vec_elt_at_index (l2fe_key, ni), vec_elt_at_index (l2fe_res, ni), mp->context); } vec_free (l2fe_key); @@ -439,7 +439,7 @@ vl_api_bridge_domain_add_del_t_handler (vl_api_bridge_domain_add_del_t * mp) static void send_bridge_domain_details (l2input_main_t * l2im, - svm_queue_t * q, + vl_api_registration_t * reg, l2_bridge_domain_t * bd_config, u32 n_sw_ifs, u32 context) { @@ -480,7 +480,7 @@ send_bridge_domain_details (l2input_main_t * l2im, } mp->n_sw_ifs = htonl (mp->n_sw_ifs); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -488,16 +488,17 @@ vl_api_bridge_domain_dump_t_handler (vl_api_bridge_domain_dump_t * mp) { bd_main_t *bdm = &bd_main; l2input_main_t *l2im = &l2input_main; + vl_api_registration_t *reg; + u32 bd_id, bd_index, end; - svm_queue_t *q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; - u32 bd_id = ntohl (mp->bd_id); + bd_id = ntohl (mp->bd_id); if (bd_id == 0) return; - u32 bd_index, end; if (bd_id == ~0) bd_index = 0, end = vec_len (l2im->bd_configs); else @@ -515,7 +516,7 @@ vl_api_bridge_domain_dump_t_handler (vl_api_bridge_domain_dump_t * mp) l2input_bd_config_from_index (l2im, bd_index); /* skip dummy bd_id 0 */ if (bd_config && (bd_config->bd_id > 0)) - send_bridge_domain_details (l2im, q, bd_config, + send_bridge_domain_details (l2im, reg, bd_config, vec_len (bd_config->members), mp->context); } diff --git a/src/vnet/l2tp/l2tp_api.c b/src/vnet/l2tp/l2tp_api.c index aaba2b04e19..3c7c19d96b2 100644 --- a/src/vnet/l2tp/l2tp_api.c +++ b/src/vnet/l2tp/l2tp_api.c @@ -51,7 +51,7 @@ _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) static void send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, l2t_session_t * s, l2t_main_t * lm, u32 context) { @@ -81,7 +81,7 @@ send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am, mp->l2_sublayer_present = s->l2_sublayer_present; mp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } @@ -91,17 +91,17 @@ vl_api_sw_if_l2tpv3_tunnel_dump_t_handler (vl_api_sw_if_l2tpv3_tunnel_dump_t * { vpe_api_main_t *am = &vpe_api_main; l2t_main_t *lm = &l2t_main; - svm_queue_t *q; + vl_api_registration_t *reg; l2t_session_t *session; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach (session, lm->sessions, ({ - send_sw_if_l2tpv3_tunnel_details (am, q, session, lm, mp->context); + send_sw_if_l2tpv3_tunnel_details (am, reg, session, lm, mp->context); })); /* *INDENT-ON* */ } diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c index 9946f28f131..cb21dd1b155 100644 --- a/src/vnet/lisp-cp/lisp_api.c +++ b/src/vnet/lisp-cp/lisp_api.c @@ -420,7 +420,6 @@ vl_api_lisp_use_petr_t_handler (vl_api_lisp_use_petr_t * mp) static void vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp) { - svm_queue_t *q = NULL; vl_api_show_lisp_use_petr_reply_t *rmp = NULL; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); mapping_t *m; @@ -430,12 +429,6 @@ vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp) u8 status = 0; gid_address_t addr; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - memset (&addr, 0, sizeof (addr)); status = lcm->flags & LISP_FLAG_USE_PETR; if (status) @@ -583,7 +576,8 @@ send_reply: static void send_lisp_locator_details (lisp_cp_main_t * lcm, - locator_t * loc, svm_queue_t * q, u32 context) + locator_t * loc, vl_api_registration_t * reg, + u32 context) { vl_api_lisp_locator_details_t *rmp; @@ -605,25 +599,23 @@ send_lisp_locator_details (lisp_cp_main_t * lcm, rmp->priority = loc->priority; rmp->weight = loc->weight; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_lisp_locator_dump_t_handler (vl_api_lisp_locator_dump_t * mp) { u8 *ls_name = 0; - svm_queue_t *q = 0; + vl_api_registration_t *reg = 0; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); locator_set_t *lsit = 0; locator_t *loc = 0; u32 ls_index = ~0, *locit = 0; uword *p = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->is_index_set) ls_index = htonl (mp->ls_index); @@ -647,7 +639,7 @@ vl_api_lisp_locator_dump_t_handler (vl_api_lisp_locator_dump_t * mp) vec_foreach (locit, lsit->locator_indices) { loc = pool_elt_at_index (lcm->locator_pool, locit[0]); - send_lisp_locator_details (lcm, loc, q, mp->context); + send_lisp_locator_details (lcm, loc, reg, mp->context); }; out: vec_free (ls_name); @@ -656,7 +648,8 @@ out: static void send_lisp_locator_set_details (lisp_cp_main_t * lcm, locator_set_t * lsit, - svm_queue_t * q, u32 context, u32 ls_index) + vl_api_registration_t * reg, u32 context, + u32 ls_index) { vl_api_lisp_locator_set_details_t *rmp; u8 *str = 0; @@ -680,22 +673,20 @@ send_lisp_locator_set_details (lisp_cp_main_t * lcm, vec_free (str); } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); locator_set_t *lsit = NULL; u8 filter; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; filter = mp->filter; /* *INDENT-OFF* */ @@ -706,7 +697,7 @@ vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t * mp) { continue; } - send_lisp_locator_set_details (lcm, lsit, q, mp->context, + send_lisp_locator_set_details (lcm, lsit, reg, mp->context, lsit - lcm->locator_set_pool); })); /* *INDENT-ON* */ @@ -766,7 +757,8 @@ fid_type_to_api_type (fid_address_t * fid) static void send_lisp_eid_table_details (mapping_t * mapit, - svm_queue_t * q, u32 context, u8 filter) + vl_api_registration_t * reg, u32 context, + u8 filter) { fid_address_t *fid; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); @@ -854,23 +846,21 @@ send_lisp_eid_table_details (mapping_t * mapit, rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid)); rmp->key_id = clib_host_to_net_u16 (mapit->key_id); memcpy (rmp->key, mapit->key, vec_len (mapit->key)); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp) { u32 mi; - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); mapping_t *mapit = NULL; gid_address_t _eid, *eid = &_eid; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->eid_set) { @@ -884,7 +874,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp) return; mapit = pool_elt_at_index (lcm->mapping_pool, mi); - send_lisp_eid_table_details (mapit, q, mp->context, + send_lisp_eid_table_details (mapit, reg, mp->context, 0 /* ignore filter */ ); } else @@ -892,7 +882,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (mapit, lcm->mapping_pool, ({ - send_lisp_eid_table_details(mapit, q, mp->context, + send_lisp_eid_table_details(mapit, reg, mp->context, mp->filter); })); /* *INDENT-ON* */ @@ -900,7 +890,8 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp) } static void -send_lisp_map_server_details (ip_address_t * ip, svm_queue_t * q, u32 context) +send_lisp_map_server_details (ip_address_t * ip, vl_api_registration_t * reg, + u32 context) { vl_api_lisp_map_server_details_t *rmp = NULL; @@ -927,31 +918,29 @@ send_lisp_map_server_details (ip_address_t * ip, svm_queue_t * q, u32 context) } rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_lisp_map_server_dump_t_handler (vl_api_lisp_map_server_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); lisp_msmr_t *mr; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; vec_foreach (mr, lcm->map_servers) { - send_lisp_map_server_details (&mr->address, q, mp->context); + send_lisp_map_server_details (&mr->address, reg, mp->context); } } static void send_lisp_map_resolver_details (ip_address_t * ip, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_lisp_map_resolver_details_t *rmp = NULL; @@ -978,30 +967,29 @@ send_lisp_map_resolver_details (ip_address_t * ip, } rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_lisp_map_resolver_dump_t_handler (vl_api_lisp_map_resolver_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); lisp_msmr_t *mr; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; vec_foreach (mr, lcm->map_resolvers) { - send_lisp_map_resolver_details (&mr->address, q, mp->context); + send_lisp_map_resolver_details (&mr->address, reg, mp->context); } } static void -send_eid_table_map_pair (hash_pair_t * p, svm_queue_t * q, u32 context) +send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg, + u32 context) { vl_api_lisp_eid_table_map_details_t *rmp = NULL; @@ -1012,23 +1000,21 @@ send_eid_table_map_pair (hash_pair_t * p, svm_queue_t * q, u32 context) rmp->vni = clib_host_to_net_u32 (p->key); rmp->dp_table = clib_host_to_net_u32 (p->value[0]); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_lisp_eid_table_map_dump_t_handler (vl_api_lisp_eid_table_map_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); hash_pair_t *p; uword *vni_table = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->is_l2) { @@ -1042,13 +1028,13 @@ vl_api_lisp_eid_table_map_dump_t_handler (vl_api_lisp_eid_table_map_dump_t * /* *INDENT-OFF* */ hash_foreach_pair (p, vni_table, ({ - send_eid_table_map_pair (p, q, mp->context); + send_eid_table_map_pair (p, reg, mp->context); })); /* *INDENT-ON* */ } static void -send_eid_table_vni (u32 vni, svm_queue_t * q, u32 context) +send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context) { vl_api_lisp_eid_table_vni_details_t *rmp = 0; @@ -1057,7 +1043,7 @@ send_eid_table_vni (u32 vni, svm_queue_t * q, u32 context) rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS); rmp->context = context; rmp->vni = clib_host_to_net_u32 (vni); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -1161,14 +1147,12 @@ vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t * { hash_pair_t *p; u32 *vnis = 0; - svm_queue_t *q = 0; + vl_api_registration_t *reg = 0; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; /* *INDENT-OFF* */ hash_foreach_pair (p, lcm->table_id_by_vni, @@ -1183,7 +1167,7 @@ vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t * hash_foreach_pair (p, vnis, ({ - send_eid_table_vni (p->key, q, mp->context); + send_eid_table_vni (p->key, reg, mp->context); })); /* *INDENT-ON* */ @@ -1193,16 +1177,9 @@ vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t * static void vl_api_show_lisp_status_t_handler (vl_api_show_lisp_status_t * mp) { - svm_queue_t *q = NULL; vl_api_show_lisp_status_reply_t *rmp = NULL; int rv = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - /* *INDENT-OFF* */ REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY, ({ @@ -1216,19 +1193,12 @@ static void vl_api_lisp_get_map_request_itr_rlocs_t_handler (vl_api_lisp_get_map_request_itr_rlocs_t * mp) { - svm_queue_t *q = NULL; vl_api_lisp_get_map_request_itr_rlocs_reply_t *rmp = NULL; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); locator_set_t *loc_set = 0; u8 *tmp_str = 0; int rv = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - if (~0 == lcm->mreq_itr_rlocs) { tmp_str = format (0, " "); @@ -1254,7 +1224,6 @@ static void static void vl_api_show_lisp_pitr_t_handler (vl_api_show_lisp_pitr_t * mp) { - svm_queue_t *q = NULL; vl_api_show_lisp_pitr_reply_t *rmp = NULL; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); mapping_t *m; @@ -1262,12 +1231,6 @@ vl_api_show_lisp_pitr_t_handler (vl_api_show_lisp_pitr_t * mp) u8 *tmp_str = 0; int rv = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE) && lcm->pitr_map_index != ~0; diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c index 7afbf7f9582..cc8839d66e6 100644 --- a/src/vnet/lisp-cp/one_api.c +++ b/src/vnet/lisp-cp/one_api.c @@ -68,22 +68,22 @@ #include <vlibapi/api_helper_macros.h> -#define REPLY_DETAILS(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; \ - do {body;} while (0); \ - vl_msg_api_send_shmem (q, (u8 *)&rmp); \ +#define REPLY_DETAILS(t, body) \ +do { \ + vl_api_registration_t * reg; \ + rv = vl_msg_api_pd_handler (mp, rv); \ + reg = vl_api_client_index_to_registration (mp->client_index); \ + if (!reg) \ + return; \ + \ + rmp = vl_msg_api_alloc (sizeof (*rmp)); \ + rmp->_vl_msg_id = ntohs((t)); \ + rmp->context = mp->context; \ + do {body;} while (0); \ + vl_api_send_msg (reg, (u8 *)&rmp); \ } while(0); -#define foreach_vpe_api_msg \ +#define foreach_vpe_api_msg \ _(ONE_ADD_DEL_LOCATOR_SET, one_add_del_locator_set) \ _(ONE_ADD_DEL_LOCATOR, one_add_del_locator) \ _(ONE_ADD_DEL_LOCAL_EID, one_add_del_local_eid) \ @@ -537,7 +537,6 @@ vl_api_one_use_petr_t_handler (vl_api_one_use_petr_t * mp) static void vl_api_show_one_use_petr_t_handler (vl_api_show_one_use_petr_t * mp) { - svm_queue_t *q = NULL; vl_api_show_one_use_petr_reply_t *rmp = NULL; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); mapping_t *m; @@ -547,12 +546,6 @@ vl_api_show_one_use_petr_t_handler (vl_api_show_one_use_petr_t * mp) u8 status = 0; gid_address_t addr; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - memset (&addr, 0, sizeof (addr)); status = lcm->flags & LISP_FLAG_USE_PETR; if (status) @@ -698,7 +691,8 @@ send_reply: static void send_one_locator_details (lisp_cp_main_t * lcm, - locator_t * loc, svm_queue_t * q, u32 context) + locator_t * loc, vl_api_registration_t * reg, + u32 context) { vl_api_one_locator_details_t *rmp; @@ -720,25 +714,23 @@ send_one_locator_details (lisp_cp_main_t * lcm, rmp->priority = loc->priority; rmp->weight = loc->weight; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_one_locator_dump_t_handler (vl_api_one_locator_dump_t * mp) { u8 *ls_name = 0; - svm_queue_t *q = 0; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); locator_set_t *lsit = 0; locator_t *loc = 0; u32 ls_index = ~0, *locit = 0; uword *p = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->is_index_set) ls_index = htonl (mp->ls_index); @@ -762,7 +754,7 @@ vl_api_one_locator_dump_t_handler (vl_api_one_locator_dump_t * mp) vec_foreach (locit, lsit->locator_indices) { loc = pool_elt_at_index (lcm->locator_pool, locit[0]); - send_one_locator_details (lcm, loc, q, mp->context); + send_one_locator_details (lcm, loc, reg, mp->context); }; out: vec_free (ls_name); @@ -771,7 +763,8 @@ out: static void send_one_locator_set_details (lisp_cp_main_t * lcm, locator_set_t * lsit, - svm_queue_t * q, u32 context, u32 ls_index) + vl_api_registration_t * reg, u32 context, + u32 ls_index) { vl_api_one_locator_set_details_t *rmp; u8 *str = 0; @@ -795,22 +788,20 @@ send_one_locator_set_details (lisp_cp_main_t * lcm, vec_free (str); } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_one_locator_set_dump_t_handler (vl_api_one_locator_set_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); locator_set_t *lsit = NULL; u8 filter; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; filter = mp->filter; /* *INDENT-OFF* */ @@ -821,7 +812,7 @@ vl_api_one_locator_set_dump_t_handler (vl_api_one_locator_set_dump_t * mp) { continue; } - send_one_locator_set_details (lcm, lsit, q, mp->context, + send_one_locator_set_details (lcm, lsit, reg, mp->context, lsit - lcm->locator_set_pool); })); /* *INDENT-ON* */ @@ -881,7 +872,8 @@ fid_type_to_api_type (fid_address_t * fid) static void send_one_eid_table_details (mapping_t * mapit, - svm_queue_t * q, u32 context, u8 filter) + vl_api_registration_t * reg, u32 context, + u8 filter) { fid_address_t *fid; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); @@ -975,23 +967,21 @@ send_one_eid_table_details (mapping_t * mapit, rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid)); rmp->key_id = clib_host_to_net_u16 (mapit->key_id); memcpy (rmp->key, mapit->key, vec_len (mapit->key)); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_one_eid_table_dump_t_handler (vl_api_one_eid_table_dump_t * mp) { u32 mi; - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); mapping_t *mapit = NULL; gid_address_t _eid, *eid = &_eid; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->eid_set) { @@ -1005,7 +995,7 @@ vl_api_one_eid_table_dump_t_handler (vl_api_one_eid_table_dump_t * mp) return; mapit = pool_elt_at_index (lcm->mapping_pool, mi); - send_one_eid_table_details (mapit, q, mp->context, + send_one_eid_table_details (mapit, reg, mp->context, 0 /* ignore filter */ ); } else @@ -1013,7 +1003,7 @@ vl_api_one_eid_table_dump_t_handler (vl_api_one_eid_table_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (mapit, lcm->mapping_pool, ({ - send_one_eid_table_details(mapit, q, mp->context, + send_one_eid_table_details(mapit, reg, mp->context, mp->filter); })); /* *INDENT-ON* */ @@ -1021,7 +1011,8 @@ vl_api_one_eid_table_dump_t_handler (vl_api_one_eid_table_dump_t * mp) } static void -send_one_map_server_details (ip_address_t * ip, svm_queue_t * q, u32 context) +send_one_map_server_details (ip_address_t * ip, vl_api_registration_t * reg, + u32 context) { vl_api_one_map_server_details_t *rmp = NULL; @@ -1048,31 +1039,29 @@ send_one_map_server_details (ip_address_t * ip, svm_queue_t * q, u32 context) } rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_one_map_server_dump_t_handler (vl_api_one_map_server_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); lisp_msmr_t *mr; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; vec_foreach (mr, lcm->map_servers) { - send_one_map_server_details (&mr->address, q, mp->context); + send_one_map_server_details (&mr->address, reg, mp->context); } } static void send_one_map_resolver_details (ip_address_t * ip, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_one_map_resolver_details_t *rmp = NULL; @@ -1099,30 +1088,29 @@ send_one_map_resolver_details (ip_address_t * ip, } rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_one_map_resolver_dump_t_handler (vl_api_one_map_resolver_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); lisp_msmr_t *mr; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; vec_foreach (mr, lcm->map_resolvers) { - send_one_map_resolver_details (&mr->address, q, mp->context); + send_one_map_resolver_details (&mr->address, reg, mp->context); } } static void -send_eid_table_map_pair (hash_pair_t * p, svm_queue_t * q, u32 context) +send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg, + u32 context) { vl_api_one_eid_table_map_details_t *rmp = NULL; @@ -1133,22 +1121,20 @@ send_eid_table_map_pair (hash_pair_t * p, svm_queue_t * q, u32 context) rmp->vni = clib_host_to_net_u32 (p->key); rmp->dp_table = clib_host_to_net_u32 (p->value[0]); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_one_eid_table_map_dump_t_handler (vl_api_one_eid_table_map_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); hash_pair_t *p; uword *vni_table = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; if (mp->is_l2) { @@ -1162,13 +1148,13 @@ vl_api_one_eid_table_map_dump_t_handler (vl_api_one_eid_table_map_dump_t * mp) /* *INDENT-OFF* */ hash_foreach_pair (p, vni_table, ({ - send_eid_table_map_pair (p, q, mp->context); + send_eid_table_map_pair (p, reg, mp->context); })); /* *INDENT-ON* */ } static void -send_eid_table_vni (u32 vni, svm_queue_t * q, u32 context) +send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context) { vl_api_one_eid_table_vni_details_t *rmp = 0; @@ -1177,7 +1163,7 @@ send_eid_table_vni (u32 vni, svm_queue_t * q, u32 context) rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS); rmp->context = context; rmp->vni = clib_host_to_net_u32 (vni); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -1291,14 +1277,12 @@ vl_api_one_eid_table_vni_dump_t_handler (vl_api_one_eid_table_vni_dump_t * mp) { hash_pair_t *p; u32 *vnis = 0; - svm_queue_t *q = 0; + vl_api_registration_t *reg; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; /* *INDENT-OFF* */ hash_foreach_pair (p, lcm->table_id_by_vni, @@ -1313,7 +1297,7 @@ vl_api_one_eid_table_vni_dump_t_handler (vl_api_one_eid_table_vni_dump_t * mp) hash_foreach_pair (p, vnis, ({ - send_eid_table_vni (p->key, q, mp->context); + send_eid_table_vni (p->key, reg, mp->context); })); /* *INDENT-ON* */ @@ -1370,7 +1354,6 @@ static void static void vl_api_show_one_nsh_mapping_t_handler (vl_api_show_one_nsh_mapping_t * mp) { - svm_queue_t *q = NULL; vl_api_show_one_nsh_mapping_reply_t *rmp = NULL; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); mapping_t *m; @@ -1379,12 +1362,6 @@ vl_api_show_one_nsh_mapping_t_handler (vl_api_show_one_nsh_mapping_t * mp) u8 is_set = 0; int rv = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - if (lcm->nsh_map_index == (u32) ~ 0) { tmp_str = format (0, "N/A"); @@ -1419,7 +1396,6 @@ vl_api_show_one_nsh_mapping_t_handler (vl_api_show_one_nsh_mapping_t * mp) static void vl_api_show_one_pitr_t_handler (vl_api_show_one_pitr_t * mp) { - svm_queue_t *q = NULL; vl_api_show_one_pitr_reply_t *rmp = NULL; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); mapping_t *m; @@ -1427,12 +1403,6 @@ vl_api_show_one_pitr_t_handler (vl_api_show_one_pitr_t * mp) u8 *tmp_str = 0; int rv = 0; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE) && lcm->pitr_map_index != ~0; diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c index 86b2f6cbc69..97409f597ca 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_api.c +++ b/src/vnet/lisp-gpe/lisp_gpe_api.c @@ -154,13 +154,13 @@ static void lisp_fwd_path_t *path; vl_api_gpe_fwd_entry_path_details_t *rmp = NULL; lisp_gpe_main_t *lgm = &lisp_gpe_main; - svm_queue_t *q = NULL; + vl_api_registration_t *reg; lisp_gpe_fwd_entry_t *lfe; gpe_fwd_entry_path_dump_t_net_to_host (mp); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; if (pool_is_free_index (lgm->lisp_fwd_entry_pool, mp->fwd_entry_index)) @@ -187,7 +187,7 @@ static void lisp_api_set_locator (&rmp->lcl_loc, &lgt->key->lcl, path->weight); rmp->context = mp->context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } } diff --git a/src/vnet/map/map_api.c b/src/vnet/map/map_api.c index 8ff73ec71e2..e06dd594d59 100644 --- a/src/vnet/map/map_api.c +++ b/src/vnet/map/map_api.c @@ -110,16 +110,14 @@ vl_api_map_domain_dump_t_handler (vl_api_map_domain_dump_t * mp) vl_api_map_domain_details_t *rmp; map_main_t *mm = &map_main; map_domain_t *d; - svm_queue_t *q; + vl_api_registration_t *reg; if (pool_elts (mm->domains) == 0) return; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; /* *INDENT-OFF* */ pool_foreach(d, mm->domains, @@ -141,7 +139,7 @@ vl_api_map_domain_dump_t_handler (vl_api_map_domain_dump_t * mp) rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION); rmp->context = mp->context; - vl_msg_api_send_shmem (q, (u8 *)&rmp); + vl_api_send_msg (reg, (u8 *)&rmp); })); /* *INDENT-ON* */ } @@ -149,7 +147,7 @@ vl_api_map_domain_dump_t_handler (vl_api_map_domain_dump_t * mp) static void vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; u16 i; ip6_address_t dst; vl_api_map_rule_details_t *rmp; @@ -166,11 +164,9 @@ vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp) return; } - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; for (i = 0; i < (0x1 << d->psid_length); i++) { @@ -185,7 +181,7 @@ vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp) rmp->psid = htons (i); clib_memcpy (rmp->ip6_dst, &dst, sizeof (rmp->ip6_dst)); rmp->context = mp->context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } } @@ -199,9 +195,10 @@ vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp) u64 total_pkts[VLIB_N_RX_TX]; u64 total_bytes[VLIB_N_RX_TX]; map_main_t *mm = &map_main; - svm_queue_t *q = vl_api_client_index_to_input_queue (mp->client_index); + vl_api_registration_t *reg; - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -252,7 +249,7 @@ vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp) (ip4_map_node.index, MAP_ERROR_DECAP_SEC_CHECK)); out: - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } /* diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c index d9f40501526..394a6b7f51b 100644 --- a/src/vnet/mpls/mpls_api.c +++ b/src/vnet/mpls/mpls_api.c @@ -376,7 +376,7 @@ static void typedef struct mpls_tunnel_send_walk_ctx_t_ { - svm_queue_t *q; + vl_api_registration_t *reg; u32 index; u32 context; } mpls_tunnel_send_walk_ctx_t; @@ -427,20 +427,20 @@ send_mpls_tunnel_entry (u32 mti, void *arg) // mt->mt_label_stack, nlabels * sizeof (u32)); - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->reg, (u8 *) mp); } static void vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; mpls_tunnel_send_walk_ctx_t ctx = { - .q = q, + .reg = reg, .index = ntohl (mp->tunnel_index), .context = mp->context, }; @@ -449,7 +449,7 @@ vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_dump_t * mp) static void send_mpls_fib_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, const fib_table_t * table, u32 label, u32 eos, fib_route_path_encode_t * api_rpaths, u32 context) @@ -485,7 +485,7 @@ send_mpls_fib_details (vpe_api_main_t * am, fp++; } - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } typedef struct vl_api_mpls_fib_dump_table_walk_ctx_t_ @@ -507,7 +507,7 @@ static void vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp) { vpe_api_main_t *am = &vpe_api_main; - svm_queue_t *q; + vl_api_registration_t *reg; mpls_main_t *mm = &mpls_main; fib_table_t *fib_table; mpls_fib_t *mpls_fib; @@ -519,8 +519,8 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp) .lfeis = NULL, }; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ @@ -540,7 +540,7 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp) fib_table = fib_table_get (fib_index, pfx.fp_proto); api_rpaths = NULL; fib_entry_encode (*lfeip, &api_rpaths); - send_mpls_fib_details (am, q, + send_mpls_fib_details (am, reg, fib_table, pfx.fp_label, pfx.fp_eos, api_rpaths, mp->context); vec_free (api_rpaths); diff --git a/src/vnet/policer/policer_api.c b/src/vnet/policer/policer_api.c index a658076685b..77efe852e59 100644 --- a/src/vnet/policer/policer_api.c +++ b/src/vnet/policer/policer_api.c @@ -96,7 +96,7 @@ static void send_policer_details (u8 * name, sse2_qos_pol_cfg_params_st * config, policer_read_response_type_st * templ, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_policer_details_t *mp; @@ -130,13 +130,13 @@ send_policer_details (u8 * name, strncpy ((char *) mp->name, (char *) name, ARRAY_LEN (mp->name) - 1); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_policer_dump_t_handler (vl_api_policer_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; vnet_policer_main_t *pm = &vnet_policer_main; hash_pair_t *hp; uword *p; @@ -146,8 +146,8 @@ vl_api_policer_dump_t_handler (vl_api_policer_dump_t * mp) sse2_qos_pol_cfg_params_st *config; policer_read_response_type_st *templ; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; if (mp->match_name_valid) @@ -164,7 +164,7 @@ vl_api_policer_dump_t_handler (vl_api_policer_dump_t * mp) pool_index = p[0]; config = pool_elt_at_index (pm->configs, pool_index); templ = pool_elt_at_index (pm->policer_templates, pool_index); - send_policer_details (match_name, config, templ, q, mp->context); + send_policer_details (match_name, config, templ, reg, mp->context); } } else @@ -176,7 +176,7 @@ vl_api_policer_dump_t_handler (vl_api_policer_dump_t * mp) pool_index = hp->value[0]; config = pool_elt_at_index (pm->configs, pool_index); templ = pool_elt_at_index (pm->policer_templates, pool_index); - send_policer_details(name, config, templ, q, mp->context); + send_policer_details(name, config, templ, reg, mp->context); })); /* *INDENT-ON* */ } diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 75bdedfe9ce..eeda839a2fb 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -870,7 +870,7 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp) static void send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local, u8 transport_proto, u32 appns_index, u8 * tag, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_session_rules_details_t *rmp = 0; session_mask_or_match_4_t *match = @@ -901,13 +901,13 @@ send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local, rmp->tag[vec_len (tag)] = 0; } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local, u8 transport_proto, u32 appns_index, u8 * tag, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { vl_api_session_rules_details_t *rmp = 0; session_mask_or_match_6_t *match = @@ -938,13 +938,13 @@ send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local, rmp->tag[vec_len (tag)] = 0; } - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void send_session_rules_table_details (session_rules_table_t * srt, u8 fib_proto, u8 tp, u8 is_local, u32 appns_index, - svm_queue_t * q, u32 context) + vl_api_registration_t * reg, u32 context) { mma_rule_16_t *rule16; mma_rule_40_t *rule40; @@ -961,7 +961,7 @@ send_session_rules_table_details (session_rules_table_t * srt, u8 fib_proto, ri = mma_rules_table_rule_index_16 (srt16, rule16); tag = session_rules_table_rule_tag (srt, ri, 1); send_session_rule_details4 (rule16, is_local, tp, appns_index, tag, - q, context); + reg, context); })); /* *INDENT-ON* */ } @@ -974,7 +974,7 @@ send_session_rules_table_details (session_rules_table_t * srt, u8 fib_proto, ri = mma_rules_table_rule_index_40 (srt40, rule40); tag = session_rules_table_rule_tag (srt, ri, 1); send_session_rule_details6 (rule40, is_local, tp, appns_index, tag, - q, context); + reg, context); })); /* *INDENT-ON* */ } @@ -983,12 +983,12 @@ send_session_rules_table_details (session_rules_table_t * srt, u8 fib_proto, static void vl_api_session_rules_dump_t_handler (vl_api_one_map_server_dump_t * mp) { - svm_queue_t *q = NULL; + vl_api_registration_t *reg; session_table_t *st; u8 tp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ @@ -997,7 +997,7 @@ vl_api_session_rules_dump_t_handler (vl_api_one_map_server_dump_t * mp) { send_session_rules_table_details (&st->session_rules[tp], st->active_fib_proto, tp, - st->is_local, st->appns_index, q, + st->is_local, st->appns_index, reg, mp->context); } })); diff --git a/src/vnet/span/span_api.c b/src/vnet/span/span_api.c index 40dc4f35137..5df93faf52b 100644 --- a/src/vnet/span/span_api.c +++ b/src/vnet/span/span_api.c @@ -66,13 +66,13 @@ static void vl_api_sw_interface_span_dump_t_handler (vl_api_sw_interface_span_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; span_interface_t *si; vl_api_sw_interface_span_details_t *rmp; span_main_t *sm = &span_main; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; span_feat_t sf = mp->is_l2 ? SPAN_FEAT_L2 : SPAN_FEAT_DEVICE; @@ -98,7 +98,7 @@ vl_api_sw_interface_span_dump_t_handler (vl_api_sw_interface_span_dump_t * mp) rmp->state = (u8) (clib_bitmap_get (rxm->mirror_ports, i) + clib_bitmap_get (txm->mirror_ports, i) * 2); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); })); clib_bitmap_free (b); } diff --git a/src/vnet/srv6/sr_api.c b/src/vnet/srv6/sr_api.c index 8f5f4f90e5d..d696e06a396 100644 --- a/src/vnet/srv6/sr_api.c +++ b/src/vnet/srv6/sr_api.c @@ -191,7 +191,7 @@ static void vl_api_sr_steering_add_del_t_handler } static void send_sr_localsid_details - (ip6_sr_localsid_t * t, svm_queue_t * q, u32 context) + (ip6_sr_localsid_t * t, vl_api_registration_t * reg, u32 context) { vl_api_sr_localsids_details_t *rmp; @@ -206,26 +206,24 @@ static void send_sr_localsid_details rmp->xconnect_iface_or_vrf_table = htonl (t->sw_if_index); rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_sr_localsids_dump_t_handler (vl_api_sr_localsids_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; ip6_sr_main_t *sm = &sr_main; ip6_sr_localsid_t *t; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; /* *INDENT-OFF* */ pool_foreach (t, sm->localsids, ({ - send_sr_localsid_details(t, q, mp->context); + send_sr_localsid_details(t, reg, mp->context); })); /* *INDENT-ON* */ } diff --git a/src/vnet/udp/udp_api.c b/src/vnet/udp/udp_api.c index dddc6f9470d..d643f682a30 100644 --- a/src/vnet/udp/udp_api.c +++ b/src/vnet/udp/udp_api.c @@ -43,7 +43,8 @@ _(UDP_ENCAP_DUMP, udp_encap_dump) static void -send_udp_encap_details (const udp_encap_t * ue, svm_queue_t * q, u32 context) +send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg, + u32 context) { vl_api_udp_encap_details_t *mp; fib_table_t *fib_table; @@ -74,24 +75,24 @@ send_udp_encap_details (const udp_encap_t * ue, svm_queue_t * q, u32 context) mp->table_id = htonl (fib_table->ft_table_id); mp->id = htonl (ue->ue_id); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void vl_api_udp_encap_dump_t_handler (vl_api_udp_encap_dump_t * mp, vlib_main_t * vm) { - svm_queue_t *q; + vl_api_registration_t *reg; udp_encap_t *ue; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; /* *INDENT-OFF* */ pool_foreach(ue, udp_encap_pool, ({ - send_udp_encap_details(ue, q, mp->context); + send_udp_encap_details(ue, reg, mp->context); })); /* *INDENT-ON* */ } diff --git a/src/vnet/unix/tap_api.c b/src/vnet/unix/tap_api.c index 23755722678..026a9632eb8 100644 --- a/src/vnet/unix/tap_api.c +++ b/src/vnet/unix/tap_api.c @@ -60,7 +60,7 @@ _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) */ static void send_sw_interface_event_deleted (vpe_api_main_t * am, - svm_queue_t * q, u32 sw_if_index) + vl_api_registration_t * reg, u32 sw_if_index) { vl_api_sw_interface_event_t *mp; @@ -72,7 +72,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am, mp->admin_up_down = 0; mp->link_up_down = 0; mp->deleted = 1; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -82,7 +82,7 @@ vl_api_tap_connect_t_handler (vl_api_tap_connect_t * mp) int rv; vl_api_tap_connect_reply_t *rmp; vnet_main_t *vnm = vnet_get_main (); - svm_queue_t *q; + vl_api_registration_t *reg; u32 sw_if_index = (u32) ~ 0; u8 *tag; vnet_tap_connect_args_t _a, *ap = &_a; @@ -118,8 +118,8 @@ vl_api_tap_connect_t_handler (vl_api_tap_connect_t * mp) vnet_set_sw_interface_tag (vnm, tag, sw_if_index); } - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -128,7 +128,7 @@ vl_api_tap_connect_t_handler (vl_api_tap_connect_t * mp) rmp->retval = ntohl (rv); rmp->sw_if_index = ntohl (sw_if_index); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -136,7 +136,7 @@ vl_api_tap_modify_t_handler (vl_api_tap_modify_t * mp) { int rv; vl_api_tap_modify_reply_t *rmp; - svm_queue_t *q; + vl_api_registration_t *reg; u32 sw_if_index = (u32) ~ 0; vlib_main_t *vm = vlib_get_main (); vnet_tap_connect_args_t _a, *ap = &_a; @@ -153,8 +153,8 @@ vl_api_tap_modify_t_handler (vl_api_tap_modify_t * mp) rv = vnet_tap_modify (vm, ap); - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -163,7 +163,7 @@ vl_api_tap_modify_t_handler (vl_api_tap_modify_t * mp) rmp->retval = ntohl (rv); rmp->sw_if_index = ntohl (sw_if_index); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -173,7 +173,7 @@ vl_api_tap_delete_t_handler (vl_api_tap_delete_t * mp) int rv; vpe_api_main_t *vam = &vpe_api_main; vl_api_tap_delete_reply_t *rmp; - svm_queue_t *q; + vl_api_registration_t *reg; u32 sw_if_index = ntohl (mp->sw_if_index); rv = vnet_tap_delete (vm, sw_if_index); @@ -183,8 +183,8 @@ vl_api_tap_delete_t_handler (vl_api_tap_delete_t * mp) vnet_clear_sw_interface_tag (vnm, sw_if_index); } - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -192,15 +192,15 @@ vl_api_tap_delete_t_handler (vl_api_tap_delete_t * mp) rmp->context = mp->context; rmp->retval = ntohl (rv); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); if (!rv) - send_sw_interface_event_deleted (vam, q, sw_if_index); + send_sw_interface_event_deleted (vam, reg, sw_if_index); } static void send_sw_interface_tap_details (vpe_api_main_t * am, - svm_queue_t * q, + vl_api_registration_t * reg, tapcli_interface_details_t * tap_if, u32 context) { @@ -213,7 +213,7 @@ send_sw_interface_tap_details (vpe_api_main_t * am, (char *) tap_if->dev_name, ARRAY_LEN (mp->dev_name) - 1); mp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (reg, (u8 *) mp); } static void @@ -221,12 +221,12 @@ vl_api_sw_interface_tap_dump_t_handler (vl_api_sw_interface_tap_dump_t * mp) { int rv = 0; vpe_api_main_t *am = &vpe_api_main; - svm_queue_t *q; + vl_api_registration_t *reg; tapcli_interface_details_t *tapifs = NULL; tapcli_interface_details_t *tap_if = NULL; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rv = vnet_tap_dump_ifs (&tapifs); @@ -235,7 +235,7 @@ vl_api_sw_interface_tap_dump_t_handler (vl_api_sw_interface_tap_dump_t * mp) vec_foreach (tap_if, tapifs) { - send_sw_interface_tap_details (am, q, tap_if, mp->context); + send_sw_interface_tap_details (am, reg, tap_if, mp->context); } vec_free (tapifs); diff --git a/src/vnet/vxlan-gpe/vxlan_gpe_api.c b/src/vnet/vxlan-gpe/vxlan_gpe_api.c index b3e300ecc55..a710bb5e2a1 100644 --- a/src/vnet/vxlan-gpe/vxlan_gpe_api.c +++ b/src/vnet/vxlan-gpe/vxlan_gpe_api.c @@ -144,7 +144,7 @@ out: } static void send_vxlan_gpe_tunnel_details - (vxlan_gpe_tunnel_t * t, svm_queue_t * q, u32 context) + (vxlan_gpe_tunnel_t * t, vl_api_registration_t * reg, u32 context) { vl_api_vxlan_gpe_tunnel_details_t *rmp; ip4_main_t *im4 = &ip4_main; @@ -175,22 +175,20 @@ static void send_vxlan_gpe_tunnel_details rmp->is_ipv6 = is_ipv6; rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_vxlan_gpe_tunnel_dump_t_handler (vl_api_vxlan_gpe_tunnel_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; vxlan_gpe_main_t *vgm = &vxlan_gpe_main; vxlan_gpe_tunnel_t *t; u32 sw_if_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; sw_if_index = ntohl (mp->sw_if_index); @@ -199,7 +197,7 @@ static void vl_api_vxlan_gpe_tunnel_dump_t_handler /* *INDENT-OFF* */ pool_foreach (t, vgm->tunnels, ({ - send_vxlan_gpe_tunnel_details(t, q, mp->context); + send_vxlan_gpe_tunnel_details(t, reg, mp->context); })); /* *INDENT-ON* */ } @@ -211,7 +209,7 @@ static void vl_api_vxlan_gpe_tunnel_dump_t_handler return; } t = &vgm->tunnels[vgm->tunnel_index_by_sw_if_index[sw_if_index]]; - send_vxlan_gpe_tunnel_details (t, q, mp->context); + send_vxlan_gpe_tunnel_details (t, reg, mp->context); } } diff --git a/src/vnet/vxlan/vxlan_api.c b/src/vnet/vxlan/vxlan_api.c index 20034f74f0e..1227f883e3e 100644 --- a/src/vnet/vxlan/vxlan_api.c +++ b/src/vnet/vxlan/vxlan_api.c @@ -116,7 +116,7 @@ out: } static void send_vxlan_tunnel_details - (vxlan_tunnel_t * t, svm_queue_t * q, u32 context) + (vxlan_tunnel_t * t, vl_api_registration_t * reg, u32 context) { vl_api_vxlan_tunnel_details_t *rmp; ip4_main_t *im4 = &ip4_main; @@ -145,22 +145,20 @@ static void send_vxlan_tunnel_details rmp->is_ipv6 = is_ipv6; rmp->context = context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void vl_api_vxlan_tunnel_dump_t_handler (vl_api_vxlan_tunnel_dump_t * mp) { - svm_queue_t *q; + vl_api_registration_t *reg; vxlan_main_t *vxm = &vxlan_main; vxlan_tunnel_t *t; u32 sw_if_index; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; sw_if_index = ntohl (mp->sw_if_index); @@ -169,7 +167,7 @@ static void vl_api_vxlan_tunnel_dump_t_handler /* *INDENT-OFF* */ pool_foreach (t, vxm->tunnels, ({ - send_vxlan_tunnel_details(t, q, mp->context); + send_vxlan_tunnel_details(t, reg, mp->context); })); /* *INDENT-ON* */ } @@ -181,7 +179,7 @@ static void vl_api_vxlan_tunnel_dump_t_handler return; } t = &vxm->tunnels[vxm->tunnel_index_by_sw_if_index[sw_if_index]]; - send_vxlan_tunnel_details (t, q, mp->context); + send_vxlan_tunnel_details (t, reg, mp->context); } } diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c index 70b104234b7..8bb11c96066 100644 --- a/src/vpp/api/api.c +++ b/src/vpp/api/api.c @@ -164,16 +164,16 @@ static void vl_api_cli_t_handler (vl_api_cli_t * mp) { vl_api_cli_reply_t *rp; - svm_queue_t *q; + vl_api_registration_t *reg; vlib_main_t *vm = vlib_get_main (); api_main_t *am = &api_main; unformat_input_t input; u8 *shmem_vec = 0; void *oldheap; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) - return; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return;; rp = vl_msg_api_alloc (sizeof (*rp)); rp->_vl_msg_id = ntohs (VL_API_CLI_REPLY); @@ -193,7 +193,7 @@ vl_api_cli_t_handler (vl_api_cli_t * mp) rp->reply_in_shmem = (uword) shmem_vec; - vl_msg_api_send_shmem (q, (u8 *) & rp); + vl_api_send_msg (reg, (u8 *) rp); } static void diff --git a/src/vpp/oam/oam_api.c b/src/vpp/oam/oam_api.c index 6d25a36f708..915d02d4cc6 100644 --- a/src/vpp/oam/oam_api.c +++ b/src/vpp/oam/oam_api.c @@ -47,22 +47,22 @@ void send_oam_event (oam_target_t * t) { vpe_api_main_t *vam = &vpe_api_main; - svm_queue_t *q; + vl_api_registration_t *vl_reg; vpe_client_registration_t *reg; vl_api_oam_event_t *mp; /* *INDENT-OFF* */ pool_foreach(reg, vam->oam_events_registrations, ({ - q = vl_api_client_index_to_input_queue (reg->client_index); - if (q) + vl_reg = vl_api_client_index_to_registration (reg->client_index); + if (vl_reg) { mp = vl_msg_api_alloc (sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_OAM_EVENT); clib_memcpy (mp->dst_address, &t->dst_address, sizeof (mp->dst_address)); mp->state = t->state; - vl_msg_api_send_shmem (q, (u8 *)&mp); + vl_api_send_msg (vl_reg, (u8 *)mp); } })); /* *INDENT-ON* */ diff --git a/src/vpp/stats/stats.c b/src/vpp/stats/stats.c index 2c3c8664258..4ac96dfa7e3 100644 --- a/src/vpp/stats/stats.c +++ b/src/vpp/stats/stats.c @@ -544,7 +544,7 @@ static void vl_api_want_interface_combined_stats_reply_t *rmp; uword *p; i32 retval = 0; - svm_queue_t *q; + vl_api_registration_t *reg; u32 swif; swif = ~0; //Using same mechanism as _per_interface_ @@ -555,9 +555,8 @@ static void mp->enable_disable); reply: - q = vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) { sm->enable_poller = clear_client_for_stat (IDX_PER_INTERFACE_COMBINED_COUNTERS, swif, @@ -570,7 +569,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -687,7 +686,7 @@ static void vlib_combined_counter_main_t *cm; uword *p; i32 retval = 0; - svm_queue_t *q; + vl_api_registration_t *reg; int i; u32 swif; @@ -718,9 +717,8 @@ static void } reply: - q = vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) { for (i = 0; i < mp->num; i++) { @@ -737,7 +735,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } /* Per Interface Combined distribution to client */ @@ -748,7 +746,7 @@ do_combined_per_interface_counters (stats_main_t * sm) vnet_interface_main_t *im = sm->interface_main; api_main_t *am = sm->api_main; vl_shmem_hdr_t *shmem_hdr = am->shmem_hdr; - svm_queue_t *q = NULL; + vl_api_registration_t *vl_reg; vlib_combined_counter_main_t *cm; /* * items_this_message will eventually be used to optimise the batching @@ -790,11 +788,14 @@ do_combined_per_interface_counters (stats_main_t * sm) timestamp = vlib_time_now (sm->vlib_main); vec_reset_length (sm->regs_tmp); + + /* *INDENT-OFF* */ pool_foreach (reg, - sm->stats_registrations[IDX_PER_INTERFACE_COMBINED_COUNTERS], - ( - { - vec_add1 (sm->regs_tmp, reg);})); + sm->stats_registrations[IDX_PER_INTERFACE_COMBINED_COUNTERS], + ({ + vec_add1 (sm->regs_tmp, reg); + })); + /* *INDENT-ON* */ for (i = 0; i < vec_len (sm->regs_tmp); i++) { @@ -807,21 +808,23 @@ do_combined_per_interface_counters (stats_main_t * sm) continue; } vec_reset_length (sm->clients_tmp); - pool_foreach (client, reg->clients, ( - { - vec_add1 (sm->clients_tmp, - client);} - )); + + /* *INDENT-OFF* */ + pool_foreach (client, reg->clients, ({ + vec_add1 (sm->clients_tmp, client); + })); + /* *INDENT-ON* */ //FIXME - should be doing non-variant part of mp here and managing // any alloc per client in that vec_foreach for (j = 0; j < vec_len (sm->clients_tmp); j++) { client = sm->clients_tmp[j]; - q = vl_api_client_index_to_input_queue (client->client_index); + + vl_reg = vl_api_client_index_to_registration (client->client_index); //Client may have disconnected abrubtly, clean up so we don't poll nothing. - if (!q) + if (!vl_reg) { sm->enable_poller = clear_client_for_stat (IDX_PER_INTERFACE_COMBINED_COUNTERS, @@ -860,7 +863,7 @@ do_combined_per_interface_counters (stats_main_t * sm) clib_mem_unaligned (&vp->tx_bytes, u64) = clib_host_to_net_u64 (v.bytes); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (vl_reg, (u8 *) mp); } } @@ -882,7 +885,7 @@ static void vlib_simple_counter_main_t *cm; uword *p; i32 retval = 0; - svm_queue_t *q; + vl_api_registration_t *reg; int i; u32 swif; @@ -912,10 +915,10 @@ static void } reply: - q = vl_api_client_index_to_input_queue (mp->client_index); + reg = vl_api_client_index_to_registration (mp->client_index); - //Client may have disconnected abrubtly, clean up so we don't poll nothing. - if (!q) + /* Client may have disconnected abruptly, clean up */ + if (!reg) { for (i = 0; i < mp->num; i++) { @@ -934,7 +937,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } /* Per Interface Simple distribution to client */ @@ -945,7 +948,7 @@ do_simple_per_interface_counters (stats_main_t * sm) vnet_interface_main_t *im = sm->interface_main; api_main_t *am = sm->api_main; vl_shmem_hdr_t *shmem_hdr = am->shmem_hdr; - svm_queue_t *q = NULL; + vl_api_registration_t *vl_reg; vlib_simple_counter_main_t *cm; /* * items_this_message will eventually be used to optimise the batching @@ -987,12 +990,13 @@ do_simple_per_interface_counters (stats_main_t * sm) timestamp = vlib_time_now (sm->vlib_main); vec_reset_length (sm->regs_tmp); + + /* *INDENT-OFF* */ pool_foreach (reg, - sm->stats_registrations[IDX_PER_INTERFACE_SIMPLE_COUNTERS], ( - { - vec_add1 - (sm->regs_tmp, - reg);})); + sm->stats_registrations[IDX_PER_INTERFACE_SIMPLE_COUNTERS], ({ + vec_add1 (sm->regs_tmp, reg); + })); + /* *INDENT-ON* */ for (i = 0; i < vec_len (sm->regs_tmp); i++) { @@ -1005,21 +1009,22 @@ do_simple_per_interface_counters (stats_main_t * sm) continue; } vec_reset_length (sm->clients_tmp); - pool_foreach (client, reg->clients, ( - { - vec_add1 (sm->clients_tmp, - client);} - )); + + /* *INDENT-OFF* */ + pool_foreach (client, reg->clients, ({ + vec_add1 (sm->clients_tmp, client); + })); + /* *INDENT-ON* */ //FIXME - should be doing non-variant part of mp here and managing // any alloc per client in that vec_foreach for (j = 0; j < vec_len (sm->clients_tmp); j++) { client = sm->clients_tmp[j]; - q = vl_api_client_index_to_input_queue (client->client_index); + vl_reg = vl_api_client_index_to_registration (client->client_index); - //Client may have disconnected abrubtly, clean up so we don't poll nothing. - if (!q) + /* Client may have disconnected abrubtly, clean up */ + if (!vl_reg) { sm->enable_poller = clear_client_for_stat (IDX_PER_INTERFACE_SIMPLE_COUNTERS, @@ -1086,7 +1091,7 @@ do_simple_per_interface_counters (stats_main_t * sm) v = vlib_get_simple_counter (cm, reg->item); clib_mem_unaligned (&vp->rx_mpls, u64) = clib_host_to_net_u64 (v); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (vl_reg, (u8 *) mp); } } @@ -2392,7 +2397,7 @@ vl_api_want_stats_t_handler (vl_api_want_stats_t * mp) uword *p; i32 retval = 0; u32 item; - svm_queue_t *q; + vl_api_registration_t *reg; item = ~0; //"ALL THE THINGS IN THE THINGS rp.client_index = mp->client_index; @@ -2417,9 +2422,8 @@ vl_api_want_stats_t_handler (vl_api_want_stats_t * mp) item, mp->enable_disable); reply: - q = vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) return; rmp = vl_msg_api_alloc (sizeof (*rmp)); @@ -2427,7 +2431,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -2440,7 +2444,7 @@ static void uword *p; i32 retval = 0; u32 swif; - svm_queue_t *q; + vl_api_registration_t *reg; swif = ~0; //Using same mechanism as _per_interface_ rp.client_index = mp->client_index; @@ -2450,9 +2454,9 @@ static void mp->enable_disable); reply: - q = vl_api_client_index_to_input_queue (mp->client_index); + reg = vl_api_client_index_to_registration (mp->client_index); - if (!q) + if (!reg) { sm->enable_poller = clear_client_for_stat (IDX_PER_INTERFACE_SIMPLE_COUNTERS, swif, @@ -2465,7 +2469,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } @@ -2477,7 +2481,7 @@ vl_api_want_ip4_fib_stats_t_handler (vl_api_want_ip4_fib_stats_t * mp) vl_api_want_ip4_fib_stats_reply_t *rmp; uword *p; i32 retval = 0; - svm_queue_t *q; + vl_api_registration_t *reg; u32 fib; fib = ~0; //Using same mechanism as _per_interface_ @@ -2488,9 +2492,9 @@ vl_api_want_ip4_fib_stats_t_handler (vl_api_want_ip4_fib_stats_t * mp) mp->enable_disable); reply: - q = vl_api_client_index_to_input_queue (mp->client_index); + reg = vl_api_client_index_to_registration (mp->client_index); - if (!q) + if (!reg) { sm->enable_poller = clear_client_for_stat (IDX_IP4_FIB_COUNTERS, fib, mp->client_index); @@ -2502,7 +2506,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -2513,7 +2517,7 @@ vl_api_want_ip4_mfib_stats_t_handler (vl_api_want_ip4_mfib_stats_t * mp) vl_api_want_ip4_mfib_stats_reply_t *rmp; uword *p; i32 retval = 0; - svm_queue_t *q; + vl_api_registration_t *reg; u32 mfib; mfib = ~0; //Using same mechanism as _per_interface_ @@ -2524,9 +2528,8 @@ vl_api_want_ip4_mfib_stats_t_handler (vl_api_want_ip4_mfib_stats_t * mp) mp->enable_disable); reply: - q = vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) { sm->enable_poller = clear_client_for_stat (IDX_IP4_MFIB_COUNTERS, mfib, mp->client_index); @@ -2538,7 +2541,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -2549,7 +2552,7 @@ vl_api_want_ip6_fib_stats_t_handler (vl_api_want_ip6_fib_stats_t * mp) vl_api_want_ip4_fib_stats_reply_t *rmp; uword *p; i32 retval = 0; - svm_queue_t *q; + vl_api_registration_t *reg; u32 fib; fib = ~0; //Using same mechanism as _per_interface_ @@ -2560,9 +2563,8 @@ vl_api_want_ip6_fib_stats_t_handler (vl_api_want_ip6_fib_stats_t * mp) mp->enable_disable); reply: - q = vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) { sm->enable_poller = clear_client_for_stat (IDX_IP6_FIB_COUNTERS, fib, mp->client_index); @@ -2574,7 +2576,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } static void @@ -2585,7 +2587,7 @@ vl_api_want_ip6_mfib_stats_t_handler (vl_api_want_ip6_mfib_stats_t * mp) vl_api_want_ip4_mfib_stats_reply_t *rmp; uword *p; i32 retval = 0; - svm_queue_t *q; + vl_api_registration_t *reg; u32 mfib; mfib = ~0; //Using same mechanism as _per_interface_ @@ -2596,9 +2598,8 @@ vl_api_want_ip6_mfib_stats_t_handler (vl_api_want_ip6_mfib_stats_t * mp) mp->enable_disable); reply: - q = vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) { sm->enable_poller = clear_client_for_stat (IDX_IP6_MFIB_COUNTERS, mfib, mp->client_index); @@ -2610,7 +2611,7 @@ reply: rmp->context = mp->context; rmp->retval = retval; - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } /* FIXME - NBR stats broken - this will be fixed in subsequent patch */ @@ -2635,13 +2636,11 @@ vl_api_vnet_get_summary_stats_t_handler (vl_api_vnet_get_summary_stats_t * mp) int i, which; u64 total_pkts[VLIB_N_RX_TX]; u64 total_bytes[VLIB_N_RX_TX]; + vl_api_registration_t *reg; - svm_queue_t *q = vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) - { - return; - } + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_VNET_GET_SUMMARY_STATS_REPLY); @@ -2673,7 +2672,7 @@ vl_api_vnet_get_summary_stats_t_handler (vl_api_vnet_get_summary_stats_t * mp) rmp->vector_rate = clib_host_to_net_u64 (vlib_last_vector_length_per_node (sm->vlib_main)); - vl_msg_api_send_shmem (q, (u8 *) & rmp); + vl_api_send_msg (reg, (u8 *) rmp); } int |