tcp_htcp: last_cong bug fix

This patch fixes a minor bug in tcp_htcp.c which has been
highlighted by Lachlan Andrew and Lawrence Stewart. Currently, the
time since the last congestion event, which is stored in variable
last_cong, is reset whenever there is a state change into
TCP_CA_Open. This includes transitions of the type
TCP_CA_Open->TCP_CA_Disorder->TCP_CA_Open which are not associated
with backoff of cwnd. The patch changes last_cong to be updated
only on transitions into TCP_CA_Open that occur after experiencing
the congestion-related states TCP_CA_Loss, TCP_CA_Recovery,
TCP_CA_CWR.

Signed-off-by: Doug Leith <doug.leith@nuim.ie>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Doug Leith and committed by David S. Miller 8f65b535 d809a159

+10 -4
+10 -4
net/ipv4/tcp_htcp.c
··· 69 69 const struct tcp_sock *tp = tcp_sk(sk); 70 70 struct htcp *ca = inet_csk_ca(sk); 71 71 72 - ca->last_cong = ca->undo_last_cong; 73 - ca->maxRTT = ca->undo_maxRTT; 74 - ca->old_maxB = ca->undo_old_maxB; 72 + if (ca->undo_last_cong) { 73 + ca->last_cong = ca->undo_last_cong; 74 + ca->maxRTT = ca->undo_maxRTT; 75 + ca->old_maxB = ca->undo_old_maxB; 76 + ca->undo_last_cong = 0; 77 + } 75 78 76 79 return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta); 77 80 } ··· 271 268 case TCP_CA_Open: 272 269 { 273 270 struct htcp *ca = inet_csk_ca(sk); 274 - ca->last_cong = jiffies; 271 + if (ca->undo_last_cong) { 272 + ca->last_cong = jiffies; 273 + ca->undo_last_cong = 0; 274 + } 275 275 } 276 276 break; 277 277 case TCP_CA_CWR: