tcp: use scaled window for new connects 24/15024/3
authorFlorin Coras <fcoras@cisco.com>
Thu, 27 Sep 2018 16:19:29 +0000 (09:19 -0700)
committerFlorin Coras <fcoras@cisco.com>
Thu, 27 Sep 2018 16:47:26 +0000 (09:47 -0700)
Change-Id: Idf83fce8ca176e57b323e3741034e3223f1d195a
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp.h
src/vnet/tcp/tcp_input.c

index d00f4ab..30e5899 100644 (file)
@@ -1017,8 +1017,8 @@ tcp_round_snd_space (tcp_connection_t * tc, u32 snd_space)
  * @param tc tcp connection
  * @return number of bytes session is allowed to write
  */
-static u32
-tcp_snd_space (tcp_connection_t * tc)
+static inline u32
+tcp_snd_space_inline (tcp_connection_t * tc)
 {
   int snd_space, snt_limited;
 
@@ -1066,11 +1066,17 @@ tcp_snd_space (tcp_connection_t * tc)
   return 0;
 }
 
+u32
+tcp_snd_space (tcp_connection_t * tc)
+{
+  return tcp_snd_space_inline (tc);
+}
+
 static u32
 tcp_session_send_space (transport_connection_t * trans_conn)
 {
   tcp_connection_t *tc = (tcp_connection_t *) trans_conn;
-  return clib_min (tcp_snd_space (tc),
+  return clib_min (tcp_snd_space_inline (tc),
                   tc->snd_wnd - (tc->snd_nxt - tc->snd_una));
 }
 
index 37b4573..165659b 100644 (file)
@@ -658,6 +658,7 @@ tcp_is_lost_fin (tcp_connection_t * tc)
   return 0;
 }
 
+u32 tcp_snd_space (tcp_connection_t * tc);
 void tcp_retransmit_first_unacked (tcp_connection_t * tc);
 void tcp_fast_retransmit_no_sack (tcp_connection_t * tc);
 void tcp_fast_retransmit_sack (tcp_connection_t * tc);
index b66e940..d297ee7 100644 (file)
@@ -2282,8 +2282,8 @@ tcp46_syn_sent_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          if (tcp_opts_wscale (&new_tc0->rcv_opts))
            new_tc0->snd_wscale = new_tc0->rcv_opts.wscale;
 
-         /* RFC1323: SYN and SYN-ACK wnd not scaled */
-         new_tc0->snd_wnd = clib_net_to_host_u16 (tcp0->window);
+         new_tc0->snd_wnd = clib_net_to_host_u16 (tcp0->window)
+           << new_tc0->snd_wscale;
          new_tc0->snd_wl1 = seq0;
          new_tc0->snd_wl2 = ack0;