]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: short-circuit rib_process when nothing to do
authorDonald Sharp <sharpd@nvidia.com>
Thu, 5 Aug 2021 14:10:37 +0000 (10:10 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 6 Aug 2021 14:02:53 +0000 (10:02 -0400)
When we are calling rib_process and the route_node
in question has no dest, there is no work to do here
at all.  As such we should just return before
attempting to do any other work.  This is just a tiny bit
of simplification being done.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/zebra_rib.c

index c51dd759a6be619fe61bd665f4857ba177ae952c..152edf00d089a8d84457dd61a5bd8cf530dd4cbc 100644 (file)
@@ -1149,10 +1149,15 @@ static void rib_process(struct route_node *rn)
        assert(rn);
 
        dest = rib_dest_from_rnode(rn);
-       if (dest) {
-               zvrf = rib_dest_vrf(dest);
-               vrf_id = zvrf_id(zvrf);
-       }
+       /*
+        * We have an enqueued node with nothing to process here
+        * let's just finish up and return;
+        */
+       if (!dest)
+               return;
+
+       zvrf = rib_dest_vrf(dest);
+       vrf_id = zvrf_id(zvrf);
 
        vrf = vrf_lookup_by_id(vrf_id);
 
@@ -1165,18 +1170,16 @@ static void rib_process(struct route_node *rn)
         * additionally we know RNODE_FOREACH_RE_SAFE
         * will not iterate so we are ok.
         */
-       if (dest) {
-               if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
-                       struct route_entry *re = re_list_first(&dest->routes);
-
-                       zlog_debug("%s(%u:%u):%s: Processing rn %p",
-                                  VRF_LOGNAME(vrf), vrf_id, re->table, buf,
-                                  rn);
-               }
+       if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
+               struct route_entry *re = re_list_first(&dest->routes);
 
-               old_fib = dest->selected_fib;
+               zlog_debug("%s(%u:%u):%s: Processing rn %p",
+                          VRF_LOGNAME(vrf), vrf_id, re->table, buf,
+                          rn);
        }
 
+       old_fib = dest->selected_fib;
+
        RNODE_FOREACH_RE_SAFE (rn, re, next) {
                if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
                        char flags_buf[128];