]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
tcp: make congestion control optionally skip slow start after idle
authorWei Wang <weiwan@google.com>
Fri, 5 May 2017 19:53:23 +0000 (12:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 May 2017 18:37:07 +0000 (14:37 -0400)
Congestion control modules that want full control over congestion
control behavior do not want the cwnd modifications controlled by
the sysctl_tcp_slow_start_after_idle code path.
So skip those code paths for CC modules that use the cong_control()
API.
As an example, those cwnd effects are not desired for the BBR congestion
control algorithm.

Fixes: c0402760f565 ("tcp: new CC hook to set sending rate with rate_sample in any CA state")
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/tcp_output.c

index 8c0e5a901d6424fbd01233cd3adfdce52076f7a9..38a7427ae902e35973a8b7fa0e95ff602ede0e87 100644 (file)
@@ -1234,10 +1234,12 @@ void tcp_cwnd_restart(struct sock *sk, s32 delta);
 
 static inline void tcp_slow_start_after_idle_check(struct sock *sk)
 {
+       const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops;
        struct tcp_sock *tp = tcp_sk(sk);
        s32 delta;
 
-       if (!sysctl_tcp_slow_start_after_idle || tp->packets_out)
+       if (!sysctl_tcp_slow_start_after_idle || tp->packets_out ||
+           ca_ops->cong_control)
                return;
        delta = tcp_time_stamp - tp->lsndtime;
        if (delta > inet_csk(sk)->icsk_rto)
index 60111a0fc2017e817fc37087b3862b82e002da0f..4858e190f6ac130c9441f58cb8944cc82bf67270 100644 (file)
@@ -1514,6 +1514,7 @@ static void tcp_cwnd_application_limited(struct sock *sk)
 
 static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)
 {
+       const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops;
        struct tcp_sock *tp = tcp_sk(sk);
 
        /* Track the maximum number of outstanding packets in each
@@ -1536,7 +1537,8 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)
                        tp->snd_cwnd_used = tp->packets_out;
 
                if (sysctl_tcp_slow_start_after_idle &&
-                   (s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= inet_csk(sk)->icsk_rto)
+                   (s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= inet_csk(sk)->icsk_rto &&
+                   !ca_ops->cong_control)
                        tcp_cwnd_application_limited(sk);
 
                /* The following conditions together indicate the starvation