From 5772319ef156deb6afbee8683bb01c1dc352c9bb Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 15 Jun 2022 17:24:39 -0400 Subject: [PATCH] zebra: Document some data structures better I keep getting confused about nhg_depends and nhg_dependents. So take a second and write them down for the next person. Signed-off-by: Donald Sharp --- zebra/zebra_nhg.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_nhg.h b/zebra/zebra_nhg.h index 0863d90a7e..56de336e47 100644 --- a/zebra/zebra_nhg.h +++ b/zebra/zebra_nhg.h @@ -79,13 +79,29 @@ struct nhg_hash_entry { uint32_t flags; - /* Dependency tree for other entries. + /* Dependency trees for other entries. * For instance a group with two * nexthops will have two dependencies * pointing to those nhg_hash_entries. * * Using a rb tree here to make lookups * faster with ID's. + * + * nhg_depends the RB tree of entries that this + * group contains. + * + * nhg_dependents the RB tree of entries that + * this group is being used by + * + * NHG id 3 with nexthops id 1/2 + * nhg(3)->nhg_depends has 1 and 2 in the tree + * nhg(3)->nhg_dependents is empty + * + * nhg(1)->nhg_depends is empty + * nhg(1)->nhg_dependents is 3 in the tree + * + * nhg(2)->nhg_depends is empty + * nhg(3)->nhg_dependents is 3 in the tree */ struct nhg_connected_tree_head nhg_depends, nhg_dependents; -- 2.39.5