From f4e14fdba7de19ca660278a0b8c750140db5868b Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 2 Oct 2017 22:06:01 -0300 Subject: *: 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 --- zebra/irdp_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'zebra/irdp_main.c') diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index bc85e983e7..816bc85cec 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -315,7 +315,6 @@ void process_solicit(struct interface *ifp) static int irdp_finish(void) { struct vrf *vrf; - struct listnode *node, *nnode; struct interface *ifp; struct zebra_if *zi; struct irdp_interface *irdp; @@ -323,7 +322,7 @@ static int irdp_finish(void) zlog_info("IRDP: Received shutdown notification."); RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) - for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) { + RB_FOREACH (ifp, if_name_head, &vrf->ifaces_by_name) { zi = ifp->info; if (!zi) -- cgit v1.2.3