summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-14 12:25:50 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-01-15 16:39:12 +0000
commit4d9b9d8e74f12a26404ccdd8baf46c61b44584db (patch)
tree2c9e0314664fca52722431f14928e1b3fd0017fb /src/vlibmemory
parent149a1433b0e6301a34989f5e8c7ebed3fa5bf74e (diff)
svm: refactor memfd and remove ssvm_eth
Change-Id: Icde296e956eb89ea3a17d547f04a833916ec6440 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r--src/vlibmemory/memory_api.h1
-rw-r--r--src/vlibmemory/memory_client.c1
-rw-r--r--src/vlibmemory/socket_api.c18
-rw-r--r--src/vlibmemory/socket_api.h1
-rw-r--r--src/vlibmemory/socket_client.c6
5 files changed, 15 insertions, 12 deletions
diff --git a/src/vlibmemory/memory_api.h b/src/vlibmemory/memory_api.h
index 9b87f5a18fd..58f47d1313a 100644
--- a/src/vlibmemory/memory_api.h
+++ b/src/vlibmemory/memory_api.h
@@ -19,6 +19,7 @@
#define SRC_VLIBMEMORY_MEMORY_API_H_
#include <svm/svm.h>
+#include <svm/ssvm.h>
#include <svm/queue.h>
#include <vlib/vlib.h>
#include <vlibapi/api.h>
diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c
index 1bb2fe86136..a0b5cc99cd4 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -20,6 +20,7 @@
#include <setjmp.h>
#include <svm/svm.h>
+#include <svm/ssvm.h>
#include <vppinfra/serialize.h>
#include <vppinfra/hash.h>
#include <vlibmemory/memory_client.h>
diff --git a/src/vlibmemory/socket_api.c b/src/vlibmemory/socket_api.c
index 3d505359d3b..9c099b9b0b7 100644
--- a/src/vlibmemory/socket_api.c
+++ b/src/vlibmemory/socket_api.c
@@ -25,7 +25,7 @@
#include <sys/stat.h>
#include <vppinfra/byte_order.h>
-#include <svm/memfd.h>
+#include <svm/ssvm.h>
#include <vlibmemory/api.h>
#include <vlibmemory/vl_memory_msg_enum.h>
@@ -528,7 +528,7 @@ void
vl_api_sock_init_shm_t_handler (vl_api_sock_init_shm_t * mp)
{
vl_api_sock_init_shm_reply_t *rmp;
- memfd_private_t _memfd_private, *memfd = &_memfd_private;
+ ssvm_private_t _memfd_private, *memfd = &_memfd_private;
svm_map_region_args_t _args, *a = &_args;
vl_api_registration_t *regp;
api_main_t *am = &api_main;
@@ -554,12 +554,12 @@ vl_api_sock_init_shm_t_handler (vl_api_sock_init_shm_t * mp)
* shmem data structures will be initialized
*/
memset (memfd, 0, sizeof (*memfd));
- memfd->memfd_size = mp->requested_size;
+ memfd->ssvm_size = mp->requested_size;
memfd->requested_va = 0ULL;
memfd->i_am_master = 1;
memfd->name = format (0, "%s%c", regp->name, 0);
- if ((rv = memfd_master_init (memfd, mp->client_index)))
+ if ((rv = ssvm_master_init_memfd (memfd, mp->client_index)))
goto reply;
/* Remember to close this fd when the socket connection goes away */
@@ -569,8 +569,8 @@ vl_api_sock_init_shm_t_handler (vl_api_sock_init_shm_t * mp)
* Create a plausible svm_region in the memfd backed segment
*/
memset (a, 0, sizeof (*a));
- a->baseva = memfd->sh->memfd_va + MMAP_PAGESIZE;
- a->size = memfd->memfd_size - MMAP_PAGESIZE;
+ a->baseva = memfd->sh->ssvm_va + MMAP_PAGESIZE;
+ a->size = memfd->ssvm_size - MMAP_PAGESIZE;
/* $$$$ might want a different config parameter */
a->pvt_heap_size = am->api_pvt_heap_size;
a->flags = SVM_FLAGS_MHEAP;
@@ -622,7 +622,7 @@ vl_api_memfd_segment_create_t_handler (vl_api_memfd_segment_create_t * mp)
{
vl_api_memfd_segment_create_reply_t *rmp;
clib_file_t *cf;
- memfd_private_t _memfd_private, *memfd = &_memfd_private;
+ ssvm_private_t _memfd_private, *memfd = &_memfd_private;
vl_api_registration_t *regp;
int rv;
@@ -634,13 +634,13 @@ vl_api_memfd_segment_create_t_handler (vl_api_memfd_segment_create_t * mp)
}
memset (memfd, 0, sizeof (*memfd));
- memfd->memfd_size = mp->requested_size;
+ memfd->ssvm_size = mp->requested_size;
memfd->requested_va = 0ULL;
memfd->i_am_master = 1;
memfd->name = format (0, "%s%c", regp->name, 0);
/* Set up a memfd segment of the requested size */
- if ((rv = memfd_master_init (memfd, mp->client_index)))
+ if ((rv = ssvm_master_init_memfd (memfd, mp->client_index)))
goto reply;
/* Remember to close this fd when the socket connection goes away */
diff --git a/src/vlibmemory/socket_api.h b/src/vlibmemory/socket_api.h
index 69610e8997a..5cb3c058d5f 100644
--- a/src/vlibmemory/socket_api.h
+++ b/src/vlibmemory/socket_api.h
@@ -19,6 +19,7 @@
#define SRC_VLIBMEMORY_SOCKET_API_H_
#include <vlibapi/api_common.h>
+#include <svm/ssvm.h>
#include <vppinfra/file.h>
#define API_SOCKET_FILE "/run/vpp-api.sock"
diff --git a/src/vlibmemory/socket_client.c b/src/vlibmemory/socket_client.c
index 4567f65e6e1..44d21228bfe 100644
--- a/src/vlibmemory/socket_client.c
+++ b/src/vlibmemory/socket_client.c
@@ -21,7 +21,7 @@
#define __USE_GNU
#include <sys/socket.h>
-#include <svm/memfd.h>
+#include <svm/ssvm.h>
#include <vlibmemory/socket_client.h>
#include <vlibmemory/memory_client.h>
@@ -231,7 +231,7 @@ static void vl_api_sock_init_shm_reply_t_handler
int my_fd = -1;
clib_error_t *error;
i32 retval = ntohl (mp->retval);
- memfd_private_t memfd;
+ ssvm_private_t memfd;
api_main_t *am = &api_main;
u8 *new_name;
@@ -255,7 +255,7 @@ static void vl_api_sock_init_shm_reply_t_handler
memfd.fd = my_fd;
/* Note: this closes memfd.fd */
- retval = memfd_slave_init (&memfd);
+ retval = ssvm_slave_init_memfd (&memfd);
if (retval)
clib_warning ("WARNING: segment map returned %d", retval);