Commit 35089bb203f44e33b6bbb6c4de0b0708f9a48921

Authored by David S. Miller
1 parent 9e1881dec9

[TCP]: Add tcp_slow_start_after_idle sysctl.

A lot of people have asked for a way to disable tcp_cwnd_restart(),
and it seems reasonable to add a sysctl to do that.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 5 changed files with 22 additions and 1 deletions Side-by-side Diff

Documentation/networking/ip-sysctl.txt
... ... @@ -362,6 +362,13 @@
362 362 not receive a window scaling option from them.
363 363 Default: 0
364 364  
  365 +tcp_slow_start_after_idle - BOOLEAN
  366 + If set, provide RFC2861 behavior and time out the congestion
  367 + window after an idle period. An idle period is defined at
  368 + the current RTO. If unset, the congestion window will not
  369 + be timed out after an idle period.
  370 + Default: 1
  371 +
365 372 IP Variables:
366 373  
367 374 ip_local_port_range - 2 INTEGERS
include/linux/sysctl.h
... ... @@ -405,6 +405,7 @@
405 405 NET_TCP_BASE_MSS=114,
406 406 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
407 407 NET_TCP_DMA_COPYBREAK=116,
  408 + NET_TCP_SLOW_START_AFTER_IDLE=117,
408 409 };
409 410  
410 411 enum {
... ... @@ -227,6 +227,7 @@
227 227 extern int sysctl_tcp_mtu_probing;
228 228 extern int sysctl_tcp_base_mss;
229 229 extern int sysctl_tcp_workaround_signed_windows;
  230 +extern int sysctl_tcp_slow_start_after_idle;
230 231  
231 232 extern atomic_t tcp_memory_allocated;
232 233 extern atomic_t tcp_sockets_allocated;
net/ipv4/sysctl_net_ipv4.c
... ... @@ -690,6 +690,14 @@
690 690 .proc_handler = &proc_dointvec
691 691 },
692 692 #endif
  693 + {
  694 + .ctl_name = NET_TCP_SLOW_START_AFTER_IDLE,
  695 + .procname = "tcp_slow_start_after_idle",
  696 + .data = &sysctl_tcp_slow_start_after_idle,
  697 + .maxlen = sizeof(int),
  698 + .mode = 0644,
  699 + .proc_handler = &proc_dointvec
  700 + },
693 701 { .ctl_name = 0 }
694 702 };
695 703  
net/ipv4/tcp_output.c
... ... @@ -59,6 +59,9 @@
59 59 int sysctl_tcp_mtu_probing = 0;
60 60 int sysctl_tcp_base_mss = 512;
61 61  
  62 +/* By default, RFC2861 behavior. */
  63 +int sysctl_tcp_slow_start_after_idle = 1;
  64 +
62 65 static void update_send_head(struct sock *sk, struct tcp_sock *tp,
63 66 struct sk_buff *skb)
64 67 {
... ... @@ -138,7 +141,8 @@
138 141 struct inet_connection_sock *icsk = inet_csk(sk);
139 142 const u32 now = tcp_time_stamp;
140 143  
141   - if (!tp->packets_out && (s32)(now - tp->lsndtime) > icsk->icsk_rto)
  144 + if (sysctl_tcp_slow_start_after_idle &&
  145 + (!tp->packets_out && (s32)(now - tp->lsndtime) > icsk->icsk_rto))
142 146 tcp_cwnd_restart(sk, __sk_dst_get(sk));
143 147  
144 148 tp->lsndtime = now;