tcp: add loss signal to cc algo

Type:feature

Change-Id: Ibe1a4c555b55fb929d55b02599aaf099ed522cdf
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 3887b34..7e37efb 100644
--- a/src/vnet/tcp/tcp_newreno.c
+++ b/src/vnet/tcp/tcp_newreno.c
@@ -15,19 +15,26 @@
 
 #include <vnet/tcp/tcp.h>
 
-void
+static void
 newreno_congestion (tcp_connection_t * tc)
 {
   tc->ssthresh = clib_max (tcp_flight_size (tc) / 2, 2 * tc->snd_mss);
 }
 
-void
+static void
+newreno_loss (tcp_connection_t * tc)
+{
+  tc->ssthresh = clib_max (tcp_flight_size (tc) / 2, 2 * tc->snd_mss);
+  tc->cwnd = tcp_loss_wnd (tc);
+}
+
+static void
 newreno_recovered (tcp_connection_t * tc)
 {
   tc->cwnd = tc->ssthresh;
 }
 
-void
+static void
 newreno_rcv_ack (tcp_connection_t * tc, tcp_rate_sample_t * rs)
 {
   if (tcp_in_slowstart (tc))
@@ -72,7 +79,7 @@
     }
 }
 
-void
+static void
 newreno_conn_init (tcp_connection_t * tc)
 {
   tc->ssthresh = tc->snd_wnd;
@@ -82,6 +89,7 @@
 const static tcp_cc_algorithm_t tcp_newreno = {
   .name = "newreno",
   .congestion = newreno_congestion,
+  .loss = newreno_loss,
   .recovered = newreno_recovered,
   .rcv_ack = newreno_rcv_ack,
   .rcv_cong_ack = newreno_rcv_cong_ack,