aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-04-19 10:17:26 -0700
committerDave Barach <openvpp@barachs.net>2021-04-20 16:48:16 +0000
commit5a41fd5ee7af8d39106d5fc5de7f2d17d7356b30 (patch)
treeb9e8c4dead552939a116ba1c02c6f6bc548e5d66
parent005d1e4d4822454363c4a0fa3a1d8b33a14ba6e8 (diff)
tcp: req app deq notification on fifo full
If fifo full, default to requesting an app deq notification and forcing an ack (window update) if zero rcv window sent is still active. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iade7e1722503da149c62c465c472edbb0a5599f7
-rw-r--r--src/vnet/session/session.h7
-rw-r--r--src/vnet/tcp/tcp.c22
-rw-r--r--src/vnet/tcp/tcp_output.c5
3 files changed, 33 insertions, 1 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 44cbaebf4ab..8b591339edb 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -574,6 +574,13 @@ transport_rx_fifo_has_ooo_data (transport_connection_t * tc)
return svm_fifo_has_ooo_data (s->rx_fifo);
}
+always_inline void
+transport_rx_fifo_req_deq_ntf (transport_connection_t *tc)
+{
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ svm_fifo_add_want_deq_ntf (s->rx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
+}
+
always_inline clib_time_type_t
transport_time_now (u32 thread_index)
{
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index e447fac00b5..a6c1e216c20 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1272,6 +1272,27 @@ tcp_session_flush_data (transport_connection_t * tconn)
tc->psh_seq = tc->snd_una + transport_max_tx_dequeue (tconn) - 1;
}
+static int
+tcp_session_app_rx_evt (transport_connection_t *conn)
+{
+ tcp_connection_t *tc = (tcp_connection_t *) conn;
+ u32 min_free, lo = 4 << 10, hi = 128 << 10;
+
+ if (!(tc->flags & TCP_CONN_ZERO_RWND_SENT))
+ return 0;
+
+ min_free = clib_clamp (transport_rx_fifo_size (conn) >> 3, lo, hi);
+ if (transport_max_rx_enqueue (conn) < min_free)
+ {
+ transport_rx_fifo_req_deq_ntf (conn);
+ return 0;
+ }
+
+ tcp_send_ack (tc);
+
+ return 0;
+}
+
/* *INDENT-OFF* */
const static transport_proto_vft_t tcp_proto = {
.enable = vnet_tcp_enable_disable,
@@ -1291,6 +1312,7 @@ const static transport_proto_vft_t tcp_proto = {
.update_time = tcp_update_time,
.flush_data = tcp_session_flush_data,
.custom_tx = tcp_session_custom_tx,
+ .app_rx_evt = tcp_session_app_rx_evt,
.format_connection = format_tcp_session,
.format_listener = format_tcp_listener_session,
.format_half_open = format_tcp_half_open_session,
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 928e8249eb1..dac50b5bf40 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -463,7 +463,10 @@ tcp_make_ack_i (tcp_connection_t * tc, vlib_buffer_t * b, tcp_state_t state,
vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
if (wnd == 0)
- tcp_zero_rwnd_sent_on (tc);
+ {
+ transport_rx_fifo_req_deq_ntf (&tc->connection);
+ tcp_zero_rwnd_sent_on (tc);
+ }
else
tcp_zero_rwnd_sent_off (tc);
}