From 9e5f41ed6ebe64a789916794626485460078c420 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Sat, 19 Jan 2019 01:29:33 +0100 Subject: - Code style fix - Improved vpp binary api interface - Correction in object pool destructor - Fix error in Memif Connector Change-Id: Id1dd9219fc1ac0b3717ae019ebff17373bebc635 Signed-off-by: Mauro Sardara --- .../hicn/transport/core/vpp_binary_api_internal.h | 33 +++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) mode change 100755 => 100644 libtransport/src/hicn/transport/core/vpp_binary_api_internal.h (limited to 'libtransport/src/hicn/transport/core/vpp_binary_api_internal.h') diff --git a/libtransport/src/hicn/transport/core/vpp_binary_api_internal.h b/libtransport/src/hicn/transport/core/vpp_binary_api_internal.h old mode 100755 new mode 100644 index 22b665e96..a6e2c01a3 --- a/libtransport/src/hicn/transport/core/vpp_binary_api_internal.h +++ b/libtransport/src/hicn/transport/core/vpp_binary_api_internal.h @@ -27,16 +27,9 @@ extern "C" { #include #include -struct vpp_binary_api { - api_main_t *api_main; - u32 my_client_index; - unix_shared_memory_queue_t *vl_input_queue; - vlib_main_t *vlib_main; - sem_t *semaphore; - u32 ping_id; - int ret_val; - void *user_param; -}; +#include + +typedef struct vpp_binary_api vpp_binary_api_t; struct vpp_plugin_binary_api { vpp_binary_api_t *vpp_api; @@ -44,6 +37,26 @@ struct vpp_plugin_binary_api { u32 my_client_index; }; +#define POINTER_MAP_SIZE 32 +typedef struct { + void *global_pointers_map[POINTER_MAP_SIZE]; + uint8_t global_pointers_map_index; +} context_store_t; + +#define CONTEXT_SAVE(context_store, pointer, mp) \ + do { \ + context_store \ + .global_pointers_map[context_store.global_pointers_map_index] = \ + pointer; \ + mp->context = context_store.global_pointers_map_index++; \ + context_store.global_pointers_map_index %= POINTER_MAP_SIZE; \ + } while (0); + +#define CONTEXT_GET(context_store, mp, pointer) \ + do { \ + pointer = context_store.global_pointers_map[mp->context]; \ + } while (0); + #define M(T, mp) \ do { \ mp = vl_msg_api_alloc_as_if_client(sizeof(*mp)); \ -- cgit 1.2.3-korg