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.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index a444ec785a7..7a7644a0998 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -103,6 +103,14 @@ memclnt_queue_callback (vlib_main_t * vm)
break;
}
}
+ if (vec_len (vm->pending_rpc_requests))
+ {
+ vm->queue_signal_pending = 1;
+ vm->api_queue_nonempty = 1;
+ vlib_process_signal_event (vm, vl_api_clnt_node.index,
+ /* event_type */ QUEUE_SIGNAL_EVENT,
+ /* event_data */ 0);
+ }
}
/*
@@ -704,6 +712,32 @@ vl_mem_api_handle_msg_main (vlib_main_t * vm, vlib_node_runtime_t * node)
}
int
+vl_mem_api_handle_rpc (vlib_main_t * vm, vlib_node_runtime_t * node)
+{
+ api_main_t *am = &api_main;
+ int i;
+ uword *tmp, mp;
+
+ /*
+ * Swap pending and processing vectors, then process the RPCs
+ * Avoid deadlock conditions by construction.
+ */
+ clib_spinlock_lock_if_init (&vm->pending_rpc_lock);
+ tmp = vm->processing_rpc_requests;
+ vec_reset_length (tmp);
+ vm->processing_rpc_requests = vm->pending_rpc_requests;
+ vm->pending_rpc_requests = tmp;
+ clib_spinlock_unlock_if_init (&vm->pending_rpc_lock);
+
+ for (i = 0; i < vec_len (vm->processing_rpc_requests); i++)
+ {
+ mp = vm->processing_rpc_requests[i];
+ vl_msg_api_handler_with_vm_node (am, (void *) mp, vm, node);
+ }
+ return 0;
+}
+
+int
vl_mem_api_handle_msg_private (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 reg_index)
{