diff options
author | Florin Coras <fcoras@cisco.com> | 2018-01-15 01:08:33 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-01-25 23:53:35 +0000 |
commit | b384b543313b6b47a277c903e9d4fcd4343054fa (patch) | |
tree | 1996e3a25eb3a32fe5bbc405d75f38dd041a5a40 /src/vlibmemory/memory_shared.c | |
parent | 4e578068fc3fe8ba176d211123ddd88962dab315 (diff) |
session: add support for memfd segments
- update segment manager and session api to work with both flavors of
ssvm segments
- added generic ssvm slave/master init and del functions
- cleanup/refactor tcp_echo
- fixed uses of svm fifo pool as vector
Change-Id: Ieee8b163faa407da6e77e657a2322de213a9d2a0
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibmemory/memory_shared.c')
-rw-r--r-- | src/vlibmemory/memory_shared.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c index 5b7d735dab9..488a302bbba 100644 --- a/src/vlibmemory/memory_shared.c +++ b/src/vlibmemory/memory_shared.c @@ -230,6 +230,25 @@ vl_msg_api_alloc_as_if_client_or_null (int nbytes) return vl_msg_api_alloc_internal (nbytes, 0, 1 /* may_return_null */ ); } +void * +vl_mem_api_alloc_as_if_client_w_reg (vl_api_registration_t * reg, int nbytes) +{ + api_main_t *am = &api_main; + vl_shmem_hdr_t *save_shmem_hdr = am->shmem_hdr; + svm_region_t *vlib_rp, *save_vlib_rp = am->vlib_rp; + void *msg; + + vlib_rp = am->vlib_rp = reg->vlib_rp; + am->shmem_hdr = (void *) vlib_rp->user_ctx; + + msg = vl_msg_api_alloc_internal (nbytes, 0, 0 /* may_return_null */ ); + + am->shmem_hdr = save_shmem_hdr; + am->vlib_rp = save_vlib_rp; + + return msg; +} + void vl_msg_api_free (void *a) { @@ -464,6 +483,7 @@ vl_init_shmem (svm_region_t * vlib_rp, vl_api_shm_elem_config_t * config, vec_validate (shmem_hdr, 0); shmem_hdr->version = VL_SHM_VERSION; + shmem_hdr->clib_file_index = VL_API_INVALID_FI; /* Set up the queue and msg ring allocator */ vl_api_mem_config (shmem_hdr, config); |