Blame examples/tcp_cubic-better-follow-cubic-curve-original.patch

Packit Service ac8aad
This patch is for 3.10.x.
Packit Service ac8aad
It combines the following commits from the mainline:
Packit Service ac8aad
Packit Service ac8aad
commit 30927520dbae297182990bb21d08762bcc35ce1d
Packit Service ac8aad
Author: Eric Dumazet <edumazet@google.com>
Packit Service ac8aad
Date:   Wed Sep 9 21:55:07 2015 -0700
Packit Service ac8aad
Packit Service ac8aad
    tcp_cubic: better follow cubic curve after idle period
Packit Service ac8aad
Packit Service ac8aad
commit c2e7204d180f8efc80f27959ca9cf16fa17f67db
Packit Service ac8aad
Author: Eric Dumazet <edumazet@google.com>
Packit Service ac8aad
Date:   Thu Sep 17 08:38:00 2015 -0700
Packit Service ac8aad
Packit Service ac8aad
    tcp_cubic: do not set epoch_start in the future
Packit Service ac8aad
Packit Service ac8aad
References:
Packit Service ac8aad
http://www.phoronix.com/scan.php?page=news_item&px=Google-Fixes-TCP-Linux
Packit Service ac8aad
Packit Service ac8aad
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
Packit Service ac8aad
index 894b7ce..872b3a0 100644
Packit Service ac8aad
--- a/net/ipv4/tcp_cubic.c
Packit Service ac8aad
+++ b/net/ipv4/tcp_cubic.c
Packit Service ac8aad
@@ -153,6 +153,27 @@ static void bictcp_init(struct sock *sk)
Packit Service ac8aad
 		tcp_sk(sk)->snd_ssthresh = initial_ssthresh;
Packit Service ac8aad
 }
Packit Service ac8aad
 
Packit Service ac8aad
+static void bictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event)
Packit Service ac8aad
+{
Packit Service ac8aad
+	if (event == CA_EVENT_TX_START) {
Packit Service ac8aad
+		struct bictcp *ca = inet_csk_ca(sk);
Packit Service ac8aad
+		u32 now = tcp_time_stamp;
Packit Service ac8aad
+		s32 delta;
Packit Service ac8aad
+
Packit Service ac8aad
+		delta = now - tcp_sk(sk)->lsndtime;
Packit Service ac8aad
+
Packit Service ac8aad
+		/* We were application limited (idle) for a while.
Packit Service ac8aad
+		 * Shift epoch_start to keep cwnd growth to cubic curve.
Packit Service ac8aad
+		 */
Packit Service ac8aad
+		if (ca->epoch_start && delta > 0) {
Packit Service ac8aad
+			ca->epoch_start += delta;
Packit Service ac8aad
+			if (after(ca->epoch_start, now))
Packit Service ac8aad
+				ca->epoch_start = now;
Packit Service ac8aad
+		}
Packit Service ac8aad
+		return;
Packit Service ac8aad
+	}
Packit Service ac8aad
+}
Packit Service ac8aad
+
Packit Service ac8aad
 /* calculate the cubic root of x using a table lookup followed by one
Packit Service ac8aad
  * Newton-Raphson iteration.
Packit Service ac8aad
  * Avg err ~= 0.195%
Packit Service ac8aad
@@ -439,6 +460,7 @@ static struct tcp_congestion_ops cubictcp __read_mostly = {
Packit Service ac8aad
 	.cong_avoid	= bictcp_cong_avoid,
Packit Service ac8aad
 	.set_state	= bictcp_state,
Packit Service ac8aad
 	.undo_cwnd	= bictcp_undo_cwnd,
Packit Service ac8aad
+	.cwnd_event	= bictcp_cwnd_event,
Packit Service ac8aad
 	.pkts_acked     = bictcp_acked,
Packit Service ac8aad
 	.owner		= THIS_MODULE,
Packit Service ac8aad
 	.name		= "cubic",