aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlibapi')
-rw-r--r--src/vlibapi/api.h5
-rw-r--r--src/vlibapi/api_shared.c18
2 files changed, 19 insertions, 4 deletions
diff --git a/src/vlibapi/api.h b/src/vlibapi/api.h
index 3eef0503310..ae0891563dc 100644
--- a/src/vlibapi/api.h
+++ b/src/vlibapi/api.h
@@ -105,9 +105,10 @@ int vl_msg_api_trace_onoff (api_main_t * am, vl_api_trace_which_t which,
int vl_msg_api_trace_free (api_main_t * am, vl_api_trace_which_t which);
int vl_msg_api_trace_configure (api_main_t * am, vl_api_trace_which_t which,
u32 nitems);
-void vl_msg_api_handler_with_vm_node (api_main_t * am,
+void vl_msg_api_handler_with_vm_node (api_main_t * am, svm_region_t * vlib_rp,
void *the_msg, vlib_main_t * vm,
- vlib_node_runtime_t * node);
+ vlib_node_runtime_t * node,
+ u8 is_private);
vl_api_trace_t *vl_msg_api_trace_get (api_main_t * am,
vl_api_trace_which_t which);
void vl_msg_api_add_msg_name_crc (api_main_t * am, const char *string,
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 1e7f5c420c6..ba872626549 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -525,13 +525,15 @@ msg_handler_internal (api_main_t * am,
/* This is only to be called from a vlib/vnet app */
void
-vl_msg_api_handler_with_vm_node (api_main_t * am,
+vl_msg_api_handler_with_vm_node (api_main_t * am, svm_region_t * vlib_rp,
void *the_msg, vlib_main_t * vm,
- vlib_node_runtime_t * node)
+ vlib_node_runtime_t * node, u8 is_private)
{
u16 id = clib_net_to_host_u16 (*((u16 *) the_msg));
u8 *(*handler) (void *, void *, void *);
u8 *(*print_fp) (void *, void *);
+ svm_region_t *old_vlib_rp;
+ void *save_shmem_hdr;
int is_mp_safe = 1;
if (PREDICT_FALSE (am->elog_trace_api_messages))
@@ -581,7 +583,19 @@ vl_msg_api_handler_with_vm_node (api_main_t * am,
vl_msg_api_barrier_trace_context (am->msg_names[id]);
vl_msg_api_barrier_sync ();
}
+ if (is_private)
+ {
+ old_vlib_rp = am->vlib_rp;
+ save_shmem_hdr = am->shmem_hdr;
+ am->vlib_rp = vlib_rp;
+ am->shmem_hdr = (void *) vlib_rp->user_ctx;
+ }
(*handler) (the_msg, vm, node);
+ if (is_private)
+ {
+ am->vlib_rp = old_vlib_rp;
+ am->shmem_hdr = save_shmem_hdr;
+ }
if (!is_mp_safe)
vl_msg_api_barrier_release ();
}