summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memory_api.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-11-27 11:42:13 -0500
committerFlorin Coras <florin.coras@gmail.com>2019-12-10 01:13:05 +0000
commit39d69112fcec114fde34955ceb41555221d3ba11 (patch)
tree156f21a0e66bf596b2c1e5184d82c80d99ea0a79 /src/vlibmemory/memory_api.c
parent6b3f25caff262b536a5449ac5461dd041c92a655 (diff)
api: multiple connections per process
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I2272521d6e69edcd385ef684af6dd4eea5eaa953
Diffstat (limited to 'src/vlibmemory/memory_api.c')
-rw-r--r--src/vlibmemory/memory_api.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index b5c97e9acb7..8c633e20223 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -64,7 +64,7 @@ static void
memclnt_queue_callback (vlib_main_t * vm)
{
int i;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
if (PREDICT_FALSE (vec_len (vl_api_queue_cursizes) !=
1 + vec_len (am->vlib_private_rps)))
@@ -123,7 +123,7 @@ vl_api_memclnt_create_internal (char *name, svm_queue_t * q)
vl_api_registration_t *regp;
svm_region_t *svm;
void *oldheap;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
ASSERT (vlib_get_thread_index () == 0);
pool_get (am->vl_clients, regpp);
@@ -164,7 +164,7 @@ vl_api_memclnt_create_t_handler (vl_api_memclnt_create_t * mp)
svm_queue_t *q;
int rv = 0;
void *oldheap;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
u8 *msg_table;
/*
@@ -246,7 +246,7 @@ vl_api_call_reaper_functions (u32 client_index)
clib_error_t *error = 0;
_vl_msg_api_function_list_elt_t *i;
- i = api_main.reaper_function_registrations;
+ i = vlibapi_get_main ()->reaper_function_registrations;
while (i)
{
error = i->f (client_index);
@@ -268,7 +268,7 @@ vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t * mp)
vl_api_memclnt_delete_reply_t *rp;
svm_region_t *svm;
void *oldheap;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
u32 handle, client_index, epoch;
handle = mp->index;
@@ -411,7 +411,7 @@ vl_api_memclnt_keepalive_t_handler (vl_api_memclnt_keepalive_t * mp)
api_main_t *am;
vl_shmem_hdr_t *shmem_hdr;
- am = &api_main;
+ am = vlibapi_get_main ();
shmem_hdr = am->shmem_hdr;
rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp));
@@ -439,7 +439,7 @@ int
vl_mem_api_init (const char *region_name)
{
int rv;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
vl_msg_api_msg_config_t cfg;
vl_msg_api_msg_config_t *c = &cfg;
vl_shmem_hdr_t *shm;
@@ -488,7 +488,7 @@ vl_mem_api_init (const char *region_name)
clib_error_t *
map_api_segment_init (vlib_main_t * vm)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
int rv;
if ((rv = vl_mem_api_init (am->region_name)) < 0)
@@ -503,8 +503,8 @@ static void
send_memclnt_keepalive (vl_api_registration_t * regp, f64 now)
{
vl_api_memclnt_keepalive_t *mp;
- api_main_t *am = &api_main;
svm_queue_t *q;
+ api_main_t *am = vlibapi_get_main ();
q = regp->vl_input_queue;
@@ -722,7 +722,7 @@ void_mem_api_handle_msg_i (api_main_t * am, svm_region_t * vlib_rp,
int
vl_mem_api_handle_msg_main (vlib_main_t * vm, vlib_node_runtime_t * node)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
return void_mem_api_handle_msg_i (am, am->vlib_rp, vm, node,
0 /* is_private */ );
}
@@ -730,7 +730,7 @@ 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;
+ api_main_t *am = vlibapi_get_main ();
int i;
uword *tmp, mp;
@@ -775,7 +775,7 @@ int
vl_mem_api_handle_msg_private (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 reg_index)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
return void_mem_api_handle_msg_i (am, am->vlib_private_rps[reg_index], vm,
node, 1 /* is_private */ );
@@ -786,7 +786,7 @@ vl_mem_api_client_index_to_registration (u32 handle)
{
vl_api_registration_t **regpp;
vl_api_registration_t *regp;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
vl_shmem_hdr_t *shmem_hdr;
u32 index;
@@ -814,7 +814,7 @@ svm_queue_t *
vl_api_client_index_to_input_queue (u32 index)
{
vl_api_registration_t *regp;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
/* Special case: vlib trying to send itself a message */
if (index == (u32) ~ 0)
@@ -884,7 +884,7 @@ vl_api_ring_command (vlib_main_t * vm,
{
int i;
vl_shmem_hdr_t *shmem_hdr;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
/* First, dump the primary region rings.. */
@@ -950,7 +950,7 @@ VLIB_CLI_COMMAND (cli_show_api_ring_command, static) =
clib_error_t *
vlibmemory_init (vlib_main_t * vm)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
svm_map_region_args_t _a, *a = &_a;
u8 *remove_path1, *remove_path2;
void vlibsocket_reference (void);
@@ -999,7 +999,7 @@ vlibmemory_init (vlib_main_t * vm)
void
vl_set_memory_region_name (const char *name)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
am->region_name = name;
}