tcp: make default mtu configurable 86/18486/2
authorFlorin Coras <fcoras@cisco.com>
Fri, 22 Mar 2019 22:42:18 +0000 (15:42 -0700)
committerJohn Lo <loj@cisco.com>
Sat, 23 Mar 2019 03:45:16 +0000 (03:45 +0000)
Change-Id: I56d8d8d67d5590e24c1ddb54b0c63a2cb03798e1
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp.h
src/vnet/tcp/tcp_output.c

index 39d683c..32abe2d 100644 (file)
@@ -841,9 +841,10 @@ format_tcp_vars (u8 * s, va_list * args)
              tcp_flight_size (tc), tcp_available_output_snd_space (tc),
              tcp_rcv_wnd_available (tc));
   s = format (s, " tsval_recent %u\n", tc->tsval_recent);
-  s = format (s, " tsecr %u tsecr_last_ack %u tsval_recent_age %u\n",
+  s = format (s, " tsecr %u tsecr_last_ack %u tsval_recent_age %u",
              tc->rcv_opts.tsecr, tc->tsecr_last_ack,
              tcp_time_now () - tc->tsval_recent_age);
+  s = format (s, " snd_mss %u\n", tc->snd_mss);
   s = format (s, " rto %u rto_boff %u srtt %u us %.3f rttvar %u rtt_ts %.4f",
              tc->rto, tc->rto_boff, tc->srtt, tc->mrtt_us * 1000, tc->rttvar,
              tc->rtt_ts);
@@ -1534,6 +1535,7 @@ tcp_init (vlib_main_t * vm)
   tcp_api_reference ();
   tm->tx_pacing = 1;
   tm->cc_algo = TCP_CC_NEWRENO;
+  tm->default_mtu = 1460;
   return 0;
 }
 
@@ -1596,6 +1598,8 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input)
       else if (unformat (input, "max-rx-fifo %U", unformat_memory_size,
                         &tm->max_rx_fifo))
        ;
+      else if (unformat (input, "mtu %d", &tm->default_mtu))
+       ;
       else if (unformat (input, "no-tx-pacing"))
        tm->tx_pacing = 0;
       else if (unformat (input, "cc-algo %U", unformat_tcp_cc_algo,
index 9e2c6d8..66f1aed 100644 (file)
@@ -486,6 +486,9 @@ typedef struct _tcp_main
    *  rfc 7323 window scaling factor */
   u32 max_rx_fifo;
 
+  /** Default MTU to be used when establishing connections */
+  u16 default_mtu;
+
   /** Number of preallocated connections */
   u32 preallocated_connections;
   u32 preallocated_half_open_connections;
index 4b38649..2abc40a 100644 (file)
@@ -49,10 +49,6 @@ typedef struct
   tcp_connection_t tcp_connection;
 } tcp_tx_trace_t;
 
-#ifndef CLIB_MARCH_VARIANT
-u16 dummy_mtu = 1460;
-#endif /* CLIB_MARCH_VARIANT */
-
 static u8 *
 format_tcp_tx_trace (u8 * s, va_list * args)
 {
@@ -89,7 +85,7 @@ void
 tcp_update_rcv_mss (tcp_connection_t * tc)
 {
   /* TODO find our iface MTU */
-  tc->mss = dummy_mtu - sizeof (tcp_header_t);
+  tc->mss = tcp_main.default_mtu - sizeof (tcp_header_t);
 }
 
 /**
@@ -293,7 +289,7 @@ tcp_make_syn_options (tcp_options_t * opts, u8 wnd_scale)
   u8 len = 0;
 
   opts->flags |= TCP_OPTS_FLAG_MSS;
-  opts->mss = dummy_mtu;       /*XXX discover that */
+  opts->mss = tcp_main.default_mtu;    /*XXX discover that */
   len += TCP_OPTION_LEN_MSS;
 
   opts->flags |= TCP_OPTS_FLAG_WSCALE;