tcp: mark lost first sack hole on timeout 31/34831/5
authorFlorin Coras <fcoras@cisco.com>
Wed, 5 Jan 2022 18:16:07 +0000 (10:16 -0800)
committerDave Barach <openvpp@barachs.net>
Thu, 6 Jan 2022 23:09:40 +0000 (23:09 +0000)
Type: improvement

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

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

index dfcb4ee..5647b8f 100644 (file)
@@ -1337,7 +1337,10 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc)
        }
 
       if (tcp_opts_sack_permitted (&tc->rcv_opts))
-       tcp_check_sack_reneging (tc);
+       {
+         tcp_check_sack_reneging (tc);
+         scoreboard_rxt_mark_lost (&tc->sack_sb, tc->snd_una, tc->snd_nxt);
+       }
 
       /* Update send congestion to make sure that rxt has data to send */
       tc->snd_congestion = tc->snd_nxt;
index 8f51b51..63af07b 100644 (file)
@@ -264,6 +264,27 @@ scoreboard_init_rxt (sack_scoreboard_t * sb, u32 snd_una)
   sb->rescue_rxt = snd_una - 1;
 }
 
+void
+scoreboard_rxt_mark_lost (sack_scoreboard_t *sb, u32 snd_una, u32 snd_nxt)
+{
+  sack_scoreboard_hole_t *hole;
+
+  hole = scoreboard_first_hole (sb);
+  if (!hole)
+    {
+      hole = scoreboard_insert_hole (sb, TCP_INVALID_SACK_HOLE_INDEX, snd_una,
+                                    snd_nxt);
+      sb->tail = scoreboard_hole_index (sb, hole);
+      sb->high_sacked = snd_una;
+    }
+
+  if (hole->is_lost)
+    return;
+
+  hole->is_lost = 1;
+  sb->lost_bytes += scoreboard_hole_bytes (hole);
+}
+
 void
 scoreboard_init (sack_scoreboard_t * sb)
 {
index 1c3fa95..bb206b9 100644 (file)
@@ -105,6 +105,8 @@ void scoreboard_clear (sack_scoreboard_t * sb);
 void scoreboard_clear_reneging (sack_scoreboard_t * sb, u32 start, u32 end);
 void scoreboard_init (sack_scoreboard_t * sb);
 void scoreboard_init_rxt (sack_scoreboard_t * sb, u32 snd_una);
+void scoreboard_rxt_mark_lost (sack_scoreboard_t *sb, u32 snd_una,
+                              u32 snd_nxt);
 
 format_function_t format_tcp_scoreboard;