tcp: use bytes delivered to compute cwnd 28/34828/4
authorFlorin Coras <fcoras@cisco.com>
Wed, 5 Jan 2022 16:47:11 +0000 (08:47 -0800)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 6 Jan 2022 20:18:53 +0000 (20:18 +0000)
Should estimated cwnd better with loss

Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Idd75d40dbab212ac0a5d533009c5540b1a58f4c4

src/vnet/tcp/tcp_cubic.c
src/vnet/tcp/tcp_input.c
src/vnet/tcp/tcp_newreno.c

index cc2ffea..3160e52 100644 (file)
@@ -158,7 +158,7 @@ cubic_rcv_ack (tcp_connection_t * tc, tcp_rate_sample_t * rs)
 
   if (tcp_in_slowstart (tc))
     {
-      tc->cwnd += tc->bytes_acked;
+      tc->cwnd += rs->delivered;
       return;
     }
 
@@ -169,7 +169,7 @@ cubic_rcv_ack (tcp_connection_t * tc, tcp_rate_sample_t * rs)
   w_aimd = (u64) W_est (cd, t, rtt_sec) * tc->snd_mss;
   if (w_cubic < w_aimd)
     {
-      cubic_cwnd_accumulate (tc, tc->cwnd, tc->bytes_acked);
+      cubic_cwnd_accumulate (tc, tc->cwnd, rs->delivered);
     }
   else
     {
@@ -195,7 +195,7 @@ cubic_rcv_ack (tcp_connection_t * tc, tcp_rate_sample_t * rs)
          /* Practically we can't increment so just inflate threshold */
          thresh = 50 * tc->cwnd;
        }
-      cubic_cwnd_accumulate (tc, thresh, tc->bytes_acked);
+      cubic_cwnd_accumulate (tc, thresh, rs->delivered);
     }
 }
 
index 30d57a3..5f165c0 100644 (file)
@@ -866,8 +866,7 @@ tcp_cc_handle_event (tcp_connection_t * tc, tcp_rate_sample_t * rs,
        tcp_fastrecovery_first_on (tc);
 
       tc->rxt_delivered += tc->sack_sb.rxt_sacked;
-      tc->prr_delivered += tc->bytes_acked + tc->sack_sb.last_sacked_bytes
-       - tc->sack_sb.last_bytes_delivered;
+      tc->prr_delivered += rs->delivered;
     }
   else
     {
@@ -1042,6 +1041,9 @@ process_ack:
 
   if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE)
     tcp_bt_sample_delivery_rate (tc, &rs);
+  else
+    rs.delivered = tc->bytes_acked + tc->sack_sb.last_sacked_bytes -
+                  tc->sack_sb.last_bytes_delivered;
 
   if (tc->bytes_acked + tc->sack_sb.last_sacked_bytes)
     {
index c5ffc2a..39035ba 100644 (file)
@@ -49,12 +49,12 @@ newreno_rcv_ack (tcp_connection_t * tc, tcp_rate_sample_t * rs)
 {
   if (tcp_in_slowstart (tc))
     {
-      tc->cwnd += clib_min (tc->snd_mss, tc->bytes_acked);
+      tc->cwnd += clib_min (tc->snd_mss, rs->delivered);
     }
   else
     {
       /* tc->cwnd += clib_max ((tc->snd_mss * tc->snd_mss) / tc->cwnd, 1); */
-      tcp_cwnd_accumulate (tc, tc->cwnd, tc->bytes_acked);
+      tcp_cwnd_accumulate (tc, tc->cwnd, rs->delivered);
     }
 }