From 42ceddb7cd836a89a12b0b8e623b06bc4c0cc0cb Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 12 Dec 2018 10:56:01 -0800 Subject: session/tcp: support tx flush mark For tcp this means that the last enqueued data goes out with a psh bit set. Change-Id: I29d357ecae6f02e748b59a7b799150ec73d14ba2 Signed-off-by: Florin Coras --- src/vnet/session/session.h | 8 ++++++++ src/vnet/session/session_node.c | 15 ++++++++++++--- src/vnet/session/transport_interface.h | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src/vnet/session') diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index d5f040edc59..be2490fbe95 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -36,6 +36,7 @@ typedef enum SESSION_IO_EVT_CT_RX, FIFO_EVENT_APP_TX, SESSION_IO_EVT_CT_TX, + SESSION_IO_EVT_TX_FLUSH, FIFO_EVENT_DISCONNECT, FIFO_EVENT_BUILTIN_RX, FIFO_EVENT_BUILTIN_TX, @@ -518,6 +519,13 @@ transport_max_rx_enqueue (transport_connection_t * tc) return svm_fifo_max_enqueue (s->server_rx_fifo); } +always_inline u32 +transport_max_tx_dequeue (transport_connection_t * tc) +{ + stream_session_t *s = session_get (tc->s_index, tc->thread_index); + return svm_fifo_max_dequeue (s->server_tx_fifo); +} + always_inline u32 transport_rx_fifo_size (transport_connection_t * tc) { diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 14576685a76..f4e0eaa993e 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -572,9 +572,17 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node, ctx->transport_vft = transport_protocol_get_vft (tp); ctx->tc = session_tx_get_transport (ctx, peek_data); ctx->snd_mss = ctx->transport_vft->send_mss (ctx->tc); - ctx->snd_space = - transport_connection_snd_space (ctx->tc, vm->clib_time.last_cpu_time, - ctx->snd_mss); + + if (PREDICT_FALSE (e->event_type == SESSION_IO_EVT_TX_FLUSH)) + { + if (ctx->transport_vft->flush_data) + ctx->transport_vft->flush_data (ctx->tc); + } + + ctx->snd_space = transport_connection_snd_space (ctx->tc, + vm-> + clib_time.last_cpu_time, + ctx->snd_mss); if (ctx->snd_space == 0 || ctx->snd_mss == 0) { vec_add1 (wrk->pending_event_vector, *e); @@ -828,6 +836,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, e = &fifo_events[i]; switch (e->event_type) { + case SESSION_IO_EVT_TX_FLUSH: case FIFO_EVENT_APP_TX: /* Don't try to send more that one frame per dispatch cycle */ if (n_tx_packets == VLIB_FRAME_SIZE) diff --git a/src/vnet/session/transport_interface.h b/src/vnet/session/transport_interface.h index 3bfed415874..10579c45c64 100644 --- a/src/vnet/session/transport_interface.h +++ b/src/vnet/session/transport_interface.h @@ -61,6 +61,7 @@ typedef struct _transport_proto_vft u32 (*send_space) (transport_connection_t * tc); u32 (*tx_fifo_offset) (transport_connection_t * tc); void (*update_time) (f64 time_now, u8 thread_index); + void (*flush_data) (transport_connection_t *tconn); /* * Connection retrieval -- cgit 1.2.3-korg