]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Backport the new TCP reassembly code from head to stable/11.
authortuexen <tuexen@FreeBSD.org>
Mon, 25 Feb 2019 10:38:37 +0000 (10:38 +0000)
committertuexen <tuexen@FreeBSD.org>
Mon, 25 Feb 2019 10:38:37 +0000 (10:38 +0000)
commita3aa2bcf75352410c358c2b94d0c586da0aea4bc
tree3ae811cad0a9404d8580932bb80062c5013bcd3c
parente9d07dae9bde6ad1f0ecde8e3c21bb294c6abff7
Backport the new TCP reassembly code from head to stable/11.

In particular:

* Cherry pick the changes in sys/queue.h from r334804.

* MFC r338102 with manually removing changes to file not existent in
  stable/11 and resolve conflicts in tcp_var.h.
  This change represents a substantial restructure of the way we
  reassembly inbound tcp segments. The old algorithm just blindly
  dropped in segments without coalescing. This meant that every
  segment could take up greater and greater room on the linked list
  of segments. This of course is now subject to a tighter limit (100)
  of segments which in a high BDP situation will cause us to be a
  lot more in-efficent as we drop segments beyond 100 entries that
  we receive. What this restructure does is cause the reassembly
  buffer to coalesce segments putting an emphasis on the two
  common cases (which avoid walking the list of segments) i.e.
  where we add to the back of the queue of segments and where we
  add to the front. We also have the reassembly buffer supporting
  a couple of debug options (black box logging as well as counters
  for code coverage). These are compiled out by default but can
  be added by uncommenting the defines.

* Manually fix tcp_stacks/fastopen.c, since it does not exist anymore
  in head.

* MFC r342280:
  Fix a regression in the TCP handling of received segments.
  When receiving TCP segments the stack protects itself by limiting
  the resources allocated for a TCP connections. This patch adds
  an exception to these limitations for the TCP segement which is the next
  expected in-sequence segment. Without this patch, TCP connections
  may stall and finally fail in some cases of packet loss.

* MFC r343439:
  Don't include two header files when not needed.
  This allows the part of the rewrite of TCP reassembly in this
  files to be MFCed to stable/11 with manual change.

* MFC r344428:
  This patch addresses an issue brought up by bz@ in D18968:
  When TCP_REASS_LOGGING is defined, a NULL pointer dereference would happen,
  if user data was received during the TCP handshake and BB logging is used.
  A KASSERT is also added to detect tcp_reass() calls with illegal parameter
  combinations.

Reviewed by: bz@, jtl, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D18960
sys/netinet/tcp_input.c
sys/netinet/tcp_reass.c
sys/netinet/tcp_stacks/fastpath.c
sys/netinet/tcp_subr.c
sys/netinet/tcp_usrreq.c
sys/netinet/tcp_var.h
sys/sys/queue.h