summaryrefslogtreecommitdiffstats
path: root/src/vnet/bfd/bfd_api.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-09 06:39:23 -0800
committerDave Barach <openvpp@barachs.net>2018-01-11 19:46:01 +0000
commit6c4dae27e75fc668f86c9cca0f3f58273b680621 (patch)
tree88c2adee0a2eb2c5e48471da2ef010e46cc270ab /src/vnet/bfd/bfd_api.c
parentf72212e00282712f5829a7f76a8cb6f486cdae60 (diff)
api: remove transport specific code from handlers
This does not update api client code. In other words, if the client assumes the transport is shmem based, this patch does not change that. Furthermore, code that checks queue size, for tail dropping, is not updated. Done for the following apis: Plugins - acl - gtpu - memif - nat - pppoe VNET - bfd - bier - tapv2 - vhost user - dhcp - flow - geneve - ip - punt - ipsec/ipsec-gre - l2 - l2tp - lisp-cp/one-cp - lisp-gpe - map - mpls - policer - session - span - udp - tap - vxlan/vxlan-gpe - interface VPP - api/api.c OAM - oam_api.c Stats - stats.c Change-Id: I0e33ecefb2bdab0295698c0add948068a5a83345 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/bfd/bfd_api.c')
-rw-r--r--src/vnet/bfd/bfd_api.c70
1 files changed, 34 insertions, 36 deletions
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* */
}