From dd3364cb1aa265ec0310e8ed8adffac16f6fb24e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 20 Dec 2019 23:00:31 -0500 Subject: pimd: Convert the upstream_list and hash to a rb tree Convert the upstream_list and hash to a rb tree, Significant time was being spent in the listnode_add_sort. This reduces this time greatly. Signed-off-by: Donald Sharp --- pimd/pim_upstream.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pimd/pim_upstream.h') diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index ab5082051..1eb2052bb 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -169,6 +169,7 @@ enum pim_upstream_sptbit { PIM_UPSTREAM_SPTBIT_TRUE }; +PREDECL_RBTREE_UNIQ(rb_pim_upstream); /* Upstream (S,G) channel in Joined state (S,G) in the "Not Joined" state is not represented @@ -198,6 +199,7 @@ enum pim_upstream_sptbit { */ struct pim_upstream { struct pim_instance *pim; + struct rb_pim_upstream_item upstream_rb; struct pim_upstream *parent; struct in_addr upstream_addr; /* Who we are talking to */ struct in_addr upstream_register; /*Who we received a register from*/ @@ -326,7 +328,11 @@ void pim_upstream_init(struct pim_instance *pim); void pim_upstream_terminate(struct pim_instance *pim); void join_timer_start(struct pim_upstream *up); -int pim_upstream_compare(void *arg1, void *arg2); +int pim_upstream_compare(const struct pim_upstream *up1, + const struct pim_upstream *up2); +DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, + pim_upstream_compare) + void pim_upstream_register_reevaluate(struct pim_instance *pim); void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim); -- cgit v1.2.3