hs-test: cache docker build in local filesystem
[vpp.git] / src / vnet / fib / fib_path_list.c
index d354383..ebd2c0e 100644 (file)
@@ -29,7 +29,7 @@
 
 /**
  * The magic number of child entries that make a path-list popular.
- * There's a trade-off here between convergnece and forwarding speed.
+ * There's a trade-off here between convergence and forwarding speed.
  * Popular path-lists generate load-balance maps for the entries that
  * use them. If the map is present there is a switch path cost to indirect
  * through the map - this indirection provides the fast convergence - so
@@ -62,11 +62,6 @@ typedef struct fib_path_list_t_ {
      * the RPF list calculated for this path list
      */
     fib_node_index_t fpl_urpf;
-
-    /**
-     * Hash table of paths. valid only with INDEXED flag
-     */
-    uword *fpl_db;
 } fib_path_list_t;
 
 /*
@@ -181,7 +176,10 @@ fib_path_list_hash (fib_path_list_t *path_list)
 
     ASSERT(path_list);
 
-    new_path_list_hash = old_path_list_hash = vec_len(path_list->fpl_paths);
+    new_path_list_hash =
+        old_path_list_hash =
+            (vec_len(path_list->fpl_paths) << 16 |
+             (path_list->fpl_flags & FIB_PATH_LIST_KEY_FLAGS));
 
     vec_foreach (path_index, path_list->fpl_paths)
     {
@@ -380,8 +378,10 @@ fib_path_list_mk_lb (fib_path_list_t *path_list,
         if ((flags & FIB_PATH_LIST_FWD_FLAG_STICKY) ||
             fib_path_is_resolved(*path_index))
         {
-            nhs = fib_path_append_nh_for_multipath_hash(*path_index,
-                                                        fct, nhs);
+            nhs = fib_path_append_nh_for_multipath_hash(
+                *path_index, fct,
+                fib_forw_chain_type_to_dpo_proto(fct),
+                nhs);
         }
     }
 
@@ -509,7 +509,7 @@ fib_path_list_back_walk_notify (fib_node_t *node,
 {
     /*
      * the path-list is not a direct child of any other node type
-     * paths, which do not change thier to-list-mapping, save the
+     * paths, which do not change their to-list-mapping, save the
      * list they are a member of, and invoke the BW function directly.
      */
     ASSERT(0);
@@ -964,8 +964,7 @@ fib_path_list_copy_and_path_add (fib_node_index_t orig_path_list_index,
         }
         if (duplicate)
         {
-            _vec_len(path_list->fpl_paths) =
-                vec_len(path_list->fpl_paths) - 1;
+            vec_set_len(path_list->fpl_paths, vec_len(path_list->fpl_paths) - 1);
             fib_path_destroy(new_path_index);
         }
         else
@@ -1299,15 +1298,8 @@ fib_path_list_child_add (fib_node_index_t path_list_index,
                         fib_node_type_t child_type,
                         fib_node_index_t child_index)
 {
-    u32 sibling;
-
-    sibling = fib_node_child_add(FIB_NODE_TYPE_PATH_LIST,
-                                 path_list_index,
-                                 child_type,
-                                 child_index);
-
-    if (FIB_PATH_LIST_POPULAR == fib_node_get_n_children(FIB_NODE_TYPE_PATH_LIST,
-                                                         path_list_index))
+    if (FIB_PATH_LIST_POPULAR - 1 == fib_node_get_n_children(FIB_NODE_TYPE_PATH_LIST,
+                                                             path_list_index))
     {
         /*
          * Set the popular flag on the path-list once we pass the magic
@@ -1330,7 +1322,10 @@ fib_path_list_child_add (fib_node_index_t path_list_index,
        fib_walk_sync(FIB_NODE_TYPE_PATH_LIST, path_list_index, &ctx);
     }
 
-    return (sibling);
+    return (fib_node_child_add(FIB_NODE_TYPE_PATH_LIST,
+                                 path_list_index,
+                                 child_type,
+                                 child_index));
 }
 
 void
@@ -1457,7 +1452,7 @@ show_fib_path_list_command (vlib_main_t * vm,
            u8 *s = fib_path_list_format(pli, NULL);
            s = format(s, "children:");
            s = fib_node_children_format(path_list->fpl_node.fn_children, s);
-           vlib_cli_output (vm, "%s", s);
+           vlib_cli_output (vm, "%v", s);
            vec_free(s);
        }
        else
@@ -1471,10 +1466,10 @@ show_fib_path_list_command (vlib_main_t * vm,
         * show all
         */
        vlib_cli_output (vm, "FIB Path Lists");
-       pool_foreach_index (pli, fib_path_list_pool,
-       ({
+       pool_foreach_index (pli, fib_path_list_pool)
+        {
            vlib_cli_output (vm, "%U", format_fib_path_list, pli, 0);
-       }));
+       }
     }
     return (NULL);
 }