summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorRyujiro Shibuya <ryujiro.shibuya@owmobility.com>2020-01-22 12:11:42 +0000
committerDave Barach <openvpp@barachs.net>2020-02-25 19:18:49 +0000
commitd8f48e2166747b529aa23762ac314dd686590c89 (patch)
treeebd94006c2eb6be5db9c0f1fec5ff7f984aeb38a /src/vnet/session/session.c
parent234fe894d80a6ebc7e457bc86f2eea80d5ef01ea (diff)
session: basic fifo-tuning-logic
- Allowing application to register custom fifo-tuning-logic. - Adding an example custom fifo-tuning-logic in hs_app/proxy. Type: feature Signed-off-by: Ryujiro Shibuya <ryujiro.shibuya@owmobility.com> Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2aca14d1f23d5c3c9debb7f4c46aca3a15a8d1b9
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index b006cfaf2bb..e9cda361f37 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -396,6 +396,24 @@ session_enqueue_chain_tail (session_t * s, vlib_buffer_t * b,
return 0;
}
+void
+session_fifo_tuning (session_t * s, svm_fifo_t * f,
+ session_ft_action_t act, u32 len)
+{
+ if (s->flags & SESSION_F_CUSTOM_FIFO_TUNING)
+ {
+ app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
+ app_worker_session_fifo_tuning (app_wrk, s, f, act, len);
+ if (CLIB_ASSERT_ENABLE)
+ {
+ segment_manager_t *sm;
+ sm = segment_manager_get (f->segment_manager);
+ ASSERT (f->size >= 4096);
+ ASSERT (f->size <= sm->max_fifo_size);
+ }
+ }
+}
+
/*
* Enqueue data for delivery to session peer. Does not notify peer of enqueue
* event but on request can queue notification events for later delivery by
@@ -458,6 +476,8 @@ session_enqueue_stream_connection (transport_connection_t * tc,
s->flags |= SESSION_F_RX_EVT;
vec_add1 (wrk->session_to_enqueue[tc->proto], s->session_index);
}
+
+ session_fifo_tuning (s, s->rx_fifo, SESSION_FT_ACTION_ENQUEUED, 0);
}
return enqueued;
@@ -495,6 +515,8 @@ session_enqueue_dgram_connection (session_t * s,
s->flags |= SESSION_F_RX_EVT;
vec_add1 (wrk->session_to_enqueue[proto], s->session_index);
}
+
+ session_fifo_tuning (s, s->rx_fifo, SESSION_FT_ACTION_ENQUEUED, 0);
}
return enqueued;
}
@@ -514,6 +536,7 @@ session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
u32 rv;
rv = svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
+ session_fifo_tuning (s, s->tx_fifo, SESSION_FT_ACTION_DEQUEUED, rv);
if (svm_fifo_needs_deq_ntf (s->tx_fifo, max_bytes))
session_dequeue_notify (s);
@@ -674,6 +697,9 @@ session_main_flush_enqueue_events (u8 transport_proto, u32 thread_index)
continue;
}
+ session_fifo_tuning (s, s->rx_fifo, SESSION_FT_ACTION_ENQUEUED,
+ 0 /* TODO/not needed */ );
+
if (PREDICT_FALSE (session_enqueue_notify_inline (s)))
errors++;
}