Skip to content
  • Florian Westphal's avatar
    dctcp: avoid bogus doubling of cwnd after loss · ce6dd233
    Florian Westphal authored
    If a congestion control module doesn't provide .undo_cwnd function,
    tcp_undo_cwnd_reduction() will set cwnd to
    
       tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh << 1);
    
    ... which makes sense for reno (it sets ssthresh to half the current cwnd),
    but it makes no sense for dctcp, which sets ssthresh based on the current
    congestion estimate.
    
    This can cause severe growth of cwnd (eventually overflowing u32).
    
    Fix this by saving last cwnd on loss and restore cwnd based on that,
    similar to cubic and other algorithms.
    
    Fixes: e3118e83
    
     ("net: tcp: add DCTCP congestion control algorithm")
    Cc: Lawrence Brakmo <brakmo@fb.com>
    Cc: Andrew Shewmaker <agshew@gmail.com>
    Cc: Glenn Judd <glenn.judd@morganstanley.com>
    Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ce6dd233