X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlibmemory%2Fmemory_api.c;h=544e59ddb6949ad453a6cf8dbd63dabc4c95290a;hb=b2204671dad112e3195771854b4ef00bb388d4e6;hp=a444ec785a76f8478cb1167fa2d7af7152ddc115;hpb=332287ef5da930dc71f01d927582da7ba7ff7b7b;p=vpp.git diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c index a444ec785a7..544e59ddb69 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); + } } /* @@ -703,6 +711,32 @@ vl_mem_api_handle_msg_main (vlib_main_t * vm, vlib_node_runtime_t * node) am->shmem_hdr->vl_input_queue); } +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) @@ -898,6 +932,28 @@ vlibmemory_init (vlib_main_t * vm) api_main_t *am = &api_main; svm_map_region_args_t _a, *a = &_a; clib_error_t *error; + u8 *remove_path1, *remove_path2; + + /* + * By popular request / to avoid support fires, remove any old api segment + * files Right Here. + */ + if (am->root_path == 0) + { + remove_path1 = format (0, "/dev/shm/global_vm%c", 0); + remove_path2 = format (0, "/dev/shm/vpe-api%c", 0); + } + else + { + remove_path1 = format (0, "/dev/shm/%s-global_vm%c", am->root_path, 0); + remove_path2 = format (0, "/dev/shm/%s-vpe-api%c", am->root_path, 0); + } + + (void) unlink ((char *) remove_path1); + (void) unlink ((char *) remove_path2); + + vec_free (remove_path1); + vec_free (remove_path2); clib_memset (a, 0, sizeof (*a)); a->root_path = am->root_path;