host stack: update stale copyright
[vpp.git] / src / vnet / tcp / tcp_output.c
index 2abc40a..03caa07 100644 (file)
@@ -130,20 +130,19 @@ tcp_initial_window_to_advertise (tcp_connection_t * tc)
   return clib_min (tc->rcv_wnd, TCP_WND_MAX);
 }
 
-static void
+static inline void
 tcp_update_rcv_wnd (tcp_connection_t * tc)
 {
+  u32 available_space, wnd;
   i32 observed_wnd;
-  u32 available_space, max_fifo, wnd;
+
+  ASSERT (tc->rcv_opts.mss < transport_rx_fifo_size (&tc->connection));
 
   /*
    * Figure out how much space we have available
    */
   available_space = transport_max_rx_enqueue (&tc->connection);
-  max_fifo = transport_rx_fifo_size (&tc->connection);
-
-  ASSERT (tc->rcv_opts.mss < max_fifo);
-  if (available_space < tc->rcv_opts.mss && available_space < max_fifo >> 3)
+  if (PREDICT_FALSE (available_space < tc->rcv_opts.mss))
     available_space = 0;
 
   /*
@@ -151,13 +150,11 @@ tcp_update_rcv_wnd (tcp_connection_t * tc)
    * to compute the new window
    */
   observed_wnd = (i32) tc->rcv_wnd - (tc->rcv_nxt - tc->rcv_las);
-  if (observed_wnd < 0)
-    observed_wnd = 0;
 
   /* Bad. Thou shalt not shrink */
-  if (available_space < observed_wnd)
+  if (PREDICT_FALSE ((i32) available_space < observed_wnd))
     {
-      wnd = observed_wnd;
+      wnd = clib_max (observed_wnd, 0);
       TCP_EVT_DBG (TCP_EVT_RCV_WND_SHRUNK, tc, observed_wnd, available_space);
     }
   else
@@ -186,16 +183,6 @@ tcp_window_to_advertise (tcp_connection_t * tc, tcp_state_t state)
     return tcp_initial_window_to_advertise (tc);
 
   tcp_update_rcv_wnd (tc);
-
-  if (tc->rcv_wnd == 0)
-    {
-      tc->flags |= TCP_CONN_SENT_RCV_WND0;
-    }
-  else
-    {
-      tc->flags &= ~TCP_CONN_SENT_RCV_WND0;
-    }
-
   return tc->rcv_wnd >> tc->rcv_wscale;
 }
 
@@ -535,9 +522,6 @@ void
 tcp_make_fin (tcp_connection_t * tc, vlib_buffer_t * b)
 {
   tcp_make_ack_i (tc, b, TCP_STATE_ESTABLISHED, TCP_FLAG_FIN | TCP_FLAG_ACK);
-
-  /* Reset flags, make sure ack is sent */
-  vnet_buffer (b)->tcp.flags &= ~TCP_BUF_FLAG_DUPACK;
 }
 
 /**
@@ -1148,7 +1132,6 @@ tcp_session_push_header (transport_connection_t * tconn, vlib_buffer_t * b)
   tcp_push_hdr_i (tc, b, tc->snd_nxt, /* compute opts */ 0, /* burst */ 1,
                  /* update_snd_nxt */ 1);
   tc->snd_una_max = seq_max (tc->snd_nxt, tc->snd_una_max);
-  ASSERT (seq_leq (tc->snd_una_max, tc->snd_una + tc->snd_wnd));
   tcp_validate_txf_size (tc, tc->snd_una_max - tc->snd_una);
   /* If not tracking an ACK, start tracking */
   if (tc->rtt_ts == 0 && !tcp_in_cong_recovery (tc))