diff options
Diffstat (limited to 'net/ipv4/tcp_bic.c')
| -rw-r--r-- | net/ipv4/tcp_bic.c | 19 | 
1 files changed, 11 insertions, 8 deletions
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c index 3b53fd1af23..d5de69bc04f 100644 --- a/net/ipv4/tcp_bic.c +++ b/net/ipv4/tcp_bic.c @@ -63,7 +63,6 @@ static inline void bictcp_reset(struct bictcp *ca)  {  	ca->cnt = 0;  	ca->last_max_cwnd = 0; -	ca->loss_cwnd = 0;  	ca->last_cwnd = 0;  	ca->last_time = 0;  	ca->epoch_start = 0; @@ -72,7 +71,11 @@ static inline void bictcp_reset(struct bictcp *ca)  static void bictcp_init(struct sock *sk)  { -	bictcp_reset(inet_csk_ca(sk)); +	struct bictcp *ca = inet_csk_ca(sk); + +	bictcp_reset(ca); +	ca->loss_cwnd = 0; +  	if (initial_ssthresh)  		tcp_sk(sk)->snd_ssthresh = initial_ssthresh;  } @@ -127,7 +130,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)  	}  	/* if in slow start or link utilization is very low */ -	if (ca->loss_cwnd == 0) { +	if (ca->last_max_cwnd == 0) {  		if (ca->cnt > 20) /* increase cwnd 5% per RTT */  			ca->cnt = 20;  	} @@ -137,16 +140,16 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)  		ca->cnt = 1;  } -static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) +static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)  {  	struct tcp_sock *tp = tcp_sk(sk);  	struct bictcp *ca = inet_csk_ca(sk); -	if (!tcp_is_cwnd_limited(sk, in_flight)) +	if (!tcp_is_cwnd_limited(sk))  		return;  	if (tp->snd_cwnd <= tp->snd_ssthresh) -		tcp_slow_start(tp); +		tcp_slow_start(tp, acked);  	else {  		bictcp_update(ca, tp->snd_cwnd);  		tcp_cong_avoid_ai(tp, ca->cnt); @@ -185,7 +188,7 @@ static u32 bictcp_undo_cwnd(struct sock *sk)  {  	const struct tcp_sock *tp = tcp_sk(sk);  	const struct bictcp *ca = inet_csk_ca(sk); -	return max(tp->snd_cwnd, ca->last_max_cwnd); +	return max(tp->snd_cwnd, ca->loss_cwnd);  }  static void bictcp_state(struct sock *sk, u8 new_state) @@ -209,7 +212,7 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt)  } -static struct tcp_congestion_ops bictcp = { +static struct tcp_congestion_ops bictcp __read_mostly = {  	.init		= bictcp_init,  	.ssthresh	= bictcp_recalc_ssthresh,  	.cong_avoid	= bictcp_cong_avoid,  | 
