tcp: track application-limited rate samples
[cascardo/linux.git] / net / ipv4 / tcp.c
index de02fb4..2250f89 100644 (file)
@@ -396,6 +396,9 @@ void tcp_init_sock(struct sock *sk)
         */
        tp->snd_cwnd = TCP_INIT_CWND;
 
+       /* There's a bubble in the pipe until at least the first ACK. */
+       tp->app_limited = ~0U;
+
        /* See draft-stevens-tcpca-spec-01 for discussion of the
         * initialization of these values.
         */
@@ -1014,6 +1017,9 @@ int tcp_sendpage(struct sock *sk, struct page *page, int offset,
                                        flags);
 
        lock_sock(sk);
+
+       tcp_rate_check_app_limited(sk);  /* is sending application-limited? */
+
        res = do_tcp_sendpages(sk, page, offset, size, flags);
        release_sock(sk);
        return res;
@@ -1115,6 +1121,8 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 
        timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
 
+       tcp_rate_check_app_limited(sk);  /* is sending application-limited? */
+
        /* Wait for a connection to finish. One exception is TCP Fast Open
         * (passive side) where data is allowed to be sent before a connection
         * is fully established.