STATS: Dynamically mapped shared memory segment
[vpp.git] / src / vpp / stats / stats.h
index 452e305..f21451d 100644 (file)
 #include <pthread.h>
 #include <vlib/threads.h>
 #include <vnet/fib/fib_table.h>
+#include <vnet/mfib/mfib_table.h>
 #include <vlib/unix/unix.h>
 #include <vlibmemory/api.h>
-#include <vlibmemory/unix_shared_memory_queue.h>
 #include <vlibapi/api_helper_macros.h>
+#include <vpp/stats/stat_segment.h>
 
 typedef struct
 {
@@ -41,36 +42,14 @@ typedef struct
  *
  */
 /* from .../vnet/vnet/ip/lookup.c. Yuck */
+/* *INDENT-OFF* */
 typedef CLIB_PACKED (struct
-                    {
-                    ip4_address_t address;
-u32 address_length: 6;
-u32 index:          26;
-                    }) ip4_route_t;
-
-/* see interface.api */
-typedef struct
-{
-  u32 sw_if_index;
-  u64 drop;
-  u64 punt;
-  u64 rx_ip4;
-  u64 rx_ip6;
-  u64 rx_no_buffer;
-  u64 rx_miss;
-  u64 rx_error;
-  u64 tx_error;
-  u64 rx_mpls;
-} vnet_simple_counter_t;
-
-typedef struct
 {
-  u32 sw_if_index;
-  u64 rx_packets;                      /**< packet counter */
-  u64 rx_bytes;                        /**< byte counter  */
-  u64 tx_packets;                      /**< packet counter */
-  u64 tx_bytes;                        /**< byte counter  */
-} vnet_combined_counter_t;
+  ip4_address_t address;
+  u32 address_length: 6;
+  u32 index:        26;
+}) ip4_route_t;
+/* *INDENT-ON* */
 
 typedef struct
 {
@@ -79,12 +58,13 @@ typedef struct
   u32 index;
 } ip6_route_t;
 
-
 typedef struct
 {
   ip4_route_t *ip4routes;
   ip6_route_t *ip6routes;
+  mfib_prefix_t *mroutes;
   fib_table_t **fibs;
+  mfib_table_t **mfibs;
   hash_pair_t **pvec;
   uword *results;
 } do_ip46_fibs_t;
@@ -115,7 +95,6 @@ typedef struct
 
 } vpe_client_stats_registration_t;
 
-
 typedef struct
 {
   void *mheap;
@@ -177,6 +156,20 @@ typedef struct
   vpe_client_stats_registration_t **regs_tmp;
   vpe_client_registration_t **clients_tmp;
 
+  /* statistics segment */
+  uword *directory_vector_by_name;
+  stat_segment_directory_entry_t *directory_vector;
+  clib_spinlock_t *stat_segment_lockp;
+  clib_socket_t *socket;
+  u8 *socket_name;
+  ssize_t memory_size;
+  u8 node_counters_enabled;
+  void *heap;
+  stat_segment_shared_header_t *shared_header; /* pointer to shared memory segment */
+  int memfd;
+
+  u64 last_input_packets;
+
   /* convenience */
   vlib_main_t *vlib_main;
   vnet_main_t *vnet_main;
@@ -186,8 +179,7 @@ typedef struct
 
 extern stats_main_t stats_main;
 
-void dslock (stats_main_t * sm, int release_hint, int tag);
-void dsunlock (stats_main_t * sm);
+void do_stat_segment_updates (stats_main_t * sm);
 
 #endif /* __included_stats_h__ */