tcp: update congestion state first before raising cwnd
authorYuchung Cheng <ycheng@google.com>
Thu, 9 Jul 2015 20:16:31 +0000 (13:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Jul 2015 21:22:52 +0000 (14:22 -0700)
commitb20a3fa30a281b52b2576b509efbe5cd47a5a79b
treedb19bf4b5ef34ff71a94b9b50ac58875734fedd1
parent76174004a0f19785a328f40388e87e982bbf69b9
tcp: update congestion state first before raising cwnd

The congestion state and cwnd can be updated in the wrong order.
For example, upon receiving a dubious ACK, we incorrectly raise
the cwnd first (tcp_may_raise_cwnd()/tcp_cong_avoid()) because
the state is still Open, then enter recovery state to reduce cwnd.

For another example, if the ACK indicates spurious timeout or
retransmits, we first revert the cwnd reduction and congestion
state back to Open state.  But we don't raise the cwnd even though
the ACK does not indicate any congestion.

To fix this problem we should first call tcp_fastretrans_alert() to
process the dubious ACK and update the congestion state, then call
tcp_may_raise_cwnd() that raises cwnd based on the current state.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Nandita Dukkipati <nanditad@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c