summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2017-10-03 13:13:47 -0400
committerFlorin Coras <florin.coras@gmail.com>2017-10-03 18:59:37 +0000
commitdab7eb87bc2ed33f8fee8c3e9aa0fce50606de21 (patch)
treeff51a88b405ac1e94f7d3989da905443578adbe3
parent780af45905fe99093e32af05281b1978b920dd09 (diff)
Update L2FIB entry timestamp only if BD aging enabled (VPP-1002)
Change L2 learning path so it update stale timestamp in MAC entry only if aging is enabled on the BD for the MAC entry. Change-Id: I7babe986ceef3c030d8ef9185076c42b405f7b0f Signed-off-by: John Lo <loj@cisco.com> (cherry picked from commit 5a6508d7269266b4a3ecacdd197ea3514a0c0e28)
-rw-r--r--src/vnet/buffer.h1
-rw-r--r--src/vnet/l2/l2_input.c1
-rw-r--r--src/vnet/l2/l2_learn.c7
3 files changed, 6 insertions, 3 deletions
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index 7dfc6b99baf..fbefe7c2f56 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -173,6 +173,7 @@ typedef struct
u8 l2_len; /* ethernet header length */
u8 shg; /* split-horizon group */
u16 l2fib_sn; /* l2fib bd/int seq_num */
+ u8 bd_age; /* aging enabled */
} l2;
/* l2tpv3 softwire encap, only valid there */
diff --git a/src/vnet/l2/l2_input.c b/src/vnet/l2/l2_input.c
index faed7c7fd76..e556b141b3b 100644
--- a/src/vnet/l2/l2_input.c
+++ b/src/vnet/l2/l2_input.c
@@ -225,6 +225,7 @@ classify_and_dispatch (l2input_main_t * msm, vlib_buffer_t * b0, u32 * next0)
};
/* *INDENT-ON* */
vnet_buffer (b0)->l2.l2fib_sn = sn.as_u16;;
+ vnet_buffer (b0)->l2.bd_age = bd_config->mac_age;
/*
* Process bridge domain feature enables.
diff --git a/src/vnet/l2/l2_learn.c b/src/vnet/l2/l2_learn.c
index 066bb54fe2e..fddab82426c 100644
--- a/src/vnet/l2/l2_learn.c
+++ b/src/vnet/l2/l2_learn.c
@@ -126,7 +126,7 @@ l2learn_process (vlib_node_runtime_t * node,
/* Entry in L2FIB with matching sw_if_index matched - normal fast path */
u32 dtime = timestamp - result0->fields.timestamp;
u32 dsn = result0->fields.sn.as_u16 - vnet_buffer (b0)->l2.l2fib_sn;
- u32 check = dtime | dsn;
+ u32 check = (dtime && vnet_buffer (b0)->l2.bd_age) || dsn;
if (PREDICT_TRUE (check == 0))
return; /* MAC entry up to date */
@@ -136,8 +136,9 @@ l2learn_process (vlib_node_runtime_t * node,
return; /* Above learn limit - do not update */
/* Limit updates per l2-learn node call to avoid prolonged update burst
- * as dtime advance over 1 minute mark, unless more than 1 min behind */
- if ((*count > 2) && (dtime == 1))
+ * as dtime advance over 1 minute mark, unless more than 1 min behind
+ * or SN obsolete */
+ if ((*count > 2) && (dtime == 1) && (dsn == 0))
return;
counter_base[L2LEARN_ERROR_HIT_UPDATE] += 1;