summaryrefslogtreecommitdiffstats
path: root/vlib-api/vlibmemory
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-12-02 13:31:25 -0500
committerDamjan Marion <dmarion.lists@gmail.com>2016-12-05 09:19:43 +0000
commit072f8debf21c786ab785ed623229935e0a6cddb6 (patch)
treebf50847f3f54f9fd1dbc2ad630b85e96160bd004 /vlib-api/vlibmemory
parente3371afc8a90177eef331cf609ddd89c9413aeb5 (diff)
Variable-message-length tracing support, VPP-370
Clean up several message handlers which spuriously depended on having a vlib_main_t * pointer passed as a second argument. That definitely doesn't happen when replaying an api trace... Change-Id: Id4cf9745f770933566cb13698ee779333ee35d79 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vlib-api/vlibmemory')
-rw-r--r--vlib-api/vlibmemory/api.h8
-rw-r--r--vlib-api/vlibmemory/memory_vlib.c121
2 files changed, 0 insertions, 129 deletions
diff --git a/vlib-api/vlibmemory/api.h b/vlib-api/vlibmemory/api.h
index 825891cf9ed..f1f8bb736b0 100644
--- a/vlib-api/vlibmemory/api.h
+++ b/vlib-api/vlibmemory/api.h
@@ -88,14 +88,6 @@ typedef struct vl_shmem_hdr_
} vl_shmem_hdr_t;
-/* Note that the size of the structure is 16 bytes, with 4 bytes of padding after data[0]. */
-typedef struct msgbuf_
-{
- unix_shared_memory_queue_t *q;
- u32 data_len;
- u8 data[0];
-} msgbuf_t;
-
#define VL_SHM_VERSION 2
#define VL_API_EPOCH_MASK 0xFF
diff --git a/vlib-api/vlibmemory/memory_vlib.c b/vlib-api/vlibmemory/memory_vlib.c
index 5f97f1611d1..1d40bcb791f 100644
--- a/vlib-api/vlibmemory/memory_vlib.c
+++ b/vlib-api/vlibmemory/memory_vlib.c
@@ -1042,122 +1042,12 @@ VLIB_CLI_COMMAND (cli_show_api_message_table_command, static) = {
};
/* *INDENT-ON* */
-void
-vl_api_trace_print_file_cmd (vlib_main_t * vm, u32 first, u32 last,
- u8 * filename)
-{
- FILE *fp;
- static vl_api_trace_t *tp = 0;
- int endian_swap = 0;
- u32 i;
- u16 msg_id;
- static u8 *msg_buf = 0;
- void (*endian_fp) (void *);
- u8 *(*print_fp) (void *, void *);
- int size;
- api_main_t *am = &api_main;
-
- /*
- * On-demand: allocate enough space for the largest message
- */
- if (msg_buf == 0)
- {
- vec_validate (tp, 0);
- int max_size = 0;
- for (i = 0; i < vec_len (am->api_trace_cfg); i++)
- {
- if (am->api_trace_cfg[i].size > max_size)
- max_size = am->api_trace_cfg[i].size;
- }
- /* round size to a multiple of the cache-line size */
- max_size = (max_size + (CLIB_CACHE_LINE_BYTES - 1)) &
- (~(CLIB_CACHE_LINE_BYTES - 1));
- vec_validate (msg_buf, max_size - 1);
- }
-
- fp = fopen ((char *) filename, "r");
-
- if (fp == NULL)
- {
- vlib_cli_output (vm, "Couldn't open %s\n", filename);
- return;
- }
-
- /* first, fish the header record from the file */
-
- if (fread (tp, sizeof (*tp), 1, fp) != 1)
- {
- fclose (fp);
- vlib_cli_output (vm, "Header read error\n");
- return;
- }
-
- /* Endian swap required? */
- if (clib_arch_is_big_endian != tp->endian)
- {
- endian_swap = 1;
- }
-
- for (i = 0; i <= last; i++)
- {
- /* First 2 bytes are the message type */
- if (fread (&msg_id, sizeof (u16), 1, fp) != 1)
- {
- break;
- }
- msg_id = ntohs (msg_id);
-
- if (fseek (fp, -2, SEEK_CUR) < 0)
- {
- vlib_cli_output (vm, "fseek failed, %s", strerror (errno));
- fclose (fp);
- return;
- }
-
- /* Mild sanity check */
- if (msg_id >= vec_len (am->msg_handlers))
- {
- fclose (fp);
- vlib_cli_output (vm, "msg_id %d out of bounds\n", msg_id);
- return;
- }
-
- size = am->api_trace_cfg[msg_id].size;
-
- if (fread (msg_buf, size, 1, fp) != 1)
- {
- fclose (fp);
- vlib_cli_output (vm, "read error on %s\n", filename);
- return;
- }
-
- if (i < first)
- continue;
-
- if (endian_swap)
- {
- endian_fp = am->msg_endian_handlers[msg_id];
- (*endian_fp) (msg_buf);
- }
-
- vlib_cli_output (vm, "[%d]: %s\n", i, am->msg_names[msg_id]);
-
- print_fp = (void *) am->msg_print_handlers[msg_id];
- (*print_fp) (msg_buf, vm);
- vlib_cli_output (vm, "-------------\n");
- }
- fclose (fp);
-}
-
static clib_error_t *
vl_api_trace_command (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cli_cmd)
{
u32 nitems = 1024;
vl_api_trace_which_t which = VL_API_TRACE_RX;
- u8 *filename;
- u32 first = 0;
- u32 last = ~0;
api_main_t *am = &api_main;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -1194,12 +1084,6 @@ vl_api_trace_command (vlib_main_t * vm,
vl_msg_api_trace_free (am, VL_API_TRACE_RX);
vl_msg_api_trace_free (am, VL_API_TRACE_TX);
}
- else if (unformat (input, "print %s from %d to %d", &filename,
- &first, &last)
- || unformat (input, "print %s", &filename))
- {
- goto print;
- }
else if (unformat (input, "debug on"))
{
am->msg_print_flag = 1;
@@ -1214,10 +1098,6 @@ vl_api_trace_command (vlib_main_t * vm,
}
return 0;
-print:
- vl_api_trace_print_file_cmd (vm, first, last, filename);
- goto out;
-
configure:
if (vl_msg_api_trace_configure (am, which, nitems))
{
@@ -1225,7 +1105,6 @@ configure:
which, nitems);
}
-out:
return 0;
}