Trivial: Clean up some typos.
[vpp.git] / src / vnet / adj / adj.c
index d28d519..90e7e60 100644 (file)
@@ -35,6 +35,13 @@ ip_adjacency_t *adj_pool;
  */
 int adj_per_adj_counters;
 
+const ip46_address_t ADJ_BCAST_ADDR = {
+    .ip6 = {
+        .as_u64[0] = 0xffffffffffffffff,
+        .as_u64[1] = 0xffffffffffffffff,
+    },
+};
+
 always_inline void
 adj_poison (ip_adjacency_t * adj)
 {
@@ -129,21 +136,20 @@ format_ip_adjacency (u8 * s, va_list * args)
 
     if (fiaf & FORMAT_IP_ADJACENCY_DETAIL)
     {
-        adj_delegate_type_t adt;
-        adj_delegate_t *aed;
         vlib_counter_t counts;
 
         vlib_get_combined_counter(&adjacency_counters, adj_index, &counts);
-        s = format (s, "\n counts:[%Ld:%Ld]", counts.packets, counts.bytes);
-       s = format (s, "\n locks:%d", adj->ia_node.fn_locks);
+        s = format (s, "\n   counts:[%Ld:%Ld]", counts.packets, counts.bytes);
+       s = format (s, "\n   locks:%d", adj->ia_node.fn_locks);
        s = format(s, "\n delegates:\n  ");
-        FOR_EACH_ADJ_DELEGATE(adj, adt, aed,
-        {
-            s = format(s, "  %U\n", format_adj_deletegate, aed);
-        });
+        adj_delegate_format(s, adj);
 
-       s = format(s, "\n children:\n  ");
-       s = fib_node_children_format(adj->ia_node.fn_children, s);
+       s = format(s, "\n children:");
+        if (fib_node_list_get_size(adj->ia_node.fn_children))
+        {
+            s = format(s, "\n  ");
+            s = fib_node_children_format(adj->ia_node.fn_children, s);
+        }
     }
 
     return s;
@@ -162,6 +168,8 @@ adj_last_lock_gone (ip_adjacency_t *adj)
     ASSERT(0 == fib_node_list_get_size(adj->ia_node.fn_children));
     ADJ_DBG(adj, "last-lock-gone");
 
+    adj_delegate_adj_deleted(adj);
+
     vlib_worker_thread_barrier_sync (vm);
 
     switch (adj->lookup_next_index)
@@ -171,6 +179,7 @@ adj_last_lock_gone (ip_adjacency_t *adj)
         /* FALL THROUGH */
     case IP_LOOKUP_NEXT_ARP:
     case IP_LOOKUP_NEXT_REWRITE:
+    case IP_LOOKUP_NEXT_BCAST:
        /*
         * complete and incomplete nbr adjs
         */
@@ -346,34 +355,19 @@ adj_mtu_update_walk_cb (adj_index_t ai,
 
     adj = adj_get(ai);
 
-    vnet_rewrite_update_mtu (vnet_get_main(),
+    vnet_rewrite_update_mtu (vnet_get_main(), adj->ia_link,
                              &adj->rewrite_header);
 
     return (ADJ_WALK_RC_CONTINUE);
 }
 
 static void
-adj_sw_mtu_update (vnet_main_t * vnm,
-                   u32 sw_if_index,
-                   void *ctx)
+adj_mtu_update (vnet_main_t * vnm, u32 sw_if_index, u32 flags)
 {
-    /*
-     * Walk all the adjacencies on the interface to update the cached MTU
-     */
-    adj_walk (sw_if_index, adj_mtu_update_walk_cb, NULL);
+  adj_walk (sw_if_index, adj_mtu_update_walk_cb, NULL);
 }
 
-void
-adj_mtu_update (u32 hw_if_index)
-{
-    /*
-     * Walk all the SW interfaces on the HW interface to update the cached MTU
-     */
-    vnet_hw_interface_walk_sw(vnet_get_main(),
-                              hw_if_index,
-                              adj_sw_mtu_update,
-                              NULL);
-}
+VNET_SW_INTERFACE_MTU_CHANGE_FUNCTION(adj_mtu_update);
 
 /**
  * @brief Walk the Adjacencies on a given interface
@@ -428,24 +422,7 @@ adj_get_sw_if_index (adj_index_t ai)
 int
 adj_is_up (adj_index_t ai)
 {
-    const adj_delegate_t *aed;
-
-    aed = adj_delegate_get(adj_get(ai), ADJ_DELEGATE_BFD);
-
-    if (NULL == aed)
-    {
-        /*
-         * no BFD tracking - resolved
-         */
-        return (!0);
-    }
-    else
-    {
-        /*
-         * defer to the state of the BFD tracking
-         */
-        return (ADJ_BFD_STATE_UP == aed->ad_bfd_state);
-    }
+    return (adj_bfd_is_up(ai));
 }
 
 /**
@@ -547,7 +524,7 @@ adj_show (vlib_main_t * vm,
 
     if (summary)
     {
-        vlib_cli_output (vm, "Number of adjacenies: %d", pool_elts(adj_pool));
+        vlib_cli_output (vm, "Number of adjacencies: %d", pool_elts(adj_pool));
         vlib_cli_output (vm, "Per-adjacency counters: %s",
                          (adj_are_counters_enabled() ?
                           "enabled":