API: Add support for type aliases
[vpp.git] / src / vnet / adj / adj.c
index 90e7e60..8740bb4 100644 (file)
 #include <vnet/fib/fib_node_list.h>
 
 /* Adjacency packet/byte counters indexed by adjacency index. */
-vlib_combined_counter_main_t adjacency_counters;
+vlib_combined_counter_main_t adjacency_counters = {
+    .name = "adjacency",
+    .stat_segment_name = "/net/adjacency",
+};
 
 /*
  * the single adj pool
@@ -47,7 +50,7 @@ adj_poison (ip_adjacency_t * adj)
 {
     if (CLIB_DEBUG > 0)
     {
-       memset (adj, 0xfe, sizeof (adj[0]));
+       clib_memset (adj, 0xfe, sizeof (adj[0]));
     }
 }
 
@@ -64,7 +67,8 @@ adj_alloc (fib_protocol_t proto)
     /* Validate adjacency counters. */
     vlib_validate_combined_counter(&adjacency_counters,
                                    adj_get_index(adj));
-
+    vlib_zero_combined_counter(&adjacency_counters,
+                               adj_get_index(adj));
     fib_node_init(&adj->ia_node,
                   FIB_NODE_TYPE_ADJ);
 
@@ -76,7 +80,7 @@ adj_alloc (fib_protocol_t proto)
     adj->ia_delegates = NULL;
 
     /* lest it become a midchain in the future */
-    memset(&adj->sub_type.midchain.next_dpo, 0,
+    clib_memset(&adj->sub_type.midchain.next_dpo, 0,
            sizeof(adj->sub_type.midchain.next_dpo));
 
     return (adj);