lacp: partner may time us out if fast-rate is configured [VPP-1247] 42/11942/2
authorSteven <sluong@cisco.com>
Fri, 20 Apr 2018 04:59:09 +0000 (21:59 -0700)
committerChris Luke <chris_luke@comcast.com>
Mon, 23 Apr 2018 18:33:59 +0000 (18:33 +0000)
We should be sending LACP PDU every second if the partner has LACP_TIMEOUT flag
set which means it will time us out in 3 seconds.

Add interface name for lacp trace

Change-Id: If7d816c062d03e80cc0dd7d10dba0b76ace0664a
Signed-off-by: Steven <sluong@cisco.com>
src/plugins/lacp/input.c
src/plugins/lacp/node.c
src/plugins/lacp/node.h
src/plugins/lacp/protocol.h
src/plugins/lacp/ptx_machine.h

index 45db3b8..9b1f3b6 100644 (file)
@@ -249,6 +249,8 @@ lacp_input_format_trace (u8 * s, va_list * args)
   u8 *p;
   lacp_state_struct *state_entry;
 
+  s = format (s, "%U:\n", format_vnet_sw_if_index_name, vnet_get_main (),
+             t->sw_if_index);
   s = format (s, "Length: %d\n", t->len);
   if (t->len >= sizeof (lacp_pdu_t))
     {
index 8eb7887..447e85f 100644 (file)
@@ -101,6 +101,7 @@ lacp_node_fn (vlib_main_t * vm,
          len = (b0->current_length < sizeof (t0->pkt))
            ? b0->current_length : sizeof (t0->pkt);
          t0->len = len;
+         t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
          clib_memcpy (&t0->pkt, vlib_buffer_get_current (b0), len);
        }
       /* push this pkt to the next graph node, always error-drop */
index 26cf7a3..ebc6704 100644 (file)
@@ -77,6 +77,7 @@ typedef enum
 /* lacp packet trace capture */
 typedef struct
 {
+  u32 sw_if_index;
   u32 len;
   union
   {
index 05a3f04..9fc2f35 100644 (file)
@@ -69,7 +69,7 @@ typedef enum
 } lacp_state_t;
 
 #define foreach_lacp_state_flag                                \
-  _(0, LACP_STATE_LACP_ACTIViTY, "activity")           \
+  _(0, LACP_STATE_LACP_ACTIVITY, "activity")           \
   _(1, LACP_STATE_LACP_TIMEOUT, "lacp timeout")         \
   _(2, LACP_STATE_AGGREGATION, "aggregation")           \
   _(3, LACP_STATE_SYNCHRONIZATION, "synchronization")   \
index 6183b63..9b4f280 100644 (file)
@@ -72,13 +72,15 @@ lacp_start_periodic_timer (vlib_main_t * vm, slave_if_t * sif, u8 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))
+  // 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);