|
@@ -291,25 +291,28 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
|
|
* ABC caps N to 2. Slow start exits when cwnd grows over ssthresh and
|
|
* ABC caps N to 2. Slow start exits when cwnd grows over ssthresh and
|
|
* returns the leftover acks to adjust cwnd in congestion avoidance mode.
|
|
* returns the leftover acks to adjust cwnd in congestion avoidance mode.
|
|
*/
|
|
*/
|
|
-void tcp_slow_start(struct tcp_sock *tp, u32 acked)
|
|
|
|
|
|
+u32 tcp_slow_start(struct tcp_sock *tp, u32 acked)
|
|
{
|
|
{
|
|
u32 cwnd = tp->snd_cwnd + acked;
|
|
u32 cwnd = tp->snd_cwnd + acked;
|
|
|
|
|
|
if (cwnd > tp->snd_ssthresh)
|
|
if (cwnd > tp->snd_ssthresh)
|
|
cwnd = tp->snd_ssthresh + 1;
|
|
cwnd = tp->snd_ssthresh + 1;
|
|
|
|
+ acked -= cwnd - tp->snd_cwnd;
|
|
tp->snd_cwnd = min(cwnd, tp->snd_cwnd_clamp);
|
|
tp->snd_cwnd = min(cwnd, tp->snd_cwnd_clamp);
|
|
|
|
+
|
|
|
|
+ return acked;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(tcp_slow_start);
|
|
EXPORT_SYMBOL_GPL(tcp_slow_start);
|
|
|
|
|
|
/* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w) */
|
|
/* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w) */
|
|
-void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w)
|
|
|
|
|
|
+void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked)
|
|
{
|
|
{
|
|
if (tp->snd_cwnd_cnt >= w) {
|
|
if (tp->snd_cwnd_cnt >= w) {
|
|
if (tp->snd_cwnd < tp->snd_cwnd_clamp)
|
|
if (tp->snd_cwnd < tp->snd_cwnd_clamp)
|
|
tp->snd_cwnd++;
|
|
tp->snd_cwnd++;
|
|
tp->snd_cwnd_cnt = 0;
|
|
tp->snd_cwnd_cnt = 0;
|
|
} else {
|
|
} else {
|
|
- tp->snd_cwnd_cnt++;
|
|
|
|
|
|
+ tp->snd_cwnd_cnt += acked;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai);
|
|
EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai);
|
|
@@ -333,7 +336,7 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked)
|
|
tcp_slow_start(tp, acked);
|
|
tcp_slow_start(tp, acked);
|
|
/* In dangerous area, increase slowly. */
|
|
/* In dangerous area, increase slowly. */
|
|
else
|
|
else
|
|
- tcp_cong_avoid_ai(tp, tp->snd_cwnd);
|
|
|
|
|
|
+ tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid);
|
|
EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid);
|
|
|
|
|