diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-10-03 03:06:01 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-10-10 14:05:02 +0200 |
commit | f4e14fdba7de19ca660278a0b8c750140db5868b (patch) | |
tree | 58eb2d22e84b24672ddff1dd786f18e5bc555b15 /pimd/pim_nht.c | |
parent | lib: register 'if_var_handlers' only once (diff) | |
download | frr-f4e14fdba7de19ca660278a0b8c750140db5868b.tar.xz frr-f4e14fdba7de19ca660278a0b8c750140db5868b.zip |
*: use rb-trees to store interfaces instead of sorted linked-lists
This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).
This is a big patch but the interesting bits are all in lib/if.[ch].
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_nht.c')
-rw-r--r-- | pimd/pim_nht.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index a1de4837d..78b160f6a 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -410,12 +410,12 @@ static int pim_update_upstream_nh_helper(struct hash_backet *backet, void *arg) static int pim_update_upstream_nh(struct pim_instance *pim, struct pim_nexthop_cache *pnc) { - struct listnode *node, *ifnode; + struct listnode *node; struct interface *ifp; hash_walk(pnc->upstream_hash, pim_update_upstream_nh_helper, pim); - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(pim->vrf_id), ifnode, ifp)) + RB_FOREACH (ifp, if_name_head, &pim->vrf->ifaces_by_name) if (ifp->info) { struct pim_interface *pim_ifp = ifp->info; struct pim_iface_upstream_switch *us; |