summaryrefslogtreecommitdiffstats
path: root/src/plugins/lacp/rx_machine.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2019-03-05 09:38:33 -0800
committerDamjan Marion <dmarion@me.com>2019-04-03 16:32:37 +0000
commit82c5dda455ce56ffaf8813b7fbee661e6dbb7cea (patch)
tree0a4b607e46396ac28fe7f573b6b237de4ed8c16d /src/plugins/lacp/rx_machine.c
parent5ae793ac4e5b3fa288ed5838d8d92ce15eb950bd (diff)
lacp: passive mode support [VPP-1551]
By definition, passive mode means the node does not start sending lacp pdu until it first hears from the partner or remote. - Rename ptx machine's BEGIN state to NO_PERIODIC state. - Put periodic machine in NO_PERIDOIC state when the interface is enabled for lacp. ptx machine will transition out of NO_PERIODIC state when the local node hears from the remote or when the local node is configured for active mode. - Also add send and receive statistics for debugging. Change-Id: I747953b9595ed31328b2f4f3e7a8d15d01e04d7f Signed-off-by: Steven Luong <sluong@cisco.com>
Diffstat (limited to 'src/plugins/lacp/rx_machine.c')
-rw-r--r--src/plugins/lacp/rx_machine.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/lacp/rx_machine.c b/src/plugins/lacp/rx_machine.c
index fd65aa3ae8e..070b9089cd2 100644
--- a/src/plugins/lacp/rx_machine.c
+++ b/src/plugins/lacp/rx_machine.c
@@ -206,11 +206,15 @@ lacp_compare_partner (slave_if_t * sif)
}
static void
-lacp_record_pdu (slave_if_t * sif)
+lacp_record_pdu (vlib_main_t * vm, slave_if_t * sif)
{
lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
u8 match;
+ /* Transition PTX out of NO_PERIODIC if needed */
+ if (!(sif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
+ (lacpdu->actor.port_info.state & LACP_STATE_LACP_ACTIVITY))
+ lacp_ptx_post_short_timeout_event (vm, sif);
match = lacp_compare_partner (sif);
sif->partner = lacpdu->actor.port_info;
sif->actor.state &= ~LACP_STATE_DEFAULTED;
@@ -285,8 +289,7 @@ lacp_rx_action_expired (void *p1, void *p2)
sif->partner.state &= ~LACP_STATE_SYNCHRONIZATION;
sif->partner.state |= LACP_STATE_LACP_TIMEOUT;
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_SHORT_TIMEOUT, &sif->ptx_state);
+ lacp_ptx_post_short_timeout_event (vm, sif);
if (lacp_timer_is_running (sif->current_while_timer) &&
lacp_timer_is_expired (lm->vlib_main, sif->current_while_timer))
timer_expired = 1;
@@ -324,6 +327,7 @@ lacp_rx_action_defaulted (void *p1, void *p2)
vlib_main_t *vm = (vlib_main_t *) p1;
slave_if_t *sif = (slave_if_t *) p2;
+ lacp_stop_timer (&sif->current_while_timer);
lacp_update_default_selected (vm, sif);
lacp_record_default (sif);
sif->actor.state &= ~LACP_STATE_EXPIRED;
@@ -365,7 +369,7 @@ lacp_rx_action_current (void *p1, void *p2)
lacp_update_selected (vm, sif);
lacp_update_ntt (vm, sif);
- lacp_record_pdu (sif);
+ lacp_record_pdu (vm, sif);
lacp_start_current_while_timer (lm->vlib_main, sif, sif->ttl_in_seconds);
sif->actor.state &= ~LACP_STATE_EXPIRED;
if (lacp_port_is_moved (vm, sif))