summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memory_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlibmemory/memory_api.c')
-rw-r--r--src/vlibmemory/memory_api.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index ecdcc7260be..80d8628bf56 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -532,9 +532,9 @@ vl_mem_api_init (const char *region_name)
* special-case freeing of memclnt_delete messages, so we can
* simply munmap pairwise / private API segments...
*/
- am->message_bounce[VL_API_MEMCLNT_DELETE] = 1;
- am->is_mp_safe[VL_API_MEMCLNT_KEEPALIVE_REPLY] = 1;
- am->is_mp_safe[VL_API_MEMCLNT_KEEPALIVE] = 1;
+ am->msg_data[VL_API_MEMCLNT_DELETE].bounce = 1;
+ vl_api_set_msg_thread_safe (am, VL_API_MEMCLNT_KEEPALIVE_REPLY, 1);
+ vl_api_set_msg_thread_safe (am, VL_API_MEMCLNT_KEEPALIVE, 1);
vlib_set_queue_signal_callback (vm, memclnt_queue_callback);
@@ -768,6 +768,7 @@ vl_mem_api_handler_with_vm_node (api_main_t *am, svm_region_t *vlib_rp,
vlib_node_runtime_t *node, u8 is_private)
{
u16 id = clib_net_to_host_u16 (*((u16 *) the_msg));
+ vl_api_msg_data_t *m = vl_api_get_msg_data (am, id);
u8 *(*handler) (void *, void *, void *);
u8 *(*print_fp) (void *, void *);
svm_region_t *old_vlib_rp;
@@ -785,23 +786,23 @@ vl_mem_api_handler_with_vm_node (api_main_t *am, svm_region_t *vlib_rp,
u32 c;
} * ed;
ed = ELOG_DATA (am->elog_main, e);
- if (id < vec_len (am->msg_names) && am->msg_names[id])
- ed->c = elog_string (am->elog_main, (char *) am->msg_names[id]);
+ if (m && m->name)
+ ed->c = elog_string (am->elog_main, (char *) m->name);
else
ed->c = elog_string (am->elog_main, "BOGUS");
}
- if (id < vec_len (am->msg_handlers) && am->msg_handlers[id])
+ if (m && m->handler)
{
- handler = (void *) am->msg_handlers[id];
+ handler = (void *) m->handler;
if (PREDICT_FALSE (am->rx_trace && am->rx_trace->enabled))
vl_msg_api_trace (am, am->rx_trace, the_msg);
if (PREDICT_FALSE (am->msg_print_flag))
{
- fformat (stdout, "[%d]: %s\n", id, am->msg_names[id]);
- print_fp = (void *) am->msg_print_handlers[id];
+ fformat (stdout, "[%d]: %s\n", id, m->name);
+ print_fp = (void *) am->msg_data[id].print_handler;
if (print_fp == 0)
{
fformat (stdout, " [no registered print fn for msg %d]\n", id);
@@ -811,11 +812,11 @@ vl_mem_api_handler_with_vm_node (api_main_t *am, svm_region_t *vlib_rp,
(*print_fp) (the_msg, vm);
}
}
- is_mp_safe = am->is_mp_safe[id];
+ is_mp_safe = am->msg_data[id].is_mp_safe;
if (!is_mp_safe)
{
- vl_msg_api_barrier_trace_context (am->msg_names[id]);
+ vl_msg_api_barrier_trace_context (am->msg_data[id].name);
vl_msg_api_barrier_sync ();
}
if (is_private)
@@ -829,10 +830,10 @@ vl_mem_api_handler_with_vm_node (api_main_t *am, svm_region_t *vlib_rp,
if (PREDICT_FALSE (vl_mem_api_fuzz_hook != 0))
(*vl_mem_api_fuzz_hook) (id, the_msg);
- if (am->is_autoendian[id])
+ if (m->is_autoendian)
{
void (*endian_fp) (void *);
- endian_fp = am->msg_endian_handlers[id];
+ endian_fp = am->msg_data[id].endian_handler;
(*endian_fp) (the_msg);
}
if (PREDICT_FALSE (vec_len (am->perf_counter_cbs) != 0))
@@ -859,7 +860,7 @@ vl_mem_api_handler_with_vm_node (api_main_t *am, svm_region_t *vlib_rp,
* Special-case, so we can e.g. bounce messages off the vnet
* main thread without copying them...
*/
- if (id >= vec_len (am->message_bounce) || !(am->message_bounce[id]))
+ if (!m || !m->bounce)
{
if (is_private)
{
@@ -892,8 +893,8 @@ vl_mem_api_handler_with_vm_node (api_main_t *am, svm_region_t *vlib_rp,
u32 c;
} * ed;
ed = ELOG_DATA (am->elog_main, e);
- if (id < vec_len (am->msg_names) && am->msg_names[id])
- ed->c = elog_string (am->elog_main, (char *) am->msg_names[id]);
+ if (m && m->name)
+ ed->c = elog_string (am->elog_main, (char *) m->name);
else
ed->c = elog_string (am->elog_main, "BOGUS");
ed->barrier = is_mp_safe;