summaryrefslogtreecommitdiff
path: root/zebra/zebra_fpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_fpm.c')
-rw-r--r--zebra/zebra_fpm.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 2bf48c6277..73534c4332 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -70,7 +70,7 @@ DEFINE_MTYPE_STATIC(ZEBRA, FPM_MAC_INFO, "FPM_MAC_INFO");
#define ZFPM_STATS_IVL_SECS 10
#define FPM_MAX_MAC_MSG_LEN 512
-static void zfpm_iterate_rmac_table(struct hash_bucket *backet, void *args);
+static void zfpm_iterate_rmac_table(struct hash_bucket *bucket, void *args);
/*
* Structure that holds state for iterating over all route_node
@@ -273,6 +273,11 @@ struct zfpm_glob {
* If non-zero, the last time when statistics were cleared.
*/
time_t last_stats_clear_time;
+
+ /*
+ * Flag to track the MAC dump status to FPM
+ */
+ bool fpm_mac_dump_done;
};
static struct zfpm_glob zfpm_glob_space;
@@ -517,8 +522,6 @@ static int zfpm_conn_up_thread_cb(struct thread *thread)
struct zfpm_rnodes_iter *iter;
rib_dest_t *dest;
- zfpm_g->t_conn_up = NULL;
-
iter = &zfpm_g->t_conn_up_state.iter;
if (zfpm_g->state != ZFPM_STATE_ESTABLISHED) {
@@ -528,8 +531,13 @@ static int zfpm_conn_up_thread_cb(struct thread *thread)
goto done;
}
- /* Enqueue FPM updates for all the RMAC entries */
- hash_iterate(zrouter.l3vni_table, zfpm_iterate_rmac_table, NULL);
+ if (!zfpm_g->fpm_mac_dump_done) {
+ /* Enqueue FPM updates for all the RMAC entries */
+ hash_iterate(zrouter.l3vni_table, zfpm_iterate_rmac_table,
+ NULL);
+ /* mark dump done so that its not repeated after yield */
+ zfpm_g->fpm_mac_dump_done = true;
+ }
while ((rnode = zfpm_rnodes_iter_next(iter))) {
dest = rib_dest_from_rnode(rnode);
@@ -547,7 +555,6 @@ static int zfpm_conn_up_thread_cb(struct thread *thread)
zfpm_g->stats.t_conn_up_yields++;
zfpm_rnodes_iter_pause(iter);
- zfpm_g->t_conn_up = NULL;
thread_add_timer_msec(zfpm_g->master, zfpm_conn_up_thread_cb,
NULL, 0, &zfpm_g->t_conn_up);
return 0;
@@ -575,12 +582,13 @@ static void zfpm_connection_up(const char *detail)
/*
* Start thread to push existing routes to the FPM.
*/
- assert(!zfpm_g->t_conn_up);
+ thread_cancel(&zfpm_g->t_conn_up);
zfpm_rnodes_iter_init(&zfpm_g->t_conn_up_state.iter);
+ zfpm_g->fpm_mac_dump_done = false;
zfpm_debug("Starting conn_up thread");
- zfpm_g->t_conn_up = NULL;
+
thread_add_timer_msec(zfpm_g->master, zfpm_conn_up_thread_cb, NULL, 0,
&zfpm_g->t_conn_up);
zfpm_g->stats.t_conn_up_starts++;
@@ -1627,10 +1635,10 @@ static int zfpm_trigger_rmac_update(zebra_mac_t *rmac, zebra_l3vni_t *zl3vni,
* Iterate over all the RMAC entries for the given L3VNI
* and enqueue the RMAC for FPM processing.
*/
-static void zfpm_trigger_rmac_update_wrapper(struct hash_bucket *backet,
+static void zfpm_trigger_rmac_update_wrapper(struct hash_bucket *bucket,
void *args)
{
- zebra_mac_t *zrmac = (zebra_mac_t *)backet->data;
+ zebra_mac_t *zrmac = (zebra_mac_t *)bucket->data;
zebra_l3vni_t *zl3vni = (zebra_l3vni_t *)args;
zfpm_trigger_rmac_update(zrmac, zl3vni, false, "RMAC added");
@@ -1641,9 +1649,9 @@ static void zfpm_trigger_rmac_update_wrapper(struct hash_bucket *backet,
* This function iterates over all the L3VNIs to trigger
* FPM updates for RMACs currently available.
*/
-static void zfpm_iterate_rmac_table(struct hash_bucket *backet, void *args)
+static void zfpm_iterate_rmac_table(struct hash_bucket *bucket, void *args)
{
- zebra_l3vni_t *zl3vni = (zebra_l3vni_t *)backet->data;
+ zebra_l3vni_t *zl3vni = (zebra_l3vni_t *)bucket->data;
hash_iterate(zl3vni->rmac_table, zfpm_trigger_rmac_update_wrapper,
(void *)zl3vni);