[TCP]: Add RFC3742 Limited Slow-Start, controlled by variable sysctl_tcp_max_ssthresh.
authorJohn Heffner <jheffner@psc.edu>
Mon, 26 Mar 2007 02:21:45 +0000 (19:21 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:23:19 +0000 (22:23 -0700)
Signed-off-by: John Heffner <jheffner@psc.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/sysctl.h
include/net/tcp.h
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp_cong.c

index 9a8970bf99a623a2fafa288af43cc8e225a95e40..98e0fd241a255063a54e5eda7620278d16f4f26d 100644 (file)
@@ -438,6 +438,7 @@ enum
        NET_CIPSOV4_RBM_STRICTVALID=121,
        NET_TCP_AVAIL_CONG_CONTROL=122,
        NET_TCP_ALLOWED_CONG_CONTROL=123,
+       NET_TCP_MAX_SSTHRESH=124,
 };
 
 enum {
index 7fd6b77519c3c86ae98c2c93c8bbb2519a20ee2f..6d09f5085f6a9ef4c6a46648b2e79a4cc912cfa2 100644 (file)
@@ -230,6 +230,7 @@ extern int sysctl_tcp_mtu_probing;
 extern int sysctl_tcp_base_mss;
 extern int sysctl_tcp_workaround_signed_windows;
 extern int sysctl_tcp_slow_start_after_idle;
+extern int sysctl_tcp_max_ssthresh;
 
 extern atomic_t tcp_memory_allocated;
 extern atomic_t tcp_sockets_allocated;
index 0aa304711a96ee09b7a99a48f4a1c676b4ee86ec..d68effe98e8db7d6d994651c5bd1ce028115f6de 100644 (file)
@@ -803,6 +803,14 @@ ctl_table ipv4_table[] = {
                .proc_handler   = &proc_allowed_congestion_control,
                .strategy       = &strategy_allowed_congestion_control,
        },
+       {
+               .ctl_name       = NET_TCP_MAX_SSTHRESH,
+               .procname       = "tcp_max_ssthresh",
+               .data           = &sysctl_tcp_max_ssthresh,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
        { .ctl_name = 0 }
 };
 
index 34ae3f13483a6e37b65402e3318bd635b716e460..ccd88407e0cdf56e4154c858b120605756f05c14 100644 (file)
@@ -12,6 +12,8 @@
 #include <linux/list.h>
 #include <net/tcp.h>
 
+int sysctl_tcp_max_ssthresh = 0;
+
 static DEFINE_SPINLOCK(tcp_cong_list_lock);
 static LIST_HEAD(tcp_cong_list);
 
@@ -274,10 +276,13 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
 
 
 /*
- * Linear increase during slow start
+ * Slow start (exponential increase) with
+ * RFC3742 Limited Slow Start (fast linear increase) support.
  */
 void tcp_slow_start(struct tcp_sock *tp)
 {
+       int cnt = 0;
+
        if (sysctl_tcp_abc) {
                /* RFC3465: Slow Start
                 * TCP sender SHOULD increase cwnd by the number of
@@ -286,17 +291,25 @@ void tcp_slow_start(struct tcp_sock *tp)
                 */
                if (tp->bytes_acked < tp->mss_cache)
                        return;
-
-               /* We MAY increase by 2 if discovered delayed ack */
-               if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache) {
-                       if (tp->snd_cwnd < tp->snd_cwnd_clamp)
-                               tp->snd_cwnd++;
-               }
        }
+
+       if (sysctl_tcp_max_ssthresh > 0 &&
+           tp->snd_cwnd > sysctl_tcp_max_ssthresh)
+               cnt += sysctl_tcp_max_ssthresh>>1;
+       else
+               cnt += tp->snd_cwnd;
+
+       /* RFC3465: We MAY increase by 2 if discovered delayed ack */
+       if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache)
+               cnt <<= 1;
        tp->bytes_acked = 0;
 
-       if (tp->snd_cwnd < tp->snd_cwnd_clamp)
-               tp->snd_cwnd++;
+       tp->snd_cwnd_cnt += cnt;
+       while (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
+               tp->snd_cwnd_cnt -= tp->snd_cwnd;
+               if (tp->snd_cwnd < tp->snd_cwnd_clamp)
+                       tp->snd_cwnd++;
+       }
 }
 EXPORT_SYMBOL_GPL(tcp_slow_start);