summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-10-16 22:06:08 -0700
committerDave Barach <openvpp@barachs.net>2019-10-17 19:39:07 +0000
commit2a7ea2ee92d6dc4800ee21323d3324a9e8449dcf (patch)
tree7168893de8f4ac1e3cfdacd274151e05a157489e /src/vnet/session
parent3030beae9468ab677c86cb1f9188438072307308 (diff)
session tcp: infra for transports to send buffers
Type: feature Add infra that allows transpors to enqueue pending buffers without the need to build and manage their own pending frames. An important benefit is the fact that buffer wire/tx ordering is ensured by session layer. Change-Id: I764fd1693d610b321a1d0c84b648a314f14583db Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session.h15
-rw-r--r--src/vnet/session/session_node.c14
2 files changed, 29 insertions, 0 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 1d3ae0ca4b2..f738f3957e2 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -116,6 +116,12 @@ typedef struct session_worker_
/** Peekers rw lock */
clib_rwlock_t peekers_rw_locks;
+ /** Vector of buffers to be sent */
+ u32 *pending_tx_buffers;
+
+ /** Vector of nexts for the pending tx buffers */
+ u16 *pending_tx_nexts;
+
#if SESSION_DEBUG
/** last event poll time by thread */
f64 last_event_poll;
@@ -611,6 +617,15 @@ do { \
int session_main_flush_enqueue_events (u8 proto, u32 thread_index);
int session_main_flush_all_enqueue_events (u8 transport_proto);
void session_flush_frames_main_thread (vlib_main_t * vm);
+
+always_inline void
+session_add_pending_tx_buffer (session_type_t st, u32 thread_index, u32 bi)
+{
+ session_worker_t *wrk = session_main_get_worker (thread_index);
+ vec_add1 (wrk->pending_tx_buffers, bi);
+ vec_add1 (wrk->pending_tx_nexts, session_main.session_type_to_next[st]);
+}
+
ssvm_private_t *session_main_get_evt_q_segment (void);
void session_node_enable_disable (u8 is_en);
clib_error_t *vnet_session_enable_disable (vlib_main_t * vm, u8 is_en);
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index f51b892736a..a32abb07f90 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1235,6 +1235,17 @@ session_evt_add_to_list (session_worker_t * wrk, session_event_t * evt)
}
}
+static void
+session_flush_pending_tx_buffers (session_worker_t * wrk,
+ vlib_node_runtime_t * node)
+{
+ vlib_buffer_enqueue_to_next (wrk->vm, node, wrk->pending_tx_buffers,
+ wrk->pending_tx_nexts,
+ vec_len (wrk->pending_tx_nexts));
+ vec_reset_length (wrk->pending_tx_buffers);
+ vec_reset_length (wrk->pending_tx_nexts);
+}
+
static uword
session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
@@ -1337,6 +1348,9 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
break;
};
+ if (vec_len (wrk->pending_tx_buffers))
+ session_flush_pending_tx_buffers (wrk, node);
+
vlib_node_increment_counter (vm, session_queue_node.index,
SESSION_QUEUE_ERROR_TX, n_tx_packets);