summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-01-08 00:33:02 +0000
committerDave Wallace <dwallacelf@gmail.com>2020-08-12 15:24:14 +0000
commit40f1beaae3efbd3c66c9202efa0633bcca51bd7c (patch)
tree43dc7e30db170def3bfbd608bcc128e2e27a7177
parent1bc07facef10a07ef13e0e2795bc0c9d900e26d0 (diff)
tcp: fix last sacked with no holes
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Id12b0a9b8bc47aef8b393544e5b4c8228ed6a606 (cherry picked from commit 479f7fec6a876bf06f6007c03fd7b9fa3404df54)
-rw-r--r--src/plugins/unittest/tcp_test.c44
-rwxr-xr-xsrc/vnet/tcp/tcp_input.c2
2 files changed, 46 insertions, 0 deletions
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c
index 25535e11ca6..c03e33b7606 100644
--- a/src/plugins/unittest/tcp_test.c
+++ b/src/plugins/unittest/tcp_test.c
@@ -558,6 +558,50 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input)
TCP_TEST ((sb->lost_bytes == 200), "lost bytes %u", sb->lost_bytes);
TCP_TEST ((!sb->is_reneging), "is not reneging");
+ /*
+ * Restart
+ */
+ scoreboard_clear (sb);
+ vec_reset_length (tc->rcv_opts.sacks);
+
+ /*
+ * Inject [100 500]
+ */
+
+ tc->flags |= TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY;
+ tc->snd_una = 0;
+ tc->snd_una_max = 1000;
+ tc->snd_nxt = 1000;
+ sb->high_rxt = 0;
+
+ block.start = 100;
+ block.end = 500;
+ vec_add1 (tc->rcv_opts.sacks, block);
+ tc->rcv_opts.n_sack_blocks = vec_len (tc->rcv_opts.sacks);
+
+ tcp_rcv_sacks (tc, 0);
+
+ TCP_TEST ((sb->sacked_bytes == 400), "sacked bytes %d", sb->sacked_bytes);
+ TCP_TEST ((sb->last_sacked_bytes == 400), "last sacked bytes %d",
+ sb->last_sacked_bytes);
+ TCP_TEST ((!sb->is_reneging), "is not reneging");
+
+ /*
+ * Renege, sack all of the remaining bytes and cover some rxt bytes
+ */
+ sb->high_rxt = 700;
+ tc->rcv_opts.sacks[0].start = 500;
+ tc->rcv_opts.sacks[0].end = 1000;
+
+ tcp_rcv_sacks (tc, 100);
+
+ TCP_TEST ((sb->sacked_bytes == 900), "sacked bytes %d", sb->sacked_bytes);
+ TCP_TEST ((sb->last_sacked_bytes == 500), "last sacked bytes %d",
+ sb->last_sacked_bytes);
+ TCP_TEST (sb->is_reneging, "is reneging");
+ TCP_TEST ((sb->rxt_sacked == 300), "last rxt sacked bytes %d",
+ sb->rxt_sacked);
+
return 0;
}
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index 92144f32504..6d7df3cf003 100755
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -806,6 +806,8 @@ scoreboard_update_bytes (sack_scoreboard_t * sb, u32 ack, u32 snd_mss)
if (!right)
{
sb->sacked_bytes = sb->high_sacked - ack;
+ sb->last_sacked_bytes = sb->sacked_bytes
+ - (old_sacked - sb->last_bytes_delivered);
return;
}