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
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index e447fac..a6c1e21 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1272,6 +1272,27 @@
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 @@
.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 928e824..dac50b5 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -463,7 +463,10 @@
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);
}