]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Document some data structures better
authorDonald Sharp <sharpd@nvidia.com>
Wed, 15 Jun 2022 21:24:39 +0000 (17:24 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 16 Jun 2022 18:47:19 +0000 (14:47 -0400)
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 <sharpd@nvidia.com>
zebra/zebra_nhg.h

index 0863d90a7ead6fe78b2ce33b42db026bc93ff515..56de336e4724798183a4afdfad07f9cc33c69f69 100644 (file)
@@ -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;