UPSTREAM: tcp: temporarily disable Fast Open on SYN timeout

Fast Open currently has a fall back feature to address SYN-data being
dropped but it requires the middle-box to pass on regular SYN retry
after SYN-data. This is implemented in commit aab487435 ("net-tcp:
Fast Open client - detecting SYN-data drops")

However some NAT boxes will drop all subsequent packets after first
SYN-data and blackholes the entire connections.  An example is in
commit 356d7d8 "netfilter: nf_conntrack: fix tcp_in_window for Fast
Open".

The sender should note such incidents and fall back to use the regular
TCP handshake on subsequent attempts temporarily as well: after the
second SYN timeouts the original Fast Open SYN is most likely lost.
When such an event recurs Fast Open is disabled based on the number of
recurrences exponentially.

BUG=chromium:271766
TEST=boot, log in, enable TCP fast open in flags, restart browser
go to google.com and other sites, no crashes

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: David S. Miller <davem@davemloft.net>
Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
(cherry picked from commit c968601d174739cb1e7100c95e0eb3d2f7e91bc9)
from https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git

Change-Id: Ic039e2545810ffae77f67da543bf541c4de9f36b
Reviewed-on: https://chromium-review.googlesource.com/176673
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
2 files changed