STATS: Refactor missed adding messages to CRC dictionary.
[vpp.git] / src / vpp / stats / stats.c
index c78a8ae..b07dc17 100644 (file)
@@ -60,6 +60,19 @@ _(WANT_IP6_NBR_STATS, want_ip6_nbr_stats) \
 _(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats)
 
 
+#define vl_msg_name_crc_list
+#include <vpp/stats/stats.api.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (api_main_t * am)
+{
+#define _(id,n,crc) \
+  vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
+  foreach_vl_msg_name_crc_stats;
+#undef _
+}
+
 /* These constants ensure msg sizes <= 1024, aka ring allocation */
 #define SIMPLE_COUNTER_BATCH_SIZE      126
 #define COMBINED_COUNTER_BATCH_SIZE    63
@@ -1495,7 +1508,7 @@ static void
        }
 
       rp = pool_elt_at_index (sm->stats_registrations, p[0]);
-      if (!rp->stats_registrations & INTERFACE_COMBINED_COUNTERS)      // Client but doesn't want this.
+      if (!(rp->stats_registrations & INTERFACE_COMBINED_COUNTERS))    // Client but doesn't want this.
        {
          clib_warning
            ("pid %d: already disabled for interface COMBINED stats...",
@@ -1576,7 +1589,7 @@ vl_api_want_ip4_fib_stats_t_handler (vl_api_want_ip4_fib_stats_t * mp)
        }
 
       rp = pool_elt_at_index (sm->stats_registrations, p[0]);
-      if (!rp->stats_registrations & IP4_FIB_COUNTERS) // Client but doesn't want this.
+      if (!(rp->stats_registrations & IP4_FIB_COUNTERS))       // Client but doesn't want this.
        {
          clib_warning ("pid %d: already disabled for interface ip4 fib...",
                        mp->pid);
@@ -1656,7 +1669,7 @@ vl_api_want_ip6_fib_stats_t_handler (vl_api_want_ip6_fib_stats_t * mp)
        }
 
       rp = pool_elt_at_index (sm->stats_registrations, p[0]);
-      if (!rp->stats_registrations & IP6_FIB_COUNTERS) // Client but doesn't want this.
+      if (!(rp->stats_registrations & IP6_FIB_COUNTERS))       // Client but doesn't want this.
        {
          clib_warning ("pid %d: already disabled for interface ip6 fib...",
                        mp->pid);
@@ -1836,6 +1849,11 @@ stats_init (vlib_main_t * vm)
   am->message_bounce[VL_API_VNET_IP4_NBR_COUNTERS] = 1;
   am->message_bounce[VL_API_VNET_IP6_NBR_COUNTERS] = 1;
 
+  /*
+   * Set up the (msg_name, crc, message-id) table
+   */
+  setup_message_id_table (am);
+
   return 0;
 }