aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2018-03-29 10:35:41 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-30 20:44:56 +0000
commitdd4889e21cb15df541cf3b2c2d8bb971ce460359 (patch)
tree8725f6c47f27e754e9712816c7b15e4db596c421 /src/plugins
parent70488ab7f87096534aaadd7eab30e8515ac3d60d (diff)
lacp: faster convergence for slow-rate config option
Do fast-rate if we are not yet synchronized with the partner. Stop sending LACP updates as a flash in the worker thread. Just expire the timer and let the lacp_process handle sending LACP PDU. Change-Id: I8b36fe74e752e7f45bd4a8d70512c0341cc197a1 Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lacp/lacp.c8
-rw-r--r--src/plugins/lacp/mux_machine.c12
-rw-r--r--src/plugins/lacp/ptx_machine.c2
-rw-r--r--src/plugins/lacp/ptx_machine.h15
-rw-r--r--src/plugins/lacp/rx_machine.c6
-rw-r--r--src/plugins/lacp/tx_machine.c4
6 files changed, 29 insertions, 18 deletions
diff --git a/src/plugins/lacp/lacp.c b/src/plugins/lacp/lacp.c
index 5fe505a4f0f..378d22be931 100644
--- a/src/plugins/lacp/lacp.c
+++ b/src/plugins/lacp/lacp.c
@@ -89,7 +89,7 @@ lacp_send_ethernet_lacp_pdu (slave_if_t * sif)
vlib_put_frame_to_node (vm, hw->output_node_index, f);
- sif->last_lacpdu_time = vlib_time_now (vm);
+ sif->last_lacpdu_time = vlib_time_now (lm->vlib_main);
}
/*
@@ -106,8 +106,6 @@ lacp_pick_packet_template (slave_if_t * sif)
void
lacp_send_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
{
- lacp_main_t *lm = &lacp_main;
-
if (sif->mode != BOND_MODE_LACP)
{
lacp_stop_timer (&sif->periodic_timer);
@@ -133,10 +131,6 @@ lacp_send_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
default:
ASSERT (0);
}
-
- lacp_start_periodic_timer (lm->vlib_main, sif, sif->is_long_timeout ?
- LACP_SLOW_PERIODIC_TIMER :
- LACP_FAST_PERIODIC_TIMER);
}
void
diff --git a/src/plugins/lacp/mux_machine.c b/src/plugins/lacp/mux_machine.c
index f33c2642f20..9c7cf746660 100644
--- a/src/plugins/lacp/mux_machine.c
+++ b/src/plugins/lacp/mux_machine.c
@@ -98,14 +98,14 @@ lacp_mux_action_detached (void *p1, void *p2)
{
vlib_main_t *vm = (vlib_main_t *) p1;
slave_if_t *sif = (slave_if_t *) p2;
+ lacp_main_t *lm = &lacp_main;
lacp_detach_mux_from_aggregator (vm, sif);
sif->actor.state &= ~LACP_STATE_COLLECTING;
bond_disable_collecting_distributing (vm, sif);
sif->actor.state &= ~LACP_STATE_DISTRIBUTING;
sif->ntt = 1;
- lacp_machine_dispatch (&lacp_tx_machine, vm, sif, LACP_TX_EVENT_NTT,
- &sif->tx_state);
+ lacp_start_periodic_timer (lm->vlib_main, sif, 0);
if (sif->selected == LACP_PORT_SELECTED)
lacp_machine_dispatch (&lacp_mux_machine, vm, sif,
@@ -123,14 +123,14 @@ lacp_mux_action_attached (void *p1, void *p2)
{
vlib_main_t *vm = (vlib_main_t *) p1;
slave_if_t *sif = (slave_if_t *) p2;
+ lacp_main_t *lm = &lacp_main;
lacp_attach_mux_to_aggregator (vm, sif);
sif->actor.state &= ~LACP_STATE_COLLECTING;
bond_disable_collecting_distributing (vm, sif);
sif->actor.state &= ~LACP_STATE_DISTRIBUTING;
sif->ntt = 1;
- lacp_machine_dispatch (&lacp_tx_machine, vm, sif, LACP_TX_EVENT_NTT,
- &sif->tx_state);
+ lacp_start_periodic_timer (lm->vlib_main, sif, 0);
if ((sif->selected == LACP_PORT_UNSELECTED) ||
(sif->selected == LACP_PORT_STANDBY))
@@ -171,13 +171,13 @@ lacp_mux_action_collecting_distributing (void *p1, void *p2)
{
vlib_main_t *vm = (vlib_main_t *) p1;
slave_if_t *sif = (slave_if_t *) p2;
+ lacp_main_t *lm = &lacp_main;
sif->actor.state |= LACP_STATE_SYNCHRONIZATION | LACP_STATE_COLLECTING |
LACP_STATE_DISTRIBUTING;
bond_enable_collecting_distributing (vm, sif);
sif->ntt = 1;
- lacp_machine_dispatch (&lacp_tx_machine, vm, sif, LACP_TX_EVENT_NTT,
- &sif->tx_state);
+ lacp_start_periodic_timer (lm->vlib_main, sif, 0);
if ((sif->selected == LACP_PORT_UNSELECTED) ||
(sif->selected == LACP_PORT_STANDBY) ||
!(sif->partner.state & LACP_STATE_SYNCHRONIZATION))
diff --git a/src/plugins/lacp/ptx_machine.c b/src/plugins/lacp/ptx_machine.c
index ac83444b08a..5a1c6d88621 100644
--- a/src/plugins/lacp/ptx_machine.c
+++ b/src/plugins/lacp/ptx_machine.c
@@ -99,7 +99,7 @@ lacp_ptx_action_slow_periodic (void *p1, void *p2)
else
timer_expired = 0;
- lacp_start_periodic_timer (lm->vlib_main, sif, LACP_SLOW_PERIODIC_TIMER);
+ lacp_schedule_periodic_timer (lm->vlib_main, sif);
if (timer_expired || (sif->partner.state & LACP_STATE_LACP_TIMEOUT))
lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
diff --git a/src/plugins/lacp/ptx_machine.h b/src/plugins/lacp/ptx_machine.h
index a9af4bb89d3..6183b633ae1 100644
--- a/src/plugins/lacp/ptx_machine.h
+++ b/src/plugins/lacp/ptx_machine.h
@@ -69,6 +69,21 @@ lacp_start_periodic_timer (vlib_main_t * vm, slave_if_t * sif, u8 expiration)
sif->periodic_timer = vlib_time_now (vm) + expiration;
}
+static inline void
+lacp_schedule_periodic_timer (vlib_main_t * vm, slave_if_t * sif)
+{
+ // do fast rate if we are not yet synchronized
+ if (((sif->actor.state & (LACP_STATE_SYNCHRONIZATION |
+ LACP_STATE_COLLECTING |
+ LACP_STATE_DISTRIBUTING)) !=
+ (LACP_STATE_SYNCHRONIZATION | LACP_STATE_COLLECTING |
+ LACP_STATE_DISTRIBUTING))
+ && (sif->partner.state & LACP_STATE_AGGREGATION))
+ lacp_start_periodic_timer (vm, sif, LACP_FAST_PERIODIC_TIMER);
+ else
+ lacp_start_periodic_timer (vm, sif, LACP_SLOW_PERIODIC_TIMER);
+}
+
#endif /* __LACP_PTX_MACHINE_H__ */
/*
diff --git a/src/plugins/lacp/rx_machine.c b/src/plugins/lacp/rx_machine.c
index 374e3f84939..fd65aa3ae8e 100644
--- a/src/plugins/lacp/rx_machine.c
+++ b/src/plugins/lacp/rx_machine.c
@@ -174,6 +174,7 @@ lacp_update_ntt (vlib_main_t * vm, slave_if_t * sif)
lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
u8 states = LACP_STATE_LACP_ACTIVITY | LACP_STATE_LACP_TIMEOUT |
LACP_STATE_SYNCHRONIZATION | LACP_STATE_AGGREGATION;
+ lacp_main_t *lm = &lacp_main;
if ((states & lacpdu->partner.port_info.state) !=
(states & sif->actor.state)
@@ -181,8 +182,7 @@ lacp_update_ntt (vlib_main_t * vm, slave_if_t * sif)
sizeof (sif->actor) - sizeof (sif->actor.state)))
{
sif->ntt = 1;
- lacp_machine_dispatch (&lacp_tx_machine, vm, sif, LACP_TX_EVENT_NTT,
- &sif->tx_state);
+ lacp_start_periodic_timer (lm->vlib_main, sif, 0);
}
}
@@ -292,7 +292,7 @@ lacp_rx_action_expired (void *p1, void *p2)
timer_expired = 1;
else
timer_expired = 0;
- lacp_start_current_while_timer (lm->vlib_main, sif, LACP_SHORT_TIMOUT_TIME);
+ lacp_start_current_while_timer (lm->vlib_main, sif, sif->ttl_in_seconds);
sif->actor.state |= LACP_STATE_EXPIRED;
if (timer_expired)
lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
diff --git a/src/plugins/lacp/tx_machine.c b/src/plugins/lacp/tx_machine.c
index 794b4f10d95..21b767c39d2 100644
--- a/src/plugins/lacp/tx_machine.c
+++ b/src/plugins/lacp/tx_machine.c
@@ -40,7 +40,8 @@ lacp_tx_action_transmit (void *p1, void *p2)
{
vlib_main_t *vm = (vlib_main_t *) p1;
slave_if_t *sif = (slave_if_t *) p2;
- f64 now = vlib_time_now (vm);
+ lacp_main_t *lm = &lacp_main;
+ f64 now = vlib_time_now (lm->vlib_main);
if (!lacp_timer_is_running (sif->periodic_timer))
return 0;
@@ -52,6 +53,7 @@ lacp_tx_action_transmit (void *p1, void *p2)
if (sif->ntt)
{
lacp_send_lacp_pdu (vm, sif);
+ lacp_schedule_periodic_timer (lm->vlib_main, sif);
}
sif->ntt = 0;