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/vnet/tcp | |
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/vnet/tcp')
-rw-r--r-- | src/vnet/tcp/builtin_client.c | 2 | ||||
-rw-r--r-- | src/vnet/tcp/builtin_client.h | 5 | ||||
-rw-r--r-- | src/vnet/tcp/builtin_http_server.c | 11 | ||||
-rw-r--r-- | src/vnet/tcp/builtin_proxy.c | 6 | ||||
-rw-r--r-- | src/vnet/tcp/builtin_proxy.h | 7 | ||||
-rw-r--r-- | src/vnet/tcp/builtin_server.c | 13 |
6 files changed, 20 insertions, 24 deletions
diff --git a/src/vnet/tcp/builtin_client.c b/src/vnet/tcp/builtin_client.c index 319b70f2008..b073459c52e 100644 --- a/src/vnet/tcp/builtin_client.c +++ b/src/vnet/tcp/builtin_client.c @@ -100,7 +100,7 @@ send_test_chunk (tclient_main_t * tm, session_t * s) evt.fifo = txf; evt.event_type = FIFO_EVENT_APP_TX; - if (unix_shared_memory_queue_add + if (svm_queue_add (tm->vpp_event_queue[txf->master_thread_index], (u8 *) & evt, 0 /* do wait for mutex */ )) clib_warning ("could not enqueue event"); diff --git a/src/vnet/tcp/builtin_client.h b/src/vnet/tcp/builtin_client.h index a214ae1e1b1..be8ea002639 100644 --- a/src/vnet/tcp/builtin_client.h +++ b/src/vnet/tcp/builtin_client.h @@ -24,7 +24,6 @@ #include <vppinfra/hash.h> #include <vppinfra/error.h> -#include <vlibmemory/unix_shared_memory_queue.h> #include <svm/svm_fifo_segment.h> #include <vnet/session/session.h> #include <vnet/session/application_interface.h> @@ -47,8 +46,8 @@ typedef struct /* * Application setup parameters */ - unix_shared_memory_queue_t *vl_input_queue; /**< vpe input queue */ - unix_shared_memory_queue_t **vpp_event_queue; + svm_queue_t *vl_input_queue; /**< vpe input queue */ + svm_queue_t **vpp_event_queue; u32 cli_node_index; /**< cli process node index */ u32 my_client_index; /**< loopback API client handle */ diff --git a/src/vnet/tcp/builtin_http_server.c b/src/vnet/tcp/builtin_http_server.c index 6e1cd8e770e..356cfd86b91 100644 --- a/src/vnet/tcp/builtin_http_server.c +++ b/src/vnet/tcp/builtin_http_server.c @@ -32,7 +32,7 @@ typedef struct typedef struct { u8 **rx_buf; - unix_shared_memory_queue_t **vpp_queue; + svm_queue_t **vpp_queue; u64 byte_index; uword *handler_by_get_request; @@ -40,7 +40,7 @@ typedef struct u32 *free_http_cli_process_node_indices; /* Sever's event queue */ - unix_shared_memory_queue_t *vl_input_queue; + svm_queue_t *vl_input_queue; /* API client handle */ u32 my_client_index; @@ -175,9 +175,8 @@ send_data (stream_session_t * s, u8 * data) evt.fifo = s->server_tx_fifo; evt.event_type = FIFO_EVENT_APP_TX; - unix_shared_memory_queue_add (hsm->vpp_queue[s->thread_index], - (u8 *) & evt, - 0 /* do wait for mutex */ ); + svm_queue_add (hsm->vpp_queue[s->thread_index], + (u8 *) & evt, 0 /* do wait for mutex */ ); } delay = 10e-3; } @@ -377,7 +376,7 @@ http_server_rx_callback (stream_session_t * s) evt.rpc_args.fp = alloc_http_process_callback; evt.rpc_args.arg = args; evt.event_type = FIFO_EVENT_RPC; - unix_shared_memory_queue_add + svm_queue_add (session_manager_get_vpp_event_queue (0 /* main thread */ ), (u8 *) & evt, 0 /* do wait for mutex */ ); } diff --git a/src/vnet/tcp/builtin_proxy.c b/src/vnet/tcp/builtin_proxy.c index 7f70df39069..974830ea756 100644 --- a/src/vnet/tcp/builtin_proxy.c +++ b/src/vnet/tcp/builtin_proxy.c @@ -185,7 +185,7 @@ server_rx_callback (stream_session_t * s) { evt.fifo = active_open_tx_fifo; evt.event_type = FIFO_EVENT_APP_TX; - if (unix_shared_memory_queue_add + if (svm_queue_add (bpm->active_open_event_queue[thread_index], (u8 *) & evt, 0 /* do wait for mutex */ )) clib_warning ("failed to enqueue tx evt"); @@ -299,7 +299,7 @@ active_open_connected_callback (u32 app_index, u32 opaque, { evt.fifo = s->server_tx_fifo; evt.event_type = FIFO_EVENT_APP_TX; - if (unix_shared_memory_queue_add + if (svm_queue_add (bpm->active_open_event_queue[thread_index], (u8 *) & evt, 0 /* do wait for mutex */ )) clib_warning ("failed to enqueue tx evt"); @@ -343,7 +343,7 @@ active_open_rx_callback (stream_session_t * s) { evt.fifo = server_rx_fifo; evt.event_type = FIFO_EVENT_APP_TX; - if (unix_shared_memory_queue_add + if (svm_queue_add (bpm->server_event_queue[thread_index], (u8 *) & evt, 0 /* do wait for mutex */ )) clib_warning ("failed to enqueue server rx evt"); diff --git a/src/vnet/tcp/builtin_proxy.h b/src/vnet/tcp/builtin_proxy.h index c8cde5f70e6..780f8b65b90 100644 --- a/src/vnet/tcp/builtin_proxy.h +++ b/src/vnet/tcp/builtin_proxy.h @@ -24,7 +24,6 @@ #include <vppinfra/hash.h> #include <vppinfra/error.h> -#include <vlibmemory/unix_shared_memory_queue.h> #include <svm/svm_fifo_segment.h> #include <vnet/session/session.h> #include <vnet/session/application_interface.h> @@ -40,10 +39,10 @@ typedef struct typedef struct { - unix_shared_memory_queue_t *vl_input_queue; /**< vpe input queue */ + svm_queue_t *vl_input_queue; /**< vpe input queue */ /** per-thread vectors */ - unix_shared_memory_queue_t **server_event_queue; - unix_shared_memory_queue_t **active_open_event_queue; + svm_queue_t **server_event_queue; + svm_queue_t **active_open_event_queue; u8 **rx_buf; /**< intermediate rx buffers */ u32 cli_node_index; /**< cli process node index */ diff --git a/src/vnet/tcp/builtin_server.c b/src/vnet/tcp/builtin_server.c index 26cbfe77727..eafef8227e2 100644 --- a/src/vnet/tcp/builtin_server.c +++ b/src/vnet/tcp/builtin_server.c @@ -23,8 +23,8 @@ typedef struct /* * Server app parameters */ - unix_shared_memory_queue_t **vpp_queue; - unix_shared_memory_queue_t *vl_input_queue; /**< Sever's event queue */ + svm_queue_t **vpp_queue; + svm_queue_t *vl_input_queue; /**< Sever's event queue */ u32 app_index; /**< Server app index */ u32 my_client_index; /**< API client handle */ @@ -186,14 +186,14 @@ builtin_server_rx_callback (stream_session_t * s) /* Program self-tap to retry */ if (svm_fifo_set_event (rx_fifo)) { - unix_shared_memory_queue_t *q; + svm_queue_t *q; evt.fifo = rx_fifo; evt.event_type = FIFO_EVENT_BUILTIN_RX; q = bsm->vpp_queue[thread_index]; if (PREDICT_FALSE (q->cursize == q->maxsize)) clib_warning ("out of event queue space"); - else if (unix_shared_memory_queue_add (q, (u8 *) & evt, 0)) + else if (svm_queue_add (q, (u8 *) & evt, 0)) clib_warning ("failed to enqueue self-tap"); if (bsm->rx_retries[thread_index][s->session_index] == 500000) @@ -231,9 +231,8 @@ builtin_server_rx_callback (stream_session_t * s) evt.fifo = tx_fifo; evt.event_type = FIFO_EVENT_APP_TX; - if (unix_shared_memory_queue_add (bsm->vpp_queue[s->thread_index], - (u8 *) & evt, - 0 /* do wait for mutex */ )) + if (svm_queue_add (bsm->vpp_queue[s->thread_index], + (u8 *) & evt, 0 /* do wait for mutex */ )) clib_warning ("failed to enqueue tx evt"); } |