aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lacp/input.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/input.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/input.c')
-rw-r--r--src/plugins/lacp/input.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/lacp/input.c b/src/plugins/lacp/input.c
index 9b1f3b68abf..8212b119784 100644
--- a/src/plugins/lacp/input.c
+++ b/src/plugins/lacp/input.c
@@ -108,6 +108,8 @@ send_ethernet_marker_response_pdu (slave_if_t * sif)
f->n_vectors = 1;
vlib_put_frame_to_node (vm, hw->output_node_index, f);
+ sif->last_marker_pdu_sent_time = vlib_time_now (lm->vlib_main);
+ sif->marker_pdu_sent++;
}
static int
@@ -153,6 +155,7 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
marker = (marker_pdu_t *) (b0->data + b0->current_data);
if (marker->subtype == MARKER_SUBTYPE)
{
+ sif->last_marker_pdu_recd_time = vlib_time_now (lm->vlib_main);
if (sif->last_marker_pkt)
_vec_len (sif->last_marker_pkt) = 0;
vec_validate (sif->last_marker_pkt,
@@ -160,8 +163,13 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
nbytes = vlib_buffer_contents (vm, bi0, sif->last_marker_pkt);
ASSERT (nbytes <= vec_len (sif->last_marker_pkt));
if (nbytes < sizeof (lacp_pdu_t))
- return LACP_ERROR_TOO_SMALL;
- return (handle_marker_protocol (vm, sif));
+ {
+ sif->marker_bad_pdu_received++;
+ return LACP_ERROR_TOO_SMALL;
+ }
+ e = handle_marker_protocol (vm, sif);
+ sif->marker_pdu_received++;
+ return e;
}
/*
@@ -185,8 +193,10 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
nbytes = vlib_buffer_contents (vm, bi0, sif->last_rx_pkt);
ASSERT (nbytes <= vec_len (sif->last_rx_pkt));
+ sif->last_lacpdu_recd_time = vlib_time_now (lm->vlib_main);
if (nbytes < sizeof (lacp_pdu_t))
{
+ sif->bad_pdu_received++;
return LACP_ERROR_TOO_SMALL;
}
@@ -209,6 +219,7 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
sif->last_packet_signature_valid = 1;
sif->last_packet_signature = last_packet_signature;
}
+ sif->pdu_received++;
if (sif->last_rx_pkt)
_vec_len (sif->last_rx_pkt) = 0;