summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-07-17 10:46:29 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-07-27 17:40:29 +0000
commit54693d23307ce8944a4d97379efd3bd4dcf0485c (patch)
tree14ee8cded17a87405de9c0cc9ba3fe7370aabc7f /src/vnet/session/application.c
parent5df580eec93c0c6fc07dd38f8713f671565b9c38 (diff)
vcl: use events for epoll/select/read/write
Have vcl poll and wait on the event message queues as opposed to constantly polling the session fifos. This also adds event signaling to cut through sessions. On the downside, because we can't wait on multiple condvars, i.e., when we have multiple message queues because of cut-through registrations, we do timed waits. Change-Id: I29ade95dba449659fe46008bb1af502276a7c5fd Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application.c')
-rw-r--r--src/vnet/session/application.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 5f18bd27b2a..806e390d311 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -849,12 +849,11 @@ app_send_io_evt_rx (application_t * app, stream_session_t * s, u8 lock)
return 0;
}
- /* Built-in app? Hand event to the callback... */
if (app->cb_fns.builtin_app_rx_callback)
return app->cb_fns.builtin_app_rx_callback (s);
- /* If no need for event, return */
- if (!svm_fifo_set_event (s->server_rx_fifo))
+ if (svm_fifo_has_event (s->server_rx_fifo)
+ || svm_fifo_is_empty (s->server_rx_fifo))
return 0;
mq = app->event_queue;
@@ -876,7 +875,10 @@ app_send_io_evt_rx (application_t * app, stream_session_t * s, u8 lock)
evt->fifo = s->server_rx_fifo;
evt->event_type = FIFO_EVENT_APP_RX;
- return app_enqueue_evt (mq, &msg, lock);
+ if (app_enqueue_evt (mq, &msg, lock))
+ return -1;
+ svm_fifo_set_event (s->server_rx_fifo);
+ return 0;
}
static inline int
@@ -1081,6 +1083,7 @@ application_local_session_connect (u32 table_index, application_t * client,
{
u32 seg_size, evt_q_sz, evt_q_elts, margin = 16 << 10;
segment_manager_properties_t *props, *cprops;
+ u32 round_rx_fifo_sz, round_tx_fifo_sz;
int rv, has_transport, seg_index;
svm_fifo_segment_private_t *seg;
segment_manager_t *sm;
@@ -1093,7 +1096,9 @@ application_local_session_connect (u32 table_index, application_t * client,
cprops = application_segment_manager_properties (client);
evt_q_elts = props->evt_q_size + cprops->evt_q_size;
evt_q_sz = segment_manager_evt_q_expected_size (evt_q_elts);
- seg_size = props->rx_fifo_size + props->tx_fifo_size + evt_q_sz + margin;
+ round_rx_fifo_sz = 1 << max_log2 (props->rx_fifo_size);
+ round_tx_fifo_sz = 1 << max_log2 (props->tx_fifo_size);
+ seg_size = round_rx_fifo_sz + round_tx_fifo_sz + evt_q_sz + margin;
has_transport = session_has_transport ((stream_session_t *) ll);
if (!has_transport)