FIB Memory Usage Diagnostics
[vpp.git] / vnet / vnet / dpo / dpo.h
index 8c22f00..7ba4756 100644 (file)
@@ -65,6 +65,7 @@ typedef enum dpo_proto_t_
     DPO_PROTO_IP4 = 0,
 #endif
     DPO_PROTO_IP6,
+    DPO_PROTO_ETHERNET,
     DPO_PROTO_MPLS,
 } __attribute__((packed)) dpo_proto_t;
 
@@ -74,9 +75,15 @@ typedef enum dpo_proto_t_
 #define DPO_PROTOS {           \
     [DPO_PROTO_IP4]  = "ip4",  \
     [DPO_PROTO_IP6]  = "ip6",  \
+    [DPO_PROTO_ETHERNET]  = "ethernet", \
     [DPO_PROTO_MPLS] = "mpls", \
 }
 
+#define FOR_EACH_DPO_PROTO(_proto)    \
+    for (_proto = DPO_PROTO_IP4;      \
+        _proto <= DPO_PROTO_MPLS;    \
+        _proto++)
+
 /**
  * @brief Common types of data-path objects
  * New types can be dynamically added using dpo_register_new_type()
@@ -293,6 +300,11 @@ typedef void (*dpo_lock_fn_t)(dpo_id_t *dpo);
  */
 typedef void (*dpo_unlock_fn_t)(dpo_id_t *dpo);
 
+/**
+ * @brief An memory usage show command
+ */
+typedef void (*dpo_mem_show_t)(void);
+
 /**
  * @brief A virtual function table regisitered for a DPO type
  */
@@ -310,6 +322,10 @@ typedef struct dpo_vft_t_
      * A format function
      */
     format_function_t *dv_format;
+    /**
+     * A show memory usage function
+     */
+    dpo_mem_show_t dv_mem_show;
 } dpo_vft_t;
 
 
@@ -330,9 +346,9 @@ typedef struct dpo_vft_t_
  * @param nodes
  *  The string description of the per-protocol VLIB graph nodes.
  */
-void dpo_register(dpo_type_t type,
-                 const dpo_vft_t *vft,
-                  const char * const * const * nodes);
+extern void dpo_register(dpo_type_t type,
+                        const dpo_vft_t *vft,
+                        const char * const * const * nodes);
 
 /**
  * @brief Create and register a new DPO type.
@@ -348,7 +364,7 @@ void dpo_register(dpo_type_t type,
  *
  * @return The new dpo_type_t
  */
-dpo_type_t dpo_register_new_type(const dpo_vft_t *vft,
-                                 const char * const * const * nodes);
+extern dpo_type_t dpo_register_new_type(const dpo_vft_t *vft,
+                                       const char * const * const * nodes);
 
 #endif