aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-05 03:20:25 -0800
committerDave Barach <openvpp@barachs.net>2018-01-09 18:33:08 +0000
commite86a8edd3c14fb41ace2a12efd17bc7772bf623f (patch)
tree480219864cadd743fdb95c21379aeaf88a985e23 /src/tests
parent4363ad6c96b5641fca1b16c5a6ec22e2364adcfd (diff)
api: refactor vlibmemory
- separate client/server code for both memory and socket apis - separate memory api code from generic vlib api code - move unix_shared_memory_fifo to svm and rename to svm_fifo_t - overall declutter Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/vnet/session/tcp_echo.c34
-rw-r--r--src/tests/vnet/session/udp_echo.c32
2 files changed, 26 insertions, 40 deletions
diff --git a/src/tests/vnet/session/tcp_echo.c b/src/tests/vnet/session/tcp_echo.c
index 30eb54dcdda..ed9e2f7b780 100644
--- a/src/tests/vnet/session/tcp_echo.c
+++ b/src/tests/vnet/session/tcp_echo.c
@@ -60,7 +60,7 @@ typedef enum
typedef struct
{
/* vpe input queue */
- unix_shared_memory_queue_t *vl_input_queue;
+ svm_queue_t *vl_input_queue;
/* API client handle */
u32 my_client_index;
@@ -88,10 +88,10 @@ typedef struct
int drop_packets;
/* Our event queue */
- unix_shared_memory_queue_t *our_event_queue;
+ svm_queue_t *our_event_queue;
/* $$$ single thread only for the moment */
- unix_shared_memory_queue_t *vpp_event_queue;
+ svm_queue_t *vpp_event_queue;
u8 *socket_name;
@@ -271,8 +271,7 @@ vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *
}
utm->our_event_queue =
- uword_to_pointer (mp->app_event_queue_address,
- unix_shared_memory_queue_t *);
+ uword_to_pointer (mp->app_event_queue_address, svm_queue_t *);
utm->state = STATE_ATTACHED;
}
@@ -506,8 +505,7 @@ client_handle_event_queue (uri_tcp_test_main_t * utm)
{
session_fifo_event_t _e, *e = &_e;;
- unix_shared_memory_queue_sub (utm->our_event_queue, (u8 *) e,
- 0 /* nowait */ );
+ svm_queue_sub (utm->our_event_queue, (u8 *) e, 0 /* nowait */ );
switch (e->event_type)
{
case FIFO_EVENT_APP_RX:
@@ -532,8 +530,7 @@ client_rx_thread_fn (void *arg)
utm->client_bytes_received = 0;
while (1)
{
- unix_shared_memory_queue_sub (utm->our_event_queue, (u8 *) e,
- 0 /* nowait */ );
+ svm_queue_sub (utm->our_event_queue, (u8 *) e, 0 /* nowait */ );
switch (e->event_type)
{
case FIFO_EVENT_APP_RX:
@@ -578,8 +575,7 @@ vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp)
}
utm->vpp_event_queue =
- uword_to_pointer (mp->vpp_event_queue_address,
- unix_shared_memory_queue_t *);
+ uword_to_pointer (mp->vpp_event_queue_address, svm_queue_t *);
/*
* Setup session
@@ -650,9 +646,8 @@ send_test_chunk (uri_tcp_test_main_t * utm, svm_fifo_t * tx_fifo, int mypid,
evt.fifo = tx_fifo;
evt.event_type = FIFO_EVENT_APP_TX;
- unix_shared_memory_queue_add (utm->vpp_event_queue,
- (u8 *) & evt,
- 0 /* do wait for mutex */ );
+ svm_queue_add (utm->vpp_event_queue,
+ (u8 *) & evt, 0 /* do wait for mutex */ );
}
}
}
@@ -915,8 +910,7 @@ vl_api_accept_session_t_handler (vl_api_accept_session_t * mp)
clib_warning ("Accepted session from: %s:%d", ip_str,
clib_net_to_host_u16 (mp->port));
utm->vpp_event_queue =
- uword_to_pointer (mp->vpp_event_queue_address,
- unix_shared_memory_queue_t *);
+ uword_to_pointer (mp->vpp_event_queue_address, svm_queue_t *);
/* Allocate local session and set it up */
pool_get (utm->sessions, session);
@@ -965,7 +959,7 @@ server_handle_fifo_event_rx (uri_tcp_test_main_t * utm,
svm_fifo_t *rx_fifo, *tx_fifo;
int n_read;
session_fifo_event_t evt;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
session_t *session;
int rv;
u32 max_dequeue, offset, max_transfer, rx_buf_len;
@@ -1019,8 +1013,7 @@ server_handle_fifo_event_rx (uri_tcp_test_main_t * utm,
evt.event_type = FIFO_EVENT_APP_TX;
q = utm->vpp_event_queue;
- unix_shared_memory_queue_add (q, (u8 *) & evt,
- 1 /* do wait for mutex */ );
+ svm_queue_add (q, (u8 *) & evt, 1 /* do wait for mutex */ );
}
}
}
@@ -1034,8 +1027,7 @@ server_handle_event_queue (uri_tcp_test_main_t * utm)
while (1)
{
- unix_shared_memory_queue_sub (utm->our_event_queue, (u8 *) e,
- 0 /* nowait */ );
+ svm_queue_sub (utm->our_event_queue, (u8 *) e, 0 /* nowait */ );
switch (e->event_type)
{
case FIFO_EVENT_APP_RX:
diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c
index ac9411835ec..4e17a1748da 100644
--- a/src/tests/vnet/session/udp_echo.c
+++ b/src/tests/vnet/session/udp_echo.c
@@ -65,7 +65,7 @@ typedef struct
typedef struct
{
/* vpe input queue */
- unix_shared_memory_queue_t *vl_input_queue;
+ svm_queue_t *vl_input_queue;
/* API client handle */
u32 my_client_index;
@@ -91,10 +91,10 @@ typedef struct
int i_am_master;
/* Our event queue */
- unix_shared_memory_queue_t *our_event_queue;
+ svm_queue_t *our_event_queue;
/* $$$ single thread only for the moment */
- unix_shared_memory_queue_t *vpp_event_queue;
+ svm_queue_t *vpp_event_queue;
/* $$$$ hack: cut-through session index */
volatile u32 cut_through_session_index;
@@ -233,8 +233,7 @@ vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *
}
utm->our_event_queue =
- uword_to_pointer (mp->app_event_queue_address,
- unix_shared_memory_queue_t *);
+ uword_to_pointer (mp->app_event_queue_address, svm_queue_t *);
}
static void
@@ -488,9 +487,8 @@ send_test_chunk (uri_udp_test_main_t * utm, svm_fifo_t * tx_fifo, int mypid,
evt.fifo = tx_fifo;
evt.event_type = FIFO_EVENT_APP_TX;
- unix_shared_memory_queue_add (utm->vpp_event_queue,
- (u8 *) & evt,
- 0 /* do wait for mutex */ );
+ svm_queue_add (utm->vpp_event_queue,
+ (u8 *) & evt, 0 /* do wait for mutex */ );
}
}
}
@@ -636,7 +634,7 @@ vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
svm_fifo_segment_create_args_t _a, *a = &_a;
svm_fifo_segment_private_t *seg;
- unix_shared_memory_queue_t *client_q;
+ svm_queue_t *client_q;
vl_api_connect_session_reply_t *rmp;
session_t *session = 0;
int rv = 0;
@@ -699,8 +697,7 @@ send_reply:
vec_free (a->segment_name);
- client_q =
- uword_to_pointer (mp->client_queue_address, unix_shared_memory_queue_t *);
+ client_q = uword_to_pointer (mp->client_queue_address, svm_queue_t *);
vl_msg_api_send_shmem (client_q, (u8 *) & rmp);
}
@@ -728,8 +725,7 @@ vl_api_accept_session_t_handler (vl_api_accept_session_t * mp)
start_time = clib_time_now (&utm->clib_time);
utm->vpp_event_queue =
- uword_to_pointer (mp->vpp_event_queue_address,
- unix_shared_memory_queue_t *);
+ uword_to_pointer (mp->vpp_event_queue_address, svm_queue_t *);
pool_get (utm->sessions, session);
@@ -850,7 +846,7 @@ vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp)
{
utm->connected_session = session - utm->sessions;
utm->vpp_event_queue = uword_to_pointer (mp->vpp_event_queue_address,
- unix_shared_memory_queue_t *);
+ svm_queue_t *);
}
utm->state = STATE_READY;
}
@@ -921,7 +917,7 @@ server_handle_fifo_event_rx (uri_udp_test_main_t * utm,
svm_fifo_t *rx_fifo, *tx_fifo;
int nbytes;
session_fifo_event_t evt;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
int rv;
rx_fifo = e->fifo;
@@ -946,8 +942,7 @@ server_handle_fifo_event_rx (uri_udp_test_main_t * utm,
evt.fifo = tx_fifo;
evt.event_type = FIFO_EVENT_APP_TX;
q = utm->vpp_event_queue;
- unix_shared_memory_queue_add (q, (u8 *) & evt,
- 0 /* do wait for mutex */ );
+ svm_queue_add (q, (u8 *) & evt, 0 /* do wait for mutex */ );
}
}
@@ -961,8 +956,7 @@ server_handle_event_queue (uri_udp_test_main_t * utm)
while (1)
{
- unix_shared_memory_queue_sub (utm->our_event_queue, (u8 *) e,
- 0 /* nowait */ );
+ svm_queue_sub (utm->our_event_queue, (u8 *) e, 0 /* nowait */ );
switch (e->event_type)
{
case FIFO_EVENT_APP_RX: