FIB Memory Usage Diagnostics
[vpp.git] / vnet / vnet / adj / adj_internal.h
index f2d0ce0..25a477a 100644 (file)
  * Debug macro
  */
 #ifdef ADJ_DEBUG
-#define ADJ_DBG(_adj, _fmt, _args...)                  \
-{                                                      \
-    clib_warning("adj:[%d:%p]:" _fmt,                  \
-                _adj->heap_handle, _adj,               \
-                ##_args);                              \
+#define ADJ_DBG(_adj, _fmt, _args...)          \
+{                                              \
+    clib_warning("adj:[%d:%p]:" _fmt,          \
+                _adj - adj_pool, _adj,         \
+                ##_args);                      \
 }
 #else
 #define ADJ_DBG(_e, _fmt, _args...)
@@ -90,6 +90,16 @@ adj_fib_proto_2_nd (fib_protocol_t fp)
     return (0);
 }
 
+/**
+ * @brief
+ * Get a pointer to an adjacency object from its index
+ */
+static inline adj_index_t
+adj_get_index (ip_adjacency_t *adj)
+{
+    return (adj - adj_pool);
+}
+
 extern ip_adjacency_t * adj_alloc(fib_protocol_t proto);
 
 extern void adj_nbr_remove(fib_protocol_t nh_proto,