diff options
| author | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
|---|---|---|
| committer | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
| commit | 79828b4fa835f73cdaf4bffa48696abdcbea9d02 (patch) | |
| tree | 5e0fa7156acb75ba603022bc807df8f2fedb97a8 /net/ipv4/tcp_cubic.c | |
| parent | 721b51fcf91898299d96f4b72cb9434cda29dce6 (diff) | |
| parent | 8c1a9d6323abf0fb1e5dad96cf3f1c783505ea5a (diff) | |
Merge remote-tracking branch 'asoc/fix/rt5645' into asoc-fix-rt5645
Diffstat (limited to 'net/ipv4/tcp_cubic.c')
| -rw-r--r-- | net/ipv4/tcp_cubic.c | 20 | 
1 files changed, 18 insertions, 2 deletions
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 06d3d665a9fd..c6ded6b2a79f 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c @@ -151,6 +151,21 @@ static void bictcp_init(struct sock *sk)  		tcp_sk(sk)->snd_ssthresh = initial_ssthresh;  } +static void bictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event) +{ +	if (event == CA_EVENT_TX_START) { +		s32 delta = tcp_time_stamp - tcp_sk(sk)->lsndtime; +		struct bictcp *ca = inet_csk_ca(sk); + +		/* We were application limited (idle) for a while. +		 * Shift epoch_start to keep cwnd growth to cubic curve. +		 */ +		if (ca->epoch_start && delta > 0) +			ca->epoch_start += delta; +		return; +	} +} +  /* calculate the cubic root of x using a table lookup followed by one   * Newton-Raphson iteration.   * Avg err ~= 0.195% @@ -320,7 +335,7 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)  	if (!tcp_is_cwnd_limited(sk))  		return; -	if (tp->snd_cwnd <= tp->snd_ssthresh) { +	if (tcp_in_slow_start(tp)) {  		if (hystart && after(ack, ca->end_seq))  			bictcp_hystart_reset(sk);  		acked = tcp_slow_start(tp, acked); @@ -439,7 +454,7 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us)  		ca->delay_min = delay;  	/* hystart triggers when cwnd is larger than some threshold */ -	if (hystart && tp->snd_cwnd <= tp->snd_ssthresh && +	if (hystart && tcp_in_slow_start(tp) &&  	    tp->snd_cwnd >= hystart_low_window)  		hystart_update(sk, delay);  } @@ -450,6 +465,7 @@ static struct tcp_congestion_ops cubictcp __read_mostly = {  	.cong_avoid	= bictcp_cong_avoid,  	.set_state	= bictcp_state,  	.undo_cwnd	= bictcp_undo_cwnd, +	.cwnd_event	= bictcp_cwnd_event,  	.pkts_acked     = bictcp_acked,  	.owner		= THIS_MODULE,  	.name		= "cubic",  |