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 <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2024-02-08 11:56:40 -05:00
parent b9130ab51b
commit 2934127547
3 changed files with 8 additions and 37 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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)