diff options
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/interface.c | 121 | ||||
-rw-r--r-- | src/vnet/ip/ip6.h | 1 | ||||
-rw-r--r-- | src/vnet/srp/interface.c | 84 | ||||
-rw-r--r-- | src/vnet/srp/node.c | 70 |
4 files changed, 1 insertions, 275 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 5cbbbf96055..45a265ccdae 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -102,52 +102,6 @@ unserialize_vec_vnet_sw_hw_interface_state (serialize_main_t * m, } } -static void -serialize_vnet_sw_hw_interface_set_flags (serialize_main_t * m, va_list * va) -{ - vnet_sw_hw_interface_state_t *s = - va_arg (*va, vnet_sw_hw_interface_state_t *); - serialize (m, serialize_vec_vnet_sw_hw_interface_state, s, 1); -} - -static void -unserialize_vnet_sw_interface_set_flags (serialize_main_t * m, va_list * va) -{ - CLIB_UNUSED (mc_main_t * mc) = va_arg (*va, mc_main_t *); - vnet_sw_hw_interface_state_t s; - - unserialize (m, unserialize_vec_vnet_sw_hw_interface_state, &s, 1); - - vnet_sw_interface_set_flags_helper - (vnet_get_main (), s.sw_hw_if_index, s.flags, - /* helper_flags no redistribution */ 0); -} - -static void -unserialize_vnet_hw_interface_set_flags (serialize_main_t * m, va_list * va) -{ - CLIB_UNUSED (mc_main_t * mc) = va_arg (*va, mc_main_t *); - vnet_sw_hw_interface_state_t s; - - unserialize (m, unserialize_vec_vnet_sw_hw_interface_state, &s, 1); - - vnet_hw_interface_set_flags_helper - (vnet_get_main (), s.sw_hw_if_index, s.flags, - /* helper_flags no redistribution */ 0); -} - -MC_SERIALIZE_MSG (vnet_sw_interface_set_flags_msg, static) = -{ -.name = "vnet_sw_interface_set_flags",.serialize = - serialize_vnet_sw_hw_interface_set_flags,.unserialize = - unserialize_vnet_sw_interface_set_flags,}; - -MC_SERIALIZE_MSG (vnet_hw_interface_set_flags_msg, static) = -{ -.name = "vnet_hw_interface_set_flags",.serialize = - serialize_vnet_sw_hw_interface_set_flags,.unserialize = - unserialize_vnet_hw_interface_set_flags,}; - void serialize_vnet_interface_state (serialize_main_t * m, va_list * va) { @@ -311,9 +265,6 @@ vnet_hw_interface_set_flags_helper (vnet_main_t * vnm, u32 hw_if_index, vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index); vnet_hw_interface_class_t *hw_class = vnet_get_hw_interface_class (vnm, hi->hw_class_index); - vnet_device_class_t *dev_class = - vnet_get_device_class (vnm, hi->dev_class_index); - vlib_main_t *vm = vnm->vlib_main; u32 mask; clib_error_t *error = 0; u32 is_create = @@ -332,19 +283,6 @@ vnet_hw_interface_set_flags_helper (vnet_main_t * vnm, u32 hw_if_index, if (!is_create && (hi->flags & mask) == flags) goto done; - /* Some interface classes do not redistribute (e.g. are local). */ - if (!dev_class->redistribute) - helper_flags &= ~VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE; - - if (vm->mc_main - && (helper_flags & VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE)) - { - vnet_sw_hw_interface_state_t s; - s.sw_hw_if_index = hw_if_index; - s.flags = flags; - mc_serialize (vm->mc_main, &vnet_hw_interface_set_flags_msg, &s); - } - if ((hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) != (flags & VNET_HW_INTERFACE_FLAG_LINK_UP)) { @@ -373,7 +311,6 @@ vnet_sw_interface_set_flags_helper (vnet_main_t * vnm, u32 sw_if_index, u32 flags, u32 helper_flags) { vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index); - vlib_main_t *vm = vnm->vlib_main; u32 mask; clib_error_t *error = 0; u32 is_create = @@ -451,16 +388,6 @@ vnet_sw_interface_set_flags_helper (vnet_main_t * vnm, u32 sw_if_index, ~VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE; } - if (vm->mc_main - && (helper_flags & - VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE)) - { - vnet_sw_hw_interface_state_t s; - s.sw_hw_if_index = sw_if_index; - s.flags = flags; - mc_serialize (vm->mc_main, &vnet_sw_interface_set_flags_msg, &s); - } - /* set the flags now before invoking the registered clients * so that the state they query is consistent with the state here notified */ old_flags = si->flags; @@ -1110,42 +1037,6 @@ vnet_sw_interface_walk (vnet_main_t * vnm, /* *INDENT-ON* */ } -static void -serialize_vnet_hw_interface_set_class (serialize_main_t * m, va_list * va) -{ - u32 hw_if_index = va_arg (*va, u32); - char *hw_class_name = va_arg (*va, char *); - serialize_integer (m, hw_if_index, sizeof (hw_if_index)); - serialize_cstring (m, hw_class_name); -} - -static void -unserialize_vnet_hw_interface_set_class (serialize_main_t * m, va_list * va) -{ - CLIB_UNUSED (mc_main_t * mc) = va_arg (*va, mc_main_t *); - vnet_main_t *vnm = vnet_get_main (); - u32 hw_if_index; - char *hw_class_name; - uword *p; - clib_error_t *error; - - unserialize_integer (m, &hw_if_index, sizeof (hw_if_index)); - unserialize_cstring (m, &hw_class_name); - p = - hash_get (vnm->interface_main.hw_interface_class_by_name, hw_class_name); - ASSERT (p != 0); - error = vnet_hw_interface_set_class_helper (vnm, hw_if_index, p[0], - /* redistribute */ 0); - if (error) - clib_error_report (error); -} - -MC_SERIALIZE_MSG (vnet_hw_interface_set_class_msg, static) = -{ -.name = "vnet_hw_interface_set_class",.serialize = - serialize_vnet_hw_interface_set_class,.unserialize = - unserialize_vnet_hw_interface_set_class,}; - void vnet_hw_interface_init_for_class (vnet_main_t * vnm, u32 hw_if_index, u32 hw_class_index, u32 hw_instance) @@ -1197,13 +1088,6 @@ vnet_hw_interface_set_class_helper (vnet_main_t * vnm, u32 hw_if_index, "%v class cannot be changed from %s to %s", hi->name, old_class->name, new_class->name); - if (vnm->vlib_main->mc_main) - { - mc_serialize (vnm->vlib_main->mc_main, - &vnet_hw_interface_set_class_msg, hw_if_index, - new_class->name); - return 0; - } } if (old_class->hw_class_change) @@ -1241,11 +1125,6 @@ vnet_hw_interface_rx_redirect_to_node_helper (vnet_main_t * vnm, vnet_device_class_t *dev_class = vnet_get_device_class (vnm, hi->dev_class_index); - if (redistribute) - { - /* $$$$ fixme someday maybe */ - ASSERT (vnm->vlib_main->mc_main == 0); - } if (dev_class->rx_redirect_to_node) { dev_class->rx_redirect_to_node (vnm, hw_if_index, node_index); diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h index a6feec5685e..bc89a0821ae 100644 --- a/src/vnet/ip/ip6.h +++ b/src/vnet/ip/ip6.h @@ -40,7 +40,6 @@ #ifndef included_ip_ip6_h #define included_ip_ip6_h -#include <vlib/mc.h> #include <vlib/buffer.h> #include <vnet/ethernet/packet.h> #include <vnet/ip/ip6_packet.h> diff --git a/src/vnet/srp/interface.c b/src/vnet/srp/interface.c index 735f960cbd3..bac2e75b1e9 100644 --- a/src/vnet/srp/interface.c +++ b/src/vnet/srp/interface.c @@ -111,63 +111,14 @@ void unserialize_srp_main (serialize_main_t * m, va_list * va) } } -static void serialize_srp_register_interface_msg (serialize_main_t * m, va_list * va) -{ - u32 * hw_if_indices = va_arg (*va, u32 *); - serialize_integer (m, hw_if_indices[SRP_SIDE_A], sizeof (hw_if_indices[SRP_SIDE_A])); - serialize_integer (m, hw_if_indices[SRP_SIDE_B], sizeof (hw_if_indices[SRP_SIDE_B])); -} - -static void unserialize_srp_register_interface_msg (serialize_main_t * m, va_list * va) -{ - CLIB_UNUSED (mc_main_t * mcm) = va_arg (*va, mc_main_t *); - u32 hw_if_indices[SRP_N_SIDE]; - srp_main_t * sm = &srp_main; - uword * p; - - unserialize_integer (m, &hw_if_indices[SRP_SIDE_A], sizeof (hw_if_indices[SRP_SIDE_A])); - unserialize_integer (m, &hw_if_indices[SRP_SIDE_B], sizeof (hw_if_indices[SRP_SIDE_B])); - - p = hash_get (sm->srp_register_interface_waiting_process_pool_index_by_hw_if_index, - hw_if_indices[0]); - if (p) - { - vlib_one_time_waiting_process_t * wp = pool_elt_at_index (sm->srp_register_interface_waiting_process_pool, p[0]); - vlib_signal_one_time_waiting_process (mcm->vlib_main, wp); - pool_put (sm->srp_register_interface_waiting_process_pool, wp); - hash_unset (sm->srp_register_interface_waiting_process_pool_index_by_hw_if_index, - hw_if_indices[0]); - } - else - srp_register_interface_helper (hw_if_indices, /* redistribute */ 0); -} - -MC_SERIALIZE_MSG (srp_register_interface_msg, static) = { - .name = "vnet_srp_register_interface", - .serialize = serialize_srp_register_interface_msg, - .unserialize = unserialize_srp_register_interface_msg, -}; - static void srp_register_interface_helper (u32 * hw_if_indices_by_side, u32 redistribute) { vnet_main_t * vnm = vnet_get_main(); srp_main_t * sm = &srp_main; - vlib_main_t * vm = sm->vlib_main; srp_interface_t * si; vnet_hw_interface_t * hws[SRP_N_RING]; uword s, * p; - if (vm->mc_main && redistribute) - { - vlib_one_time_waiting_process_t * wp; - mc_serialize (vm->mc_main, &srp_register_interface_msg, hw_if_indices_by_side); - pool_get (sm->srp_register_interface_waiting_process_pool, wp); - hash_set (sm->srp_register_interface_waiting_process_pool_index_by_hw_if_index, - hw_if_indices_by_side[0], - wp - sm->srp_register_interface_waiting_process_pool); - vlib_current_process_wait_for_one_time_event (vm, wp); - } - /* Check if interface has already been registered. */ p = hash_get (sm->interface_index_by_hw_if_index, hw_if_indices_by_side[0]); if (p) @@ -298,36 +249,6 @@ VNET_HW_INTERFACE_CLASS (srp_hw_interface_class) = { .hw_class_change = srp_interface_hw_class_change, }; -static void serialize_srp_interface_config_msg (serialize_main_t * m, va_list * va) -{ - srp_interface_t * si = va_arg (*va, srp_interface_t *); - srp_main_t * sm = &srp_main; - - ASSERT (! pool_is_free (sm->interface_pool, si)); - serialize_integer (m, si - sm->interface_pool, sizeof (u32)); - serialize (m, serialize_f64, si->config.wait_to_restore_idle_delay); - serialize (m, serialize_f64, si->config.ips_tx_interval); -} - -static void unserialize_srp_interface_config_msg (serialize_main_t * m, va_list * va) -{ - CLIB_UNUSED (mc_main_t * mcm) = va_arg (*va, mc_main_t *); - srp_main_t * sm = &srp_main; - srp_interface_t * si; - u32 si_index; - - unserialize_integer (m, &si_index, sizeof (u32)); - si = pool_elt_at_index (sm->interface_pool, si_index); - unserialize (m, unserialize_f64, &si->config.wait_to_restore_idle_delay); - unserialize (m, unserialize_f64, &si->config.ips_tx_interval); -} - -MC_SERIALIZE_MSG (srp_interface_config_msg, static) = { - .name = "vnet_srp_interface_config", - .serialize = serialize_srp_interface_config_msg, - .unserialize = unserialize_srp_interface_config_msg, -}; - void srp_interface_get_interface_config (u32 hw_if_index, srp_interface_config_t * c) { srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index); @@ -337,22 +258,17 @@ void srp_interface_get_interface_config (u32 hw_if_index, srp_interface_config_t void srp_interface_set_interface_config (u32 hw_if_index, srp_interface_config_t * c) { - srp_main_t * sm = &srp_main; - vlib_main_t * vm = sm->vlib_main; srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index); ASSERT (si != 0); if (memcmp (&si->config, &c[0], sizeof (c[0]))) { si->config = c[0]; - if (vm->mc_main) - mc_serialize (vm->mc_main, &srp_interface_config_msg, si); } } #if DEBUG > 0 #define VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT VNET_INTERFACE_TX_N_NEXT - /* Echo packets back to srp input. */ static uword simulated_srp_interface_tx (vlib_main_t * vm, diff --git a/src/vnet/srp/node.c b/src/vnet/srp/node.c index acb770e52c8..25cf0c07554 100644 --- a/src/vnet/srp/node.c +++ b/src/vnet/srp/node.c @@ -640,63 +640,6 @@ static void tx_ips_packet (srp_interface_t * si, vlib_put_frame_to_node (vm, hi->output_node_index, f); } -static void serialize_srp_interface_state_msg (serialize_main_t * m, va_list * va) -{ - srp_interface_t * si = va_arg (*va, srp_interface_t *); - srp_main_t * sm = &srp_main; - int r; - - ASSERT (! pool_is_free (sm->interface_pool, si)); - serialize_integer (m, si - sm->interface_pool, sizeof (u32)); - serialize_likely_small_unsigned_integer (m, si->current_ips_state); - for (r = 0; r < SRP_N_RING; r++) - { - srp_interface_ring_t * ir = &si->rings[r]; - void * p; - serialize_likely_small_unsigned_integer (m, ir->rx_neighbor_address_valid); - if (ir->rx_neighbor_address_valid) - { - p = serialize_get (m, sizeof (ir->rx_neighbor_address)); - clib_memcpy (p, ir->rx_neighbor_address, sizeof (ir->rx_neighbor_address)); - } - serialize_likely_small_unsigned_integer (m, ir->waiting_to_restore); - if (ir->waiting_to_restore) - serialize (m, serialize_f64, ir->wait_to_restore_start_time); - } -} - -static void unserialize_srp_interface_state_msg (serialize_main_t * m, va_list * va) -{ - CLIB_UNUSED (mc_main_t * mcm) = va_arg (*va, mc_main_t *); - srp_main_t * sm = &srp_main; - srp_interface_t * si; - u32 si_index, r; - - unserialize_integer (m, &si_index, sizeof (u32)); - si = pool_elt_at_index (sm->interface_pool, si_index); - si->current_ips_state = unserialize_likely_small_unsigned_integer (m); - for (r = 0; r < SRP_N_RING; r++) - { - srp_interface_ring_t * ir = &si->rings[r]; - void * p; - ir->rx_neighbor_address_valid = unserialize_likely_small_unsigned_integer (m); - if (ir->rx_neighbor_address_valid) - { - p = unserialize_get (m, sizeof (ir->rx_neighbor_address)); - clib_memcpy (ir->rx_neighbor_address, p, sizeof (ir->rx_neighbor_address)); - } - ir->waiting_to_restore = unserialize_likely_small_unsigned_integer (m); - if (ir->waiting_to_restore) - unserialize (m, unserialize_f64, &ir->wait_to_restore_start_time); - } -} - -MC_SERIALIZE_MSG (srp_interface_state_msg, static) = { - .name = "vnet_srp_interface_state", - .serialize = serialize_srp_interface_state_msg, - .unserialize = unserialize_srp_interface_state_msg, -}; - static int requests_switch (srp_ips_request_type_t r) { static u8 t[16] = { @@ -716,7 +659,6 @@ void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * h) srp_ring_type_t rx_ring; srp_interface_t * si = srp_get_interface (sw_if_index, &rx_ring); srp_interface_ring_t * ir = &si->rings[rx_ring]; - int si_needs_broadcast = 0; /* FIXME trace. */ if (0) @@ -751,7 +693,6 @@ void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * h) { srp_ips_header_t to_tx[2]; - si_needs_broadcast = 1; si->current_ips_state = SRP_IPS_STATE_wrapped; si->hw_wrap_function (si->rings[SRP_SIDE_A].hw_if_index, /* enable_wrap */ 1); si->hw_wrap_function (si->rings[SRP_SIDE_B].hw_if_index, /* enable_wrap */ 1); @@ -775,7 +716,6 @@ void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * h) && h->request_type == SRP_IPS_REQUEST_idle && h->status == SRP_IPS_STATUS_idle) { - si_needs_broadcast = 1; si->current_ips_state = SRP_IPS_STATE_idle; si->hw_wrap_function (si->rings[SRP_SIDE_A].hw_if_index, /* enable_wrap */ 0); si->hw_wrap_function (si->rings[SRP_SIDE_B].hw_if_index, /* enable_wrap */ 0); @@ -790,10 +730,8 @@ void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * h) abort (); break; } - done: - if (vm->mc_main && si_needs_broadcast) - mc_serialize (vm->mc_main, &srp_interface_state_msg, si); + ; } /* Preform local IPS request on given interface. */ @@ -801,11 +739,9 @@ void srp_ips_local_request (u32 sw_if_index, srp_ips_request_type_t request) { vnet_main_t * vnm = vnet_get_main(); srp_main_t * sm = &srp_main; - vlib_main_t * vm = sm->vlib_main; srp_ring_type_t rx_ring; srp_interface_t * si = srp_get_interface (sw_if_index, &rx_ring); srp_interface_ring_t * ir = &si->rings[rx_ring]; - int si_needs_broadcast = 0; if (request == SRP_IPS_REQUEST_wait_to_restore) { @@ -815,13 +751,11 @@ void srp_ips_local_request (u32 sw_if_index, srp_ips_request_type_t request) { ir->wait_to_restore_start_time = vlib_time_now (sm->vlib_main); ir->waiting_to_restore = 1; - si_needs_broadcast = 1; } } else { /* FIXME handle local signal fail. */ - si_needs_broadcast = ir->waiting_to_restore; ir->wait_to_restore_start_time = 0; ir->waiting_to_restore = 0; } @@ -832,8 +766,6 @@ void srp_ips_local_request (u32 sw_if_index, srp_ips_request_type_t request) format_vnet_sw_if_index_name, vnm, sw_if_index, format_srp_ips_request_type, request); - if (vm->mc_main && si_needs_broadcast) - mc_serialize (vm->mc_main, &srp_interface_state_msg, si); } static void maybe_send_ips_message (srp_interface_t * si) |