tcp: loss recovery improvements/fixes

- fix newreno cwnd computation
- reset snd_una_max on entering recovery
- accept acks beyond snd_nxt but less than snd_congestion when in
recovery
- avoid entering fast recovery multiple times when using sacks
- avoid as much as possible sending small segments when doing fast
retransmit
- more event logging

Change-Id: I19dd151d7704e39d4eae06de3a26f5e124875366
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/tcp/tcp_newreno.c b/src/vnet/tcp/tcp_newreno.c
index 0f43d21..a9ec58c 100644
--- a/src/vnet/tcp/tcp_newreno.c
+++ b/src/vnet/tcp/tcp_newreno.c
@@ -41,8 +41,8 @@
       if (tc->cwnd_acc_bytes >= tc->cwnd)
 	{
 	  u32 inc = tc->cwnd_acc_bytes / tc->cwnd;
-	  tc->cwnd += inc * tc->snd_mss;
 	  tc->cwnd_acc_bytes -= inc * tc->cwnd;
+	  tc->cwnd += inc * tc->snd_mss;
 	}
       tc->cwnd = clib_min (tc->cwnd,
 			   transport_tx_fifo_size (&tc->connection));