diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-07-31 12:44:20 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-02 07:44:00 -0400 |
| commit | ad7b74c4f7c8061bccd3b65b85b9fb97becb7cb0 (patch) | |
| tree | a4148c3875f6117da404357ef43b9a78d1c855b4 /pimd/pim_ifchannel.h | |
| parent | 86b473a7e810bc8cfb37fbf9d733048e83c59fbd (diff) | |
pimd: Convert to using a RB tree for the pim_ifp ifchannel_list
This patch does two things:
1) Converts the pim_ifp->ifchannel_list to a pim_ifp->ifchannel_rb
2) Removes the hashing to use the RB RB_FIND instead.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_ifchannel.h')
| -rw-r--r-- | pimd/pim_ifchannel.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pimd/pim_ifchannel.h b/pimd/pim_ifchannel.h index 3fd717bec8..cef431c30d 100644 --- a/pimd/pim_ifchannel.h +++ b/pimd/pim_ifchannel.h @@ -80,6 +80,8 @@ struct pim_assert_metric { Per-interface (S,G) state */ struct pim_ifchannel { + RB_ENTRY(rb_ifchannel) pim_ifp_rb; + struct pim_ifchannel *parent; struct list *sources; struct prefix_sg sg; @@ -108,6 +110,10 @@ struct pim_ifchannel { struct pim_upstream *upstream; }; +RB_HEAD(pim_ifchannel_rb, pim_ifchannel); +RB_PROTOTYPE(pim_ifchannel_rb, pim_ifchannel, + pim_ifp_rb, pim_ifchannel_compare); + void pim_ifchannel_free(struct pim_ifchannel *ch); void pim_ifchannel_delete(struct pim_ifchannel *ch); void pim_ifchannel_delete_all(struct interface *ifp); @@ -148,8 +154,8 @@ void pim_ifchannel_set_star_g_join_state(struct pim_ifchannel *ch, int eom, uint8_t source_flags, uint8_t join, uint8_t starg_alone); -int pim_ifchannel_compare(struct pim_ifchannel *ch1, struct pim_ifchannel *ch2); +int pim_ifchannel_compare(const struct pim_ifchannel *ch1, + const struct pim_ifchannel *ch2); unsigned int pim_ifchannel_hash_key(void *arg); -int pim_ifchannel_equal(const void *arg1, const void *arg2); #endif /* PIM_IFCHANNEL_H */ |
