summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-11-27 16:03:26 -0800
committerDave Barach <vpp@barachs.net>2023-11-28 22:41:14 +0000
commite32580caa86ee7153e775c5c36f721f1fd2067ff (patch)
treee6d8d4768018c54e61b9b2af943a60201cc8239f
parent6ae6c98d7c548c31520fd3e4bcc3bc39bd1b74e6 (diff)
tcp: allow unsent segments less than mss in recovery
During recovery, send unsent data even if less than mss available as application is not guaranteed to provide more. This should speed up recovery when all data in flight was lost. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I7a3c73a0d04d93d51a5910d85450c173c3ad8e93
-rw-r--r--src/vnet/tcp/tcp_output.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index c994845de78..069c349a235 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1117,7 +1117,8 @@ tcp_prepare_segment (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
data = tcp_init_buffer (vm, *b);
n_bytes = session_tx_fifo_peek_bytes (&tc->connection, data, offset,
max_deq_bytes);
- ASSERT (n_bytes == max_deq_bytes);
+ ASSERT (n_bytes == clib_min (max_deq_bytes, transport_max_tx_dequeue (
+ &tc->connection)));
b[0]->current_length = n_bytes;
tcp_push_hdr_i (tc, *b, tc->snd_una + offset, /* compute opts */ 0,
/* burst */ 0, /* update_snd_nxt */ 0);
@@ -1762,7 +1763,7 @@ tcp_retransmit_sack (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
if (!hole)
{
/* We are out of lost holes to retransmit so send some new data. */
- if (max_deq > tc->snd_mss)
+ if (max_deq)
{
u32 n_segs_new;
int av_wnd;
@@ -1772,7 +1773,10 @@ tcp_retransmit_sack (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
av_wnd = (int) tc->snd_wnd - (tc->snd_nxt - tc->snd_una);
av_wnd = clib_max (av_wnd - tc->snd_mss, 0);
snd_space = clib_min (snd_space, av_wnd);
- snd_space = clib_min (max_deq, snd_space);
+ /* Low bound max_deq to mss to be able to send a segment even
+ * when it is less than mss */
+ snd_space =
+ clib_min (clib_max (max_deq, tc->snd_mss), snd_space);
burst_size = clib_min (burst_size - n_segs,
snd_space / tc->snd_mss);
burst_size = clib_min (burst_size, TCP_RXT_MAX_BURST);