tcp: req app deq notification on fifo full 35/32035/7
authorFlorin Coras <fcoras@cisco.com>
Mon, 19 Apr 2021 17:17:26 +0000 (10:17 -0700)
committerDave Barach <openvpp@barachs.net>
Tue, 20 Apr 2021 16:48:16 +0000 (16:48 +0000)
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

src/vnet/session/session.h
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp_output.c

index 44cbaeb..8b59133 100644 (file)
@@ -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)
 {
index e447fac..a6c1e21 100644 (file)
@@ -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,
index 928e824..dac50b5 100644 (file)
@@ -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);
 }