Program session events using session handles instead of fifos.
Type: improvement
Change-Id: I69063190598c2b4dc1104f2938f27c6cd057341a
Signed-off-by: Florin Coras <fcoras@cisco.com>
svm_fifo_t *f = es->tx_fifo;
rv = clib_min (svm_fifo_max_enqueue_prod (f), bytes_this_chunk);
svm_fifo_enqueue_nocopy (f, rv);
- session_send_io_evt_to_thread_custom (
- &es->vpp_session_index, es->thread_index, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (es->tx_fifo->vpp_sh, SESSION_IO_EVT_TX);
}
else
rv =
hdr.lcl_port = at->lcl_port;
svm_fifo_enqueue (f, sizeof (hdr), (u8 *) & hdr);
svm_fifo_enqueue_nocopy (f, rv);
- session_send_io_evt_to_thread_custom (
- &es->vpp_session_index, es->thread_index, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (es->tx_fifo->vpp_sh, SESSION_IO_EVT_TX);
}
else
{
rv = svm_fifo_enqueue (s->tx_fifo, sizeof (ecm->cfg), (u8 *) &ecm->cfg);
ASSERT (rv == sizeof (ecm->cfg));
- session_send_io_evt_to_thread (s->tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (s->handle, SESSION_IO_EVT_TX);
return 0;
}
rv = svm_fifo_enqueue (s->tx_fifo, sizeof (esm->cfg), (u8 *) &esm->cfg);
ASSERT (rv == sizeof (esm->cfg));
- session_send_io_evt_to_thread_custom (&s->session_index, s->thread_index,
- SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (s->handle, SESSION_IO_EVT_TX);
}
static int
{
/* TODO should be session_enqueue_notify(s) but quic tests seem
* to fail if that's the case */
- if (session_send_io_evt_to_thread (rx_fifo,
- SESSION_IO_EVT_BUILTIN_RX))
+ if (session_program_transport_io_evt (s->handle,
+ SESSION_IO_EVT_BUILTIN_RX))
es_err ("failed to enqueue self-tap");
if (es->rx_retries == 500000)
* Send event for server tx fifo
*/
if (svm_fifo_set_event (proxy_tx_fifo))
- {
- u8 thread_index = proxy_tx_fifo->master_thread_index;
- u32 session_index = proxy_tx_fifo->vpp_session_index;
- return session_send_io_evt_to_thread_custom (&session_index,
- thread_index,
- SESSION_IO_EVT_TX);
- }
+ session_program_tx_io_evt (proxy_tx_fifo->vpp_sh, SESSION_IO_EVT_TX);
if (svm_fifo_max_enqueue (proxy_tx_fifo) <= TCP_MSS)
svm_fifo_add_want_deq_ntf (proxy_tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
if (sc->pair.is_http)
{
/* notify HTTP transport */
- session_t *po = session_get_from_handle (sc->pair.session_handle);
- session_send_io_evt_to_thread_custom (
- &po->session_index, po->thread_index, SESSION_IO_EVT_RX);
+ session_program_rx_io_evt (sc->pair.session_handle);
}
else
{
{
int rv = 0;
if (svm_fifo_set_event (udp_session->tx_fifo))
- rv = session_send_io_evt_to_thread (udp_session->tx_fifo,
- SESSION_IO_EVT_TX);
+ rv = session_program_tx_io_evt (udp_session->handle, SESSION_IO_EVT_TX);
if (PREDICT_FALSE (rv))
clib_warning ("Event enqueue errored %d", rv);
}
quic_session = session_get (ctx->c_s_index, ctx->c_thread_index);
if (svm_fifo_set_event (quic_session->tx_fifo))
{
- rv = session_send_io_evt_to_thread_custom (
- quic_session, quic_session->thread_index, SESSION_IO_EVT_TX);
- if (PREDICT_FALSE (rv))
- QUIC_ERR ("Failed to enqueue builtin_tx %d", rv);
+ rv = session_program_tx_io_evt (quic_session->handle,
+ SESSION_IO_EVT_TX);
+ if (PREDICT_FALSE (rv))
+ QUIC_ERR ("Failed to enqueue builtin_tx %d", rv);
}
return;
}
if (n_wrote)
{
if (svm_fifo_set_event (us->tx_fifo))
- session_send_io_evt_to_thread (us->tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (us->handle, SESSION_IO_EVT_TX);
}
if (PREDICT_FALSE (ctx->app_closed &&
us->opaque = ctx_handle;
us->flags &= ~SESSION_F_IS_MIGRATING;
if (svm_fifo_max_dequeue (us->tx_fifo))
- session_send_io_evt_to_thread (us->tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (us->handle, SESSION_IO_EVT_TX);
/* Migrate app session as well */
session_dgram_connect_notify (&ctx->connection, old_thread_index,
if (svm_fifo_needs_deq_ntf (s->rx_fifo, rv))
{
svm_fifo_clear_deq_ntf (s->rx_fifo);
- session_send_io_evt_to_thread (s->rx_fifo, SESSION_IO_EVT_RX);
+ session_program_transport_io_evt (s->handle, SESSION_IO_EVT_RX);
}
if (svm_fifo_is_empty_cons (s->rx_fifo))
if (svm_fifo_needs_deq_ntf (tcp_rx_fifo, read))
{
svm_fifo_clear_deq_ntf (tcp_rx_fifo);
- session_send_io_evt_to_thread (tcp_rx_fifo, SESSION_IO_EVT_RX);
+ session_program_transport_io_evt (tcp_rx_fifo->vpp_sh,
+ SESSION_IO_EVT_RX);
}
}
{
svm_fifo_enqueue_nocopy (tcp_tx_fifo, wrote);
if (svm_fifo_set_event (tcp_tx_fifo))
- session_send_io_evt_to_thread (tcp_tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (tcp_tx_fifo->vpp_sh, SESSION_IO_EVT_TX);
}
return wrote;
return 0;
}
+/* Deprecated, use session_program_* functions */
int
session_send_io_evt_to_thread (svm_fifo_t * f, session_evt_type_t evt_type)
{
f->master_thread_index, evt_type);
}
+/* Deprecated, use session_program_* functions */
int
session_send_io_evt_to_thread_custom (void *data, u32 thread_index,
session_evt_type_t evt_type)
}
}
+int
+session_program_transport_io_evt (session_handle_tu_t sh,
+ session_evt_type_t evt_type)
+{
+ return session_send_evt_to_thread ((void *) &sh.session_index, 0,
+ (u32) sh.thread_index, evt_type);
+}
+
int
session_send_ctrl_evt_to_thread (session_t * s, session_evt_type_t evt_type)
{
int session_enqueue_notify (session_t *s);
int session_dequeue_notify (session_t * s);
int session_enqueue_notify_cl (session_t *s);
+/* Deprecated, use session_program_* functions */
int session_send_io_evt_to_thread (svm_fifo_t *f, session_evt_type_t evt_type);
+/* Deprecated, use session_program_* functions */
int session_send_io_evt_to_thread_custom (void *data, u32 thread_index,
session_evt_type_t evt_type);
int session_program_tx_io_evt (session_handle_tu_t sh,
session_evt_type_t evt_type);
int session_program_rx_io_evt (session_handle_tu_t sh);
+int session_program_transport_io_evt (session_handle_tu_t sh,
+ session_evt_type_t evt_type);
void session_send_rpc_evt_to_thread (u32 thread_index, void *fp,
void *rpc_args);
void session_send_rpc_evt_to_thread_force (u32 thread_index, void *fp,
session_t *s = session_get (tc->s_index, tc->thread_index);
if (svm_fifo_has_event (s->tx_fifo))
return;
- session_send_io_evt_to_thread (s->tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (s->handle, SESSION_IO_EVT_TX);
}
always_inline u32
* Retransmit messages that may have been lost
*/
if (s->tx_fifo && !svm_fifo_is_empty (s->tx_fifo))
- session_send_io_evt_to_thread (s->tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (s->handle, SESSION_IO_EVT_TX);
if (s->rx_fifo && !svm_fifo_is_empty (s->rx_fifo))
app_worker_rx_notify (app_wrk, s);
tls_add_vpp_q_rx_evt (session_t * s)
{
if (svm_fifo_set_event (s->rx_fifo))
- session_send_io_evt_to_thread (s->rx_fifo, SESSION_IO_EVT_RX);
+ session_enqueue_notify (s);
return 0;
}
tls_add_vpp_q_tx_evt (session_t * s)
{
if (svm_fifo_set_event (s->tx_fifo))
- session_send_io_evt_to_thread (s->tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (s->handle, SESSION_IO_EVT_TX);
return 0;
}
}
if (svm_fifo_max_dequeue (us->tx_fifo))
- session_send_io_evt_to_thread (us->tx_fifo, SESSION_IO_EVT_TX);
+ session_program_tx_io_evt (us->handle, SESSION_IO_EVT_TX);
}
static void