From 4d9b9d8e74f12a26404ccdd8baf46c61b44584db Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Sun, 14 Jan 2018 12:25:50 -0800 Subject: svm: refactor memfd and remove ssvm_eth Change-Id: Icde296e956eb89ea3a17d547f04a833916ec6440 Signed-off-by: Florin Coras --- src/vlibmemory/memory_api.h | 1 + src/vlibmemory/memory_client.c | 1 + src/vlibmemory/socket_api.c | 18 +++++++++--------- src/vlibmemory/socket_api.h | 1 + src/vlibmemory/socket_client.c | 6 +++--- 5 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src/vlibmemory') 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 +#include #include #include #include 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 #include +#include #include #include #include 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 #include -#include +#include #include #include @@ -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 +#include #include #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 -#include +#include #include #include @@ -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); -- cgit 1.2.3-korg