vnet: move format_vl_api_address_union() from vpp to vnet
[vpp.git] / src / vnet / adj / adj.c
index 8808294..201561f 100644 (file)
@@ -33,6 +33,11 @@ vlib_combined_counter_main_t adjacency_counters = {
  */
 ip_adjacency_t *adj_pool;
 
+/**
+ * The adjacency logger
+ */
+vlib_log_class_t adj_logger;
+
 /**
  * @brief Global Config for enabling per-adjacency counters.
  * By default these are disabled.
@@ -64,14 +69,12 @@ ip_adjacency_t *
 adj_alloc (fib_protocol_t proto)
 {
     ip_adjacency_t *adj;
-    u8 need_barrier_sync = 0;
+    u8 need_barrier_sync = pool_get_will_expand (adj_pool);
     vlib_main_t *vm;
     vm = vlib_get_main();
 
     ASSERT (vm->thread_index == 0);
 
-    pool_get_aligned_will_expand (adj_pool, need_barrier_sync,
-                                  CLIB_CACHE_LINE_BYTES);
     /* If the adj_pool will expand, stop the parade. */
     if (need_barrier_sync)
         vlib_worker_thread_barrier_sync (vm);
@@ -309,12 +312,12 @@ adj_last_lock_gone (ip_adjacency_t *adj)
        break;
     }
 
-    vlib_worker_thread_barrier_release(vm);
 
     fib_node_deinit(&adj->ia_node);
     ASSERT(0 == vec_len(adj->ia_delegates));
     vec_free(adj->ia_delegates);
     pool_put(adj_pool, adj);
+    vlib_worker_thread_barrier_release(vm);
 }
 
 u32
@@ -350,7 +353,6 @@ adj_lock (adj_index_t adj_index)
     adj = adj_get(adj_index);
     ASSERT(adj);
 
-    ADJ_DBG(adj, "lock");
     fib_node_lock(&adj->ia_node);
 }
 
@@ -367,9 +369,6 @@ adj_unlock (adj_index_t adj_index)
     adj = adj_get(adj_index);
     ASSERT(adj);
 
-    ADJ_DBG(adj, "unlock");
-    ASSERT(adj);
-
     fib_node_unlock(&adj->ia_node);
 }
 
@@ -650,6 +649,8 @@ adj_module_init (vlib_main_t * vm)
 
     vnet_feature_register(adj_feature_update, NULL);
 
+    adj_logger = vlib_log_register_class("adj", "adj");
+
     return (NULL);
 }
 
@@ -703,7 +704,6 @@ adj_show (vlib_main_t * vm,
         }
         else
         {
-            /* *INDENT-OFF* */
             pool_foreach_index (ai, adj_pool)
              {
                 if (~0 != sw_if_index &&
@@ -718,7 +718,6 @@ adj_show (vlib_main_t * vm,
                                      FORMAT_IP_ADJACENCY_NONE);
                 }
             }
-            /* *INDENT-ON* */
         }
     }
     return 0;