From e531f4cb5766fbf27e7a8af8e19ccf667b53852b Mon Sep 17 00:00:00 2001 From: John Lo Date: Tue, 22 Aug 2017 09:16:50 -0400 Subject: Increase default MAC learn limit and check it in learn-update path 1. Increase default MAC learn limit from 1M to 8M entries. 2. Check MAC learn limit in MAC learning update path. 3. Allow disable of want_l2_macs_events to set MAC learn limit 4. Other minor cleanups Change-Id: I62438440937b5fa455e16f4a2e4d910277753395 Signed-off-by: John Lo --- src/vnet/l2/l2.api | 1 - src/vnet/l2/l2_api.c | 5 ++++- src/vnet/l2/l2_fib.c | 2 +- src/vnet/l2/l2_learn.c | 2 ++ src/vnet/l2/l2_learn.h | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/l2/l2.api b/src/vnet/l2/l2.api index e508bfb529c..9f97ebbe2ca 100644 --- a/src/vnet/l2/l2.api +++ b/src/vnet/l2/l2.api @@ -134,7 +134,6 @@ autoreply define l2fib_add_del }; /** \brief Register to recive L2 MAC events for leanred and aged MAC - Will also change MAC learn limit to L2LEARN_INFORM_LIMIT @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param learn_limit - MAC learn limit, 0 => default to 1000 diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c index c81cbad77d7..7e79d6fa4bf 100644 --- a/src/vnet/l2/l2_api.c +++ b/src/vnet/l2/l2_api.c @@ -284,7 +284,10 @@ vl_api_want_l2_macs_events_t_handler (vl_api_want_l2_macs_events_t * mp) { lm->client_pid = 0; lm->client_index = 0; - lm->global_learn_limit = L2LEARN_DEFAULT_LIMIT; + if (learn_limit) + lm->global_learn_limit = learn_limit; + else + lm->global_learn_limit = L2LEARN_DEFAULT_LIMIT; } exit: diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c index 8aa0ac295dd..9f4c823f67b 100644 --- a/src/vnet/l2/l2_fib.c +++ b/src/vnet/l2/l2_fib.c @@ -1021,7 +1021,7 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only) if (PREDICT_FALSE (evt_idx >= fm->max_macs_in_event)) { - /* evet message full, sent it and start a new one */ + /* event message full, send it and start a new one */ if (q && (q->cursize < q->maxsize)) { mp->n_macs = htonl (evt_idx); diff --git a/src/vnet/l2/l2_learn.c b/src/vnet/l2/l2_learn.c index 47c036b0bf1..623c2de202c 100644 --- a/src/vnet/l2/l2_learn.c +++ b/src/vnet/l2/l2_learn.c @@ -131,6 +131,8 @@ l2learn_process (vlib_node_runtime_t * node, if (PREDICT_TRUE (!update)) return; + else if (msm->global_learn_count > msm->global_learn_limit) + return; /* Above learn limit - do not update */ } else if (result0->raw == ~0) { diff --git a/src/vnet/l2/l2_learn.h b/src/vnet/l2/l2_learn.h index 000ab59ee7f..d6f41d40d49 100644 --- a/src/vnet/l2/l2_learn.h +++ b/src/vnet/l2/l2_learn.h @@ -46,7 +46,7 @@ typedef struct vnet_main_t *vnet_main; } l2learn_main_t; -#define L2LEARN_DEFAULT_LIMIT (L2FIB_NUM_BUCKETS * 16) +#define L2LEARN_DEFAULT_LIMIT (L2FIB_NUM_BUCKETS * 128) l2learn_main_t l2learn_main; -- cgit 1.2.3-korg