Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
make test: rename dummy test name
[vpp.git]
/
src
/
vlibmemory
/
memory_api.c
diff --git
a/src/vlibmemory/memory_api.c
b/src/vlibmemory/memory_api.c
index
aa0e25b
..
7a7644a
100644
(file)
--- a/
src/vlibmemory/memory_api.c
+++ b/
src/vlibmemory/memory_api.c
@@
-103,6
+103,14
@@
memclnt_queue_callback (vlib_main_t * vm)
break;
}
}
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);
+ }
}
/*
}
/*
@@
-708,18
+716,24
@@
vl_mem_api_handle_rpc (vlib_main_t * vm, vlib_node_runtime_t * node)
{
api_main_t *am = &api_main;
int i;
{
api_main_t *am = &api_main;
int i;
- uword *
rpc_requests
, mp;
+ 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);
clib_spinlock_lock_if_init (&vm->pending_rpc_lock);
- rpc_requests = vm->pending_rpc_requests;
+ 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 (rpc_requests); i++)
+ for (i = 0; i < vec_len (
vm->processing_
rpc_requests); i++)
{
{
- mp = rpc_requests[i];
+ mp =
vm->processing_
rpc_requests[i];
vl_msg_api_handler_with_vm_node (am, (void *) mp, vm, node);
}
vl_msg_api_handler_with_vm_node (am, (void *) mp, vm, node);
}
- vec_reset_length (vm->pending_rpc_requests);
- clib_spinlock_unlock_if_init (&vm->pending_rpc_lock);
return 0;
}
return 0;
}