X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fhs_apps%2Fproxy.c;h=1010bf4cfa73c0a7ef174106bb42e0c7c77bd1e0;hb=refs%2Fchanges%2F67%2F39467%2F7;hp=77c047b41a8aba0c5beb0c9973145da3feaa5e06;hpb=c2ab1bdbc73f2743979f8779c027adc04d79bf22;p=vpp.git diff --git a/src/plugins/hs_apps/proxy.c b/src/plugins/hs_apps/proxy.c index 77c047b41a8..1010bf4cfa7 100644 --- a/src/plugins/hs_apps/proxy.c +++ b/src/plugins/hs_apps/proxy.c @@ -478,9 +478,46 @@ static session_cb_vft_t proxy_session_cb_vft = { .builtin_app_tx_callback = proxy_tx_callback, .session_reset_callback = proxy_reset_callback, .session_cleanup_callback = proxy_cleanup_callback, - .fifo_tuning_callback = common_fifo_tuning_callback + .fifo_tuning_callback = common_fifo_tuning_callback, }; +static int +active_open_alloc_session_fifos (session_t *s) +{ + proxy_main_t *pm = &proxy_main; + svm_fifo_t *rxf, *txf; + proxy_session_t *ps; + + clib_spinlock_lock_if_init (&pm->sessions_lock); + + ps = proxy_session_get (s->opaque); + + txf = ps->server_rx_fifo; + rxf = ps->server_tx_fifo; + + /* + * Reset the active-open tx-fifo master indices so the active-open session + * will receive data, etc. + */ + txf->shr->master_session_index = s->session_index; + txf->master_thread_index = s->thread_index; + + /* + * Account for the active-open session's use of the fifos + * so they won't disappear until the last session which uses + * them disappears + */ + rxf->refcnt++; + txf->refcnt++; + + clib_spinlock_unlock_if_init (&pm->sessions_lock); + + s->rx_fifo = rxf; + s->tx_fifo = txf; + + return 0; +} + static int active_open_connected_callback (u32 app_index, u32 opaque, session_t * s, session_error_t err) @@ -521,24 +558,6 @@ active_open_connected_callback (u32 app_index, u32 opaque, return -1; } - s->tx_fifo = ps->server_rx_fifo; - s->rx_fifo = ps->server_tx_fifo; - - /* - * Reset the active-open tx-fifo master indices so the active-open session - * will receive data, etc. - */ - s->tx_fifo->shr->master_session_index = s->session_index; - s->tx_fifo->master_thread_index = s->thread_index; - - /* - * Account for the active-open session's use of the fifos - * so they won't disappear until the last session which uses - * them disappears - */ - s->tx_fifo->refcnt++; - s->rx_fifo->refcnt++; - s->opaque = opaque; clib_spinlock_unlock_if_init (&pm->sessions_lock); @@ -651,7 +670,8 @@ static session_cb_vft_t active_open_clients = { .session_cleanup_callback = active_open_cleanup_callback, .builtin_app_rx_callback = active_open_rx_callback, .builtin_app_tx_callback = active_open_tx_callback, - .fifo_tuning_callback = common_fifo_tuning_callback + .fifo_tuning_callback = common_fifo_tuning_callback, + .proxy_alloc_session_fifos = active_open_alloc_session_fifos, }; /* *INDENT-ON* */