aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/srp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/srp')
-rw-r--r--src/vnet/srp/interface.c84
-rw-r--r--src/vnet/srp/node.c70
2 files changed, 1 insertions, 153 deletions
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)