tcp: Setup initial CWND as configured 50/20350/4
authorVladimir Kropylev <vladimir.kropylev@enea.com>
Wed, 26 Jun 2019 09:56:21 +0000 (12:56 +0300)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 27 Jun 2019 23:33:24 +0000 (23:33 +0000)
Type: feature

Change-Id: I7f476f4f81994c9c6cc2e8091de08adff4bcbc77
Signed-off-by: Vladimir Kropylev <vladimir.kropylev@enea.com>
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp.h

index 7b5b553..57e62f8 100644 (file)
@@ -1575,6 +1575,7 @@ tcp_init (vlib_main_t * vm)
   tm->tx_pacing = 1;
   tm->cc_algo = TCP_CC_NEWRENO;
   tm->default_mtu = 1460;
+  tm->initial_cwnd_multiplier = 0;
   return 0;
 }
 
@@ -1644,6 +1645,9 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input)
        ;
       else if (unformat (input, "mtu %d", &tm->default_mtu))
        ;
+      else if (unformat (input, "initial-cwnd-multiplier %d",
+                        &tm->initial_cwnd_multiplier))
+       ;
       else if (unformat (input, "no-tx-pacing"))
        tm->tx_pacing = 0;
       else if (unformat (input, "cc-algo %U", unformat_tcp_cc_algo,
index e4980dd..8b943cd 100644 (file)
@@ -532,6 +532,10 @@ typedef struct _tcp_main
   /** Default MTU to be used when establishing connections */
   u16 default_mtu;
 
+  /** Initial CWND multiplier, which multiplies MSS to determine initial CWND.
+   *  Set 0 to determine the initial CWND by another way */
+  u16 initial_cwnd_multiplier;
+
   /** Number of preallocated connections */
   u32 preallocated_connections;
   u32 preallocated_half_open_connections;
@@ -809,6 +813,9 @@ tcp_flight_size (const tcp_connection_t * tc)
 always_inline u32
 tcp_initial_cwnd (const tcp_connection_t * tc)
 {
+  if (tcp_main.initial_cwnd_multiplier > 0)
+    return tcp_main.initial_cwnd_multiplier * tc->snd_mss;
+
   if (tc->snd_mss > 2190)
     return 2 * tc->snd_mss;
   else if (tc->snd_mss > 1095)