tcp: honor snd_wnd in fast rxt

Type:fix

Change-Id: I2f4224a53360f533c086ebde6a3056e60431da87
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 58d2167..010397b 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1769,11 +1769,14 @@
 tcp_fast_retransmit_unsent (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
 			    u32 burst_size)
 {
-  u32 offset, n_segs = 0, n_written, bi;
+  u32 offset, n_segs = 0, n_written, bi, available_wnd;
   vlib_main_t *vm = wrk->vm;
   vlib_buffer_t *b = 0;
 
   offset = tc->snd_nxt - tc->snd_una;
+  available_wnd = tc->snd_wnd - offset;
+  burst_size = clib_min (burst_size, available_wnd / tc->snd_mss);
+
   while (n_segs < burst_size)
     {
       n_written = tcp_prepare_segment (wrk, tc, offset, tc->snd_mss, &b);