aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memory_vlib.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-10-04 10:03:52 -0400
committerDamjan Marion <dmarion.lists@gmail.com>2017-10-05 09:51:41 +0000
commit7939f904600018aeed9d8cc9d19ca37c7e96f3d1 (patch)
tree93abcd79168d878b7c8adbb84bcd0d826a9125e4 /src/vlibmemory/memory_vlib.c
parent6f6311560380d0e992f710558e213df1b098ef94 (diff)
Clean up "show api ring" debug CLI
Add a primary svm_region_t pointer to the api_main_t so we can always find the primary region, even when processing an API message from a memfd segment. Change-Id: I07fffe2ac1088ce44de10a34bc771ddc93af967d Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlibmemory/memory_vlib.c')
-rw-r--r--src/vlibmemory/memory_vlib.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/vlibmemory/memory_vlib.c b/src/vlibmemory/memory_vlib.c
index 184a0f8c0a9..2242abcfedf 100644
--- a/src/vlibmemory/memory_vlib.c
+++ b/src/vlibmemory/memory_vlib.c
@@ -801,6 +801,8 @@ memclnt_process (vlib_main_t * vm,
ASSERT (shm);
q = shm->vl_input_queue;
ASSERT (q);
+ /* Make a note so we can always find the primary region easily */
+ am->vlib_primary_rp = am->vlib_rp;
e = vlib_call_init_exit_functions
(vm, vm->api_init_function_registrations, 1 /* call_once */ );
@@ -1317,14 +1319,16 @@ vl_api_ring_command (vlib_main_t * vm,
vl_shmem_hdr_t *shmem_hdr;
api_main_t *am = &api_main;
- shmem_hdr = am->shmem_hdr;
+ /* First, dump the primary region rings.. */
- if (shmem_hdr == 0)
+ if (am->vlib_primary_rp == 0 || am->vlib_primary_rp->user_ctx == 0)
{
vlib_cli_output (vm, "Shared memory segment not initialized...\n");
return 0;
}
+ shmem_hdr = (void *) am->vlib_primary_rp->user_ctx;
+
vlib_cli_output (vm, "Main API segment rings:");
vlib_cli_output (vm, "%U", format_api_message_rings, am,
@@ -1338,7 +1342,7 @@ vl_api_ring_command (vlib_main_t * vm,
svm_region_t *vlib_rp = am->vlib_private_rps[i];
shmem_hdr = (void *) vlib_rp->user_ctx;
vl_api_registration_t **regpp;
- vl_api_registration_t *regp;
+ vl_api_registration_t *regp = 0;
/* For horizontal scaling, add a hash table... */
/* *INDENT-OFF* */
@@ -1351,9 +1355,13 @@ vl_api_ring_command (vlib_main_t * vm,
goto found;
}
}));
+ vlib_cli_output (vm, "regp %llx not found?", regp);
+ continue;
/* *INDENT-ON* */
found:
vlib_cli_output (vm, "%U", format_api_message_rings, am,
+ 0 /* print header */ , 0 /* notused */ );
+ vlib_cli_output (vm, "%U", format_api_message_rings, am,
shmem_hdr, 0 /* main segment */ );
}