[TCP]: Limited slow start for Highspeed TCP
authorStephen Hemminger <shemminger@osdl.org>
Tue, 6 Jun 2006 00:30:56 +0000 (17:30 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 18 Jun 2006 04:29:33 +0000 (21:29 -0700)
Implementation of RFC3742 limited slow start. Added as part
of the TCP highspeed congestion control module.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_highspeed.c

index ba7c63ca5bb10838f9e81a64b81cf9131be1a3f2..1120245b237341bb9e8d4664e0a9f2eb2ab824af 100644 (file)
@@ -98,6 +98,10 @@ struct hstcp {
        u32     ai;
 };
 
+static int max_ssthresh = 100;
+module_param(max_ssthresh, int, 0644);
+MODULE_PARM_DESC(max_ssthresh, "limited slow start threshold (RFC3742)");
+
 static void hstcp_init(struct sock *sk)
 {
        struct tcp_sock *tp = tcp_sk(sk);
@@ -119,9 +123,23 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt,
        if (!tcp_is_cwnd_limited(sk, in_flight))
                return;
 
-       if (tp->snd_cwnd <= tp->snd_ssthresh)
-               tcp_slow_start(tp);
-       else {
+       if (tp->snd_cwnd <= tp->snd_ssthresh) {
+               /* RFC3742: limited slow start
+                * the window is increased by 1/K MSS for each arriving ACK,
+                * for K = int(cwnd/(0.5 max_ssthresh))
+                */
+               if (max_ssthresh > 0 && tp->snd_cwnd > max_ssthresh) {
+                       u32 k = max(tp->snd_cwnd / (max_ssthresh >> 1), 1U);
+                       if (++tp->snd_cwnd_cnt >= k) {
+                               if (tp->snd_cwnd < tp->snd_cwnd_clamp)
+                                       tp->snd_cwnd++;
+                               tp->snd_cwnd_cnt = 0;
+                       }
+               } else {
+                       if (tp->snd_cwnd < tp->snd_cwnd_clamp)
+                               tp->snd_cwnd++;
+               }
+       } else {
                /* Update AIMD parameters */
                if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) {
                        while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd &&