mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
tcp: tcp_vegas ssthresh bugfix
This patch fixes ssthresh accounting issues in tcp_vegas when cwnd decreases Signed-off-by: Doug Leith <doug.leith@nuim.ie> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
217cbfa856
commit
c80a5cdfc5
1 changed files with 9 additions and 2 deletions
|
@ -158,6 +158,11 @@ void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event);
|
EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event);
|
||||||
|
|
||||||
|
static inline u32 tcp_vegas_ssthresh(struct tcp_sock *tp)
|
||||||
|
{
|
||||||
|
return min(tp->snd_ssthresh, tp->snd_cwnd-1);
|
||||||
|
}
|
||||||
|
|
||||||
static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
|
static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
|
||||||
{
|
{
|
||||||
struct tcp_sock *tp = tcp_sk(sk);
|
struct tcp_sock *tp = tcp_sk(sk);
|
||||||
|
@ -221,11 +226,10 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
|
||||||
*/
|
*/
|
||||||
diff = tp->snd_cwnd * (rtt-vegas->baseRTT) / vegas->baseRTT;
|
diff = tp->snd_cwnd * (rtt-vegas->baseRTT) / vegas->baseRTT;
|
||||||
|
|
||||||
if (diff > gamma && tp->snd_ssthresh > 2 ) {
|
if (diff > gamma && tp->snd_cwnd <= tp->snd_ssthresh) {
|
||||||
/* Going too fast. Time to slow down
|
/* Going too fast. Time to slow down
|
||||||
* and switch to congestion avoidance.
|
* and switch to congestion avoidance.
|
||||||
*/
|
*/
|
||||||
tp->snd_ssthresh = 2;
|
|
||||||
|
|
||||||
/* Set cwnd to match the actual rate
|
/* Set cwnd to match the actual rate
|
||||||
* exactly:
|
* exactly:
|
||||||
|
@ -235,6 +239,7 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
|
||||||
* utilization.
|
* utilization.
|
||||||
*/
|
*/
|
||||||
tp->snd_cwnd = min(tp->snd_cwnd, (u32)target_cwnd+1);
|
tp->snd_cwnd = min(tp->snd_cwnd, (u32)target_cwnd+1);
|
||||||
|
tp->snd_ssthresh = tcp_vegas_ssthresh(tp);
|
||||||
|
|
||||||
} else if (tp->snd_cwnd <= tp->snd_ssthresh) {
|
} else if (tp->snd_cwnd <= tp->snd_ssthresh) {
|
||||||
/* Slow start. */
|
/* Slow start. */
|
||||||
|
@ -250,6 +255,8 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
|
||||||
* we slow down.
|
* we slow down.
|
||||||
*/
|
*/
|
||||||
tp->snd_cwnd--;
|
tp->snd_cwnd--;
|
||||||
|
tp->snd_ssthresh
|
||||||
|
= tcp_vegas_ssthresh(tp);
|
||||||
} else if (diff < alpha) {
|
} else if (diff < alpha) {
|
||||||
/* We don't have enough extra packets
|
/* We don't have enough extra packets
|
||||||
* in the network, so speed up.
|
* in the network, so speed up.
|
||||||
|
|
Loading…
Reference in a new issue