X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Flacp%2Fptx_machine.h;h=4b4f4134254b1578cfd6cbabc56a9af176dc14f8;hb=87d24db65facb89ca524c951b8379ca2ec4dbc7a;hp=a9af4bb89d3a91230af8f3f03dd45f1ef607410d;hpb=9cd2d7a5a4fafadb65d772c48109d55d1e19d425;p=vpp.git diff --git a/src/plugins/lacp/ptx_machine.h b/src/plugins/lacp/ptx_machine.h index a9af4bb89d3..4b4f4134254 100644 --- a/src/plugins/lacp/ptx_machine.h +++ b/src/plugins/lacp/ptx_machine.h @@ -20,7 +20,7 @@ #include #define foreach_lacp_ptx_event \ - _(0, BEGIN, "begin") \ + _(0, NO_PERIODIC, "no periodic") \ _(1, LONG_TIMEOUT, "long tiemout") \ _(2, TIMER_EXPIRED, "timer expired") \ _(3, SHORT_TIMEOUT, "short timeout") @@ -69,6 +69,33 @@ 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 partner is in short timeout or + // we are not yet synchronized + if ((sif->partner.state & LACP_STATE_LACP_TIMEOUT) || + (((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); +} + +static inline void +lacp_ptx_post_short_timeout_event (vlib_main_t * vm, slave_if_t * sif) +{ + if (sif->lacp_enabled && sif->port_enabled && + ((sif->partner.state & LACP_STATE_LACP_ACTIVITY) || + (sif->actor.state & LACP_STATE_LACP_ACTIVITY))) + lacp_machine_dispatch (&lacp_ptx_machine, vm, sif, + LACP_PTX_EVENT_SHORT_TIMEOUT, &sif->ptx_state); +} + #endif /* __LACP_PTX_MACHINE_H__ */ /*