From 2934127547bc63a59f83fb4f875a6b2c8779d6ca Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 8 Feb 2024 11:56:40 -0500 Subject: [PATCH] zebra: Remove ifp_nhg_XXX functions completely These functions provided a level of abstraction that forced us to call multiple functions when a simple data structure change was all that is needed. Let's consolidate down and make things a bit simpler. Signed-off-by: Donald Sharp --- zebra/interface.c | 29 ----------------------------- zebra/interface.h | 5 ----- zebra/zebra_nhg.c | 11 ++++++++--- 3 files changed, 8 insertions(+), 37 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index 829f9dab61..efa7283e31 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -954,35 +954,6 @@ static void if_down_del_nbr_connected(struct interface *ifp) } } -void if_nhg_dependents_add(struct interface *ifp, struct nhg_hash_entry *nhe) -{ - if (ifp->info) { - struct zebra_if *zif = (struct zebra_if *)ifp->info; - - nhg_connected_tree_add_nhe(&zif->nhg_dependents, nhe); - } -} - -void if_nhg_dependents_del(struct interface *ifp, struct nhg_hash_entry *nhe) -{ - if (ifp->info) { - struct zebra_if *zif = (struct zebra_if *)ifp->info; - - nhg_connected_tree_del_nhe(&zif->nhg_dependents, nhe); - } -} - -unsigned int if_nhg_dependents_count(const struct interface *ifp) -{ - if (ifp->info) { - struct zebra_if *zif = (struct zebra_if *)ifp->info; - - return nhg_connected_tree_count(&zif->nhg_dependents); - } - - return 0; -} - /* Interface is up. */ void if_up(struct interface *ifp, bool install_connected) { diff --git a/zebra/interface.h b/zebra/interface.h index 7d633f32d2..8d19c1838f 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -331,11 +331,6 @@ void link_param_cmd_set_float(struct interface *ifp, float *field, void link_param_cmd_unset(struct interface *ifp, uint32_t type); /* Nexthop group connected functions */ -extern void if_nhg_dependents_add(struct interface *ifp, - struct nhg_hash_entry *nhe); -extern void if_nhg_dependents_del(struct interface *ifp, - struct nhg_hash_entry *nhe); -extern unsigned int if_nhg_dependents_count(const struct interface *ifp); extern bool if_nhg_dependents_is_empty(const struct interface *ifp); extern void vrf_add_update(struct vrf *vrfp); diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index ecdba8866d..527522a6f4 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -309,8 +309,10 @@ static int zebra_nhg_insert_id(struct nhg_hash_entry *nhe) static void zebra_nhg_set_if(struct nhg_hash_entry *nhe, struct interface *ifp) { + struct zebra_if *zif = (struct zebra_if *)ifp->info; + nhe->ifp = ifp; - if_nhg_dependents_add(ifp, nhe); + nhg_connected_tree_add_nhe(&zif->nhg_dependents, nhe); } static void @@ -1073,8 +1075,11 @@ static void zebra_nhg_release_all_deps(struct nhg_hash_entry *nhe) /* Remove it from any lists it may be on */ zebra_nhg_depends_release(nhe); zebra_nhg_dependents_release(nhe); - if (nhe->ifp) - if_nhg_dependents_del(nhe->ifp, nhe); + if (nhe->ifp) { + struct zebra_if *zif = nhe->ifp->info; + + nhg_connected_tree_del_nhe(&zif->nhg_dependents, nhe); + } } static void zebra_nhg_release(struct nhg_hash_entry *nhe) -- 2.39.5