X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession-apps%2Fproxy.c;h=f7896a5b0ae0c1ec8155fc49899abbfb951d9b54;hb=b7b929931a07fbb27b43d5cd105f366c3e29807e;hp=596b0374b954fe33ce8bea761e484b131f46d514;hpb=70816f0cca308ce3cbf98cdbdb14e02550362b9f;p=vpp.git diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c index 596b0374b95..f7896a5b0ae 100644 --- a/src/vnet/session-apps/proxy.c +++ b/src/vnet/session-apps/proxy.c @@ -116,7 +116,7 @@ delete_proxy_session (stream_session_t * s, int is_active_open) if (ps) { if (CLIB_DEBUG > 0) - memset (ps, 0xFE, sizeof (*ps)); + clib_memset (ps, 0xFE, sizeof (*ps)); pool_put (pm->sessions, ps); } @@ -194,7 +194,6 @@ proxy_rx_callback (stream_session_t * s) int proxy_index; uword *p; svm_fifo_t *active_open_tx_fifo; - session_fifo_event_t evt; ASSERT (s->thread_index == thread_index); @@ -212,10 +211,9 @@ proxy_rx_callback (stream_session_t * s) if (svm_fifo_set_event (active_open_tx_fifo)) { u32 ao_thread_index = active_open_tx_fifo->master_thread_index; - evt.fifo = active_open_tx_fifo; - evt.event_type = FIFO_EVENT_APP_TX; - if (svm_queue_add (pm->active_open_event_queue[ao_thread_index], - (u8 *) & evt, 0 /* do wait for mutex */ )) + if (session_send_io_evt_to_thread_custom (active_open_tx_fifo, + ao_thread_index, + FIFO_EVENT_APP_TX)) clib_warning ("failed to enqueue tx evt"); } } @@ -237,11 +235,11 @@ proxy_rx_callback (stream_session_t * s) /* $$$ your message in this space: parse url, etc. */ - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); clib_spinlock_lock_if_init (&pm->sessions_lock); pool_get (pm->sessions, ps); - memset (ps, 0, sizeof (*ps)); + clib_memset (ps, 0, sizeof (*ps)); ps->server_rx_fifo = rx_fifo; ps->server_tx_fifo = tx_fifo; ps->vpp_server_handle = session_handle (s); @@ -278,7 +276,6 @@ active_open_connected_callback (u32 app_index, u32 opaque, proxy_main_t *pm = &proxy_main; proxy_session_t *ps; u8 thread_index = vlib_get_thread_index (); - session_fifo_event_t evt; if (is_fail) { @@ -320,15 +317,9 @@ active_open_connected_callback (u32 app_index, u32 opaque, /* * Send event for active open tx fifo */ + ASSERT (s->thread_index == thread_index); if (svm_fifo_set_event (s->server_tx_fifo)) - { - evt.fifo = s->server_tx_fifo; - evt.event_type = FIFO_EVENT_APP_TX; - if (svm_queue_add - (pm->active_open_event_queue[thread_index], (u8 *) & evt, - 0 /* do wait for mutex */ )) - clib_warning ("failed to enqueue tx evt"); - } + session_send_io_evt_to_thread (s->server_tx_fifo, FIFO_EVENT_APP_TX); return 0; } @@ -354,8 +345,6 @@ active_open_disconnect_callback (stream_session_t * s) static int active_open_rx_callback (stream_session_t * s) { - proxy_main_t *pm = &proxy_main; - session_fifo_event_t evt; svm_fifo_t *proxy_tx_fifo; proxy_tx_fifo = s->server_rx_fifo; @@ -365,12 +354,10 @@ active_open_rx_callback (stream_session_t * s) */ if (svm_fifo_set_event (proxy_tx_fifo)) { - u32 p_thread_index = proxy_tx_fifo->master_thread_index; - evt.fifo = proxy_tx_fifo; - evt.event_type = FIFO_EVENT_APP_TX; - if (svm_queue_add (pm->server_event_queue[p_thread_index], (u8 *) & evt, - 0 /* do wait for mutex */ )) - clib_warning ("failed to enqueue server rx evt"); + u8 thread_index = proxy_tx_fifo->master_thread_index; + return session_send_io_evt_to_thread_custom (proxy_tx_fifo, + thread_index, + FIFO_EVENT_APP_TX); } return 0; @@ -410,8 +397,8 @@ proxy_server_attach () vnet_app_attach_args_t _a, *a = &_a; u32 segment_size = 512 << 20; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); if (pm->private_segment_size) segment_size = pm->private_segment_size; @@ -423,7 +410,7 @@ proxy_server_attach () a->options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size; a->options[APP_OPTIONS_PRIVATE_SEGMENT_COUNT] = pm->private_segment_count; a->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = - pm->prealloc_fifos ? pm->prealloc_fifos : 1; + pm->prealloc_fifos ? pm->prealloc_fifos : 0; a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN; @@ -444,8 +431,8 @@ active_open_attach (void) vnet_app_attach_args_t _a, *a = &_a; u64 options[16]; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); a->api_client_index = pm->active_open_client_index; a->session_cb_vft = &active_open_clients; @@ -456,7 +443,7 @@ active_open_attach (void) options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size; options[APP_OPTIONS_PRIVATE_SEGMENT_COUNT] = pm->private_segment_count; options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = - pm->prealloc_fifos ? pm->prealloc_fifos : 1; + pm->prealloc_fifos ? pm->prealloc_fifos : 0; options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN | APP_OPTIONS_FLAGS_IS_PROXY; @@ -476,7 +463,7 @@ proxy_server_listen () { proxy_main_t *pm = &proxy_main; vnet_bind_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = pm->server_app_index; a->uri = (char *) pm->server_uri; return vnet_bind_uri (a);