diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/bfd/bfd_api.c | 43 | ||||
-rw-r--r-- | src/vnet/bfd/bfd_api.h | 3 | ||||
-rw-r--r-- | src/vnet/bfd/bfd_udp.c | 12 |
3 files changed, 29 insertions, 29 deletions
diff --git a/src/vnet/bfd/bfd_api.c b/src/vnet/bfd/bfd_api.c index 126cf29a..2e63fe90 100644 --- a/src/vnet/bfd/bfd_api.c +++ b/src/vnet/bfd/bfd_api.c @@ -43,12 +43,12 @@ #include <vlibapi/api_helper_macros.h> -#define foreach_vpe_api_msg \ -_(BFD_UDP_ADD, bfd_udp_add) \ -_(BFD_UDP_DEL, bfd_udp_del) \ -_(BFD_UDP_SESSION_DUMP, bfd_udp_session_dump) \ -_(BFD_SESSION_SET_FLAGS, bfd_session_set_flags) \ -_(WANT_BFD_EVENTS, want_bfd_events) +#define foreach_vpe_api_msg \ + _ (BFD_UDP_ADD, bfd_udp_add) \ + _ (BFD_UDP_DEL, bfd_udp_del) \ + _ (BFD_UDP_SESSION_DUMP, bfd_udp_session_dump) \ + _ (BFD_SESSION_SET_FLAGS, bfd_session_set_flags) \ + _ (WANT_BFD_EVENTS, want_bfd_events) pub_sub_handler (bfd_events, BFD_EVENTS); @@ -75,13 +75,16 @@ vl_api_bfd_udp_add_t_handler (vl_api_bfd_udp_add_t * mp) clib_memcpy (&peer_addr.ip4, mp->peer_addr, sizeof (peer_addr.ip4)); } + u32 bs_index = 0; rv = bfd_udp_add_session (clib_net_to_host_u32 (mp->sw_if_index), clib_net_to_host_u32 (mp->desired_min_tx), clib_net_to_host_u32 (mp->required_min_rx), - mp->detect_mult, &local_addr, &peer_addr); + mp->detect_mult, &local_addr, &peer_addr, + &bs_index); BAD_SW_IF_INDEX_LABEL; - REPLY_MACRO (VL_API_BFD_UDP_ADD_REPLY); + REPLY_MACRO2 (VL_API_BFD_UDP_ADD_REPLY, + rmp->bs_index = clib_host_to_net_u32 (bs_index)); } static void @@ -107,9 +110,8 @@ vl_api_bfd_udp_del_t_handler (vl_api_bfd_udp_del_t * mp) clib_memcpy (&peer_addr.ip4, mp->peer_addr, sizeof (peer_addr.ip4)); } - rv = - bfd_udp_del_session (clib_net_to_host_u32 (mp->sw_if_index), &local_addr, - &peer_addr); + rv = bfd_udp_del_session (clib_net_to_host_u32 (mp->sw_if_index), + &local_addr, &peer_addr); BAD_SW_IF_INDEX_LABEL; REPLY_MACRO (VL_API_BFD_UDP_DEL_REPLY); @@ -201,14 +203,12 @@ vl_api_bfd_session_set_flags_t_handler (vl_api_bfd_session_set_flags_t * mp) vl_api_bfd_session_set_flags_reply_t *rmp; int rv; - rv = - bfd_session_set_flags (clib_net_to_host_u32 (mp->bs_index), - mp->admin_up_down); + rv = bfd_session_set_flags (clib_net_to_host_u32 (mp->bs_index), + mp->admin_up_down); REPLY_MACRO (VL_API_BFD_SESSION_SET_FLAGS_REPLY); } - /* * bfd_api_hookup * Add vpe's API message handlers to the table. @@ -223,7 +223,7 @@ vl_api_bfd_session_set_flags_t_handler (vl_api_bfd_session_set_flags_t * mp) static void setup_message_id_table (api_main_t * am) { -#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); +#define _(id, n, crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); foreach_vl_msg_name_crc_bfd; #undef _ } @@ -233,13 +233,10 @@ bfd_api_hookup (vlib_main_t * vm) { api_main_t *am = &api_main; -#define _(N,n) \ - vl_msg_api_set_handlers(VL_API_##N, #n, \ - vl_api_##n##_t_handler, \ - vl_noop_handler, \ - vl_api_##n##_t_endian, \ - vl_api_##n##_t_print, \ - sizeof(vl_api_##n##_t), 1); +#define _(N, n) \ + vl_msg_api_set_handlers (VL_API_##N, #n, vl_api_##n##_t_handler, \ + vl_noop_handler, vl_api_##n##_t_endian, \ + vl_api_##n##_t_print, sizeof (vl_api_##n##_t), 1); foreach_vpe_api_msg; #undef _ diff --git a/src/vnet/bfd/bfd_api.h b/src/vnet/bfd/bfd_api.h index cfcd04f3..a9bc5a1f 100644 --- a/src/vnet/bfd/bfd_api.h +++ b/src/vnet/bfd/bfd_api.h @@ -27,7 +27,8 @@ vnet_api_error_t bfd_udp_add_session (u32 sw_if_index, u32 desired_min_tx_us, u32 required_min_rx_us, u8 detect_mult, const ip46_address_t * local_addr, - const ip46_address_t * peer_addr); + const ip46_address_t * peer_addr, + u32 * bs_index); vnet_api_error_t bfd_udp_del_session (u32 sw_if_index, const ip46_address_t * local_addr, diff --git a/src/vnet/bfd/bfd_udp.c b/src/vnet/bfd/bfd_udp.c index 677f1e22..c1596bf6 100644 --- a/src/vnet/bfd/bfd_udp.c +++ b/src/vnet/bfd/bfd_udp.c @@ -95,7 +95,7 @@ static vnet_api_error_t bfd_udp_add_session_internal (bfd_udp_main_t *bum, u32 sw_if_index, u32 desired_min_tx_us, u32 required_min_rx_us, u8 detect_mult, const ip46_address_t *local_addr, - const ip46_address_t *peer_addr) + const ip46_address_t *peer_addr, u32 *bs_index) { vnet_sw_interface_t *sw_if = vnet_get_sw_interface (vnet_get_main (), sw_if_index); @@ -149,6 +149,7 @@ bfd_udp_add_session_internal (bfd_udp_main_t *bum, u32 sw_if_index, bs->required_min_echo_rx_us = required_min_rx_us; /* FIXME */ bs->local_detect_mult = detect_mult; bfd_session_start (bum->bfd_main, bs); + *bs_index = bs->bs_idx; return 0; } @@ -224,7 +225,8 @@ bfd_udp_validate_api_input (u32 sw_if_index, const ip46_address_t *local_addr, vnet_api_error_t bfd_udp_add_session (u32 sw_if_index, u32 desired_min_tx_us, u32 required_min_rx_us, u8 detect_mult, const ip46_address_t *local_addr, - const ip46_address_t *peer_addr) + const ip46_address_t *peer_addr, + u32 *bs_index) { vnet_api_error_t rv = bfd_udp_validate_api_input (sw_if_index, local_addr, peer_addr); @@ -242,9 +244,9 @@ vnet_api_error_t bfd_udp_add_session (u32 sw_if_index, u32 desired_min_tx_us, BFD_ERR ("desired_min_tx_us < 1"); return VNET_API_ERROR_INVALID_ARGUMENT; } - return bfd_udp_add_session_internal (&bfd_udp_main, sw_if_index, - desired_min_tx_us, required_min_rx_us, - detect_mult, local_addr, peer_addr); + return bfd_udp_add_session_internal ( + &bfd_udp_main, sw_if_index, desired_min_tx_us, required_min_rx_us, + detect_mult, local_addr, peer_addr, bs_index); } vnet_api_error_t bfd_udp_del_session (u32 sw_if_index, |