aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-05-07 16:28:16 -0700
committerDave Barach <openvpp@barachs.net>2019-05-08 21:15:38 +0000
commit0e573f56dc4986b2f21ffedddb1c5a2424f88b0d (patch)
tree6469c3c3059ce6b55cd0c5f35557dbdaa68cba75 /src/vnet
parent1538824a30ab3bb4d651e34ebf077c6958aeb259 (diff)
session: send tx events when data is dequeued
Change-Id: Ib8cb19361c42e38e3f68d7147358378fff161eb1 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application.h1
-rw-r--r--src/vnet/session/application_worker.c14
-rw-r--r--src/vnet/session/session.c4
-rw-r--r--src/vnet/session/session_node.c15
4 files changed, 23 insertions, 11 deletions
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 4485b743589..cb83f653b9b 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -227,6 +227,7 @@ int app_worker_connect_notify (app_worker_t * app_wrk, session_t * s,
int app_worker_close_notify (app_worker_t * app_wrk, session_t * s);
int app_worker_reset_notify (app_worker_t * app_wrk, session_t * s);
int app_worker_builtin_rx (app_worker_t * app_wrk, session_t * s);
+int app_worker_builtin_tx (app_worker_t * app_wrk, session_t * s);
segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *,
session_t *);
segment_manager_t *app_worker_get_connect_segment_manager (app_worker_t *);
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index d98c437ec84..081dbbecdac 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -344,6 +344,18 @@ app_worker_builtin_rx (app_worker_t * app_wrk, session_t * s)
}
int
+app_worker_builtin_tx (app_worker_t * app_wrk, session_t * s)
+{
+ application_t *app = application_get (app_wrk->app_index);
+
+ if (!app->cb_fns.builtin_app_tx_callback)
+ return 0;
+
+ app->cb_fns.builtin_app_tx_callback (s);
+ return 0;
+}
+
+int
app_worker_own_session (app_worker_t * app_wrk, session_t * s)
{
segment_manager_t *sm;
@@ -583,7 +595,7 @@ app_send_io_evt_tx (app_worker_t * app_wrk, session_t * s, u8 lock)
svm_msg_q_msg_t msg;
if (app_worker_application_is_builtin (app_wrk))
- return 0;
+ return app_worker_builtin_tx (app_wrk, s);
mq = app_wrk->event_queue;
if (lock)
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 75f7baf7318..1a304a6f80e 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -452,6 +452,10 @@ u32
session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
{
session_t *s = session_get (tc->s_index, tc->thread_index);
+
+ if (svm_fifo_needs_tx_ntf (s->tx_fifo, max_bytes))
+ session_dequeue_notify (s);
+
return svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
}
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 1a04658cb41..067ab585e6f 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -792,6 +792,9 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
else if (svm_fifo_max_dequeue_cons (ctx->s->tx_fifo) > 0)
if (svm_fifo_set_event (ctx->s->tx_fifo))
vec_add1 (wrk->pending_event_vector, *e);
+
+ if (svm_fifo_needs_tx_ntf (ctx->s->tx_fifo, ctx->max_len_to_snd))
+ session_dequeue_notify (ctx->s);
}
return SESSION_TX_OK;
}
@@ -905,9 +908,8 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
for (i = 0; i < n_events; i++)
{
- session_t *s; /* $$$ prefetch 1 ahead maybe */
session_event_t *e;
- u8 need_tx_ntf;
+ session_t *s;
e = &fifo_events[i];
switch (e->event_type)
@@ -933,14 +935,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* different nodes */
rv = (smm->session_tx_fns[s->session_type]) (vm, node, wrk, e,
&n_tx_packets);
- if (PREDICT_TRUE (rv == SESSION_TX_OK))
- {
- need_tx_ntf = svm_fifo_needs_tx_ntf (s->tx_fifo,
- wrk->ctx.max_len_to_snd);
- if (PREDICT_FALSE (need_tx_ntf))
- session_dequeue_notify (s);
- }
- else if (PREDICT_FALSE (rv == SESSION_TX_NO_BUFFERS))
+ if (PREDICT_FALSE (rv == SESSION_TX_NO_BUFFERS))
{
vlib_node_increment_counter (vm, node->node_index,
SESSION_QUEUE_ERROR_NO_BUFFER, 1);