- counter_base[L2LEARN_ERROR_HIT] += 1;
- int update = !result0->fields.age_not && /* static_mac always age_not */
- (result0->fields.timestamp != timestamp ||
- result0->fields.sn.as_u16 != vnet_buffer (b0)->l2.l2fib_sn);
+ u32 dtime = timestamp - result0->fields.timestamp;
+ u32 dsn = result0->fields.sn.as_u16 - vnet_buffer (b0)->l2.l2fib_sn;
+ u32 check = (dtime && vnet_buffer (b0)->l2.bd_age) || dsn;
+
+ if (PREDICT_TRUE (check == 0))
+ return; /* MAC entry up to date */
+ if (result0->fields.age_not)
+ return; /* Static MAC always age_not */
+ if (msm->global_learn_count > msm->global_learn_limit)
+ return; /* Above learn limit - do not update */