diff options
author | Florin Coras <fcoras@cisco.com> | 2018-01-05 03:20:25 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-01-09 18:33:08 +0000 |
commit | e86a8edd3c14fb41ace2a12efd17bc7772bf623f (patch) | |
tree | 480219864cadd743fdb95c21379aeaf88a985e23 /src/tests/vnet/session/tcp_echo.c | |
parent | 4363ad6c96b5641fca1b16c5a6ec22e2364adcfd (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/vnet/session/tcp_echo.c')
-rw-r--r-- | src/tests/vnet/session/tcp_echo.c | 34 |
1 files changed, 13 insertions, 21 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: |