summaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp_output.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-11-04 14:39:33 -0800
committerDave Barach <openvpp@barachs.net>2019-11-07 19:37:25 +0000
commitbf1f8b7f288c29bfcc128b1d09eae1c1eac2b7cc (patch)
treeafb5738a75822c4d4ae7243beeeabe6ede83c7e3 /src/vnet/tcp/tcp_output.c
parent5ed3fe3dd4320a7b4080f18de32ef491b5a1c7f0 (diff)
tcp: fix retransmit with no sacks
Type: fix Change-Id: I6f7df0d358f57f7feadb9b7a3fcffb99558b2af8 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp_output.c')
-rw-r--r--src/vnet/tcp/tcp_output.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index c7e9792afaa..14d1bd6391e 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1911,8 +1911,8 @@ tcp_retransmit_sack (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
&& tc->rxt_head != tc->snd_una
&& tcp_retransmit_should_retry_head (tc, sb))
{
- n_written = tcp_prepare_retransmit_segment (wrk, tc, 0, tc->snd_mss,
- &b);
+ max_bytes = clib_min (tc->snd_mss, tc->snd_congestion - tc->snd_una);
+ n_written = tcp_prepare_retransmit_segment (wrk, tc, 0, max_bytes, &b);
if (!n_written)
{
tcp_program_retransmit (tc);
@@ -2036,14 +2036,14 @@ static int
tcp_retransmit_no_sack (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
u32 burst_size)
{
- u32 n_written = 0, offset = 0, bi, max_deq, n_segs_now;
+ u32 n_written = 0, offset = 0, bi, max_deq, n_segs_now, max_bytes;
u32 burst_bytes, sent_bytes;
vlib_main_t *vm = wrk->vm;
int snd_space, n_segs = 0;
u8 cc_limited = 0;
vlib_buffer_t *b;
- ASSERT (tcp_in_fastrecovery (tc));
+ ASSERT (tcp_in_cong_recovery (tc));
TCP_EVT (TCP_EVT_CC_EVT, tc, 0);
burst_bytes = transport_connection_tx_pacer_burst (&tc->connection);
@@ -2064,8 +2064,12 @@ tcp_retransmit_no_sack (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
* segment. */
while (snd_space > 0 && n_segs < burst_size)
{
- n_written = tcp_prepare_retransmit_segment (wrk, tc, offset,
- tc->snd_mss, &b);
+ max_bytes = clib_min (tc->snd_mss,
+ tc->snd_congestion - tc->snd_una - offset);
+ if (!max_bytes)
+ break;
+ n_written = tcp_prepare_retransmit_segment (wrk, tc, offset, max_bytes,
+ &b);
/* Nothing left to retransmit */
if (n_written == 0)
@@ -2094,7 +2098,7 @@ send_unsent:
snd_space = clib_min (max_deq, snd_space);
burst_size = clib_min (burst_size - n_segs, snd_space / tc->snd_mss);
n_segs_now = tcp_transmit_unsent (wrk, tc, burst_size);
- if (max_deq > n_segs_now * tc->snd_mss)
+ if (n_segs_now && max_deq > n_segs_now * tc->snd_mss)
tcp_program_retransmit (tc);
n_segs += n_segs_now;
}