summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-03-02 18:24:10 -0500
committerFlorin Coras <florin.coras@gmail.com>2017-03-03 18:02:24 +0000
commitdfbee41b16541b51eb8f7f4d8a831ef9407fb419 (patch)
tree654a1681eff9c4ab3565e915964637b6fc2fde7a /src/vlibmemory
parent87df12d5de67600414ae80b891e8a0f89e89ce5c (diff)
Improve api trace replay consistency checking
Change-Id: I2c4b9646d53e4c008ccbe6d09c6a683c776c1f60 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r--src/vlibmemory/memory_vlib.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/vlibmemory/memory_vlib.c b/src/vlibmemory/memory_vlib.c
index 231caa58f12..3a7415c0867 100644
--- a/src/vlibmemory/memory_vlib.c
+++ b/src/vlibmemory/memory_vlib.c
@@ -1249,6 +1249,8 @@ vl_api_show_plugin_command (vlib_main_t * vm,
for (i = 0; i < vec_len (rp); i++)
vlib_cli_output (vm, "%U", format_api_msg_range, rp + i);
+ vec_free (rp);
+
return 0;
}
@@ -1369,9 +1371,37 @@ vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length)
static void
vl_api_trace_plugin_msg_ids_t_handler (vl_api_trace_plugin_msg_ids_t * mp)
{
- /* Do nothing. We just want to trace the message */
-}
+ api_main_t *am = &api_main;
+ vl_api_msg_range_t *rp;
+ uword *p;
+ /* Noop (except for tracing) during normal operation */
+ if (am->replay_in_progress == 0)
+ return;
+
+ p = hash_get_mem (am->msg_range_by_name, mp->plugin_name);
+ if (p == 0)
+ {
+ clib_warning ("WARNING: traced plugin '%s' not in current image",
+ mp->plugin_name);
+ return;
+ }
+
+ rp = vec_elt_at_index (am->msg_ranges, p[0]);
+ if (rp->first_msg_id != clib_net_to_host_u16 (mp->first_msg_id))
+ {
+ clib_warning ("WARNING: traced plugin '%s' first message id %d not %d",
+ mp->plugin_name, clib_net_to_host_u16 (mp->first_msg_id),
+ rp->first_msg_id);
+ }
+
+ if (rp->last_msg_id != clib_net_to_host_u16 (mp->last_msg_id))
+ {
+ clib_warning ("WARNING: traced plugin '%s' last message id %d not %d",
+ mp->plugin_name, clib_net_to_host_u16 (mp->last_msg_id),
+ rp->last_msg_id);
+ }
+}
#define foreach_rpc_api_msg \
_(RPC_CALL,rpc_call) \