1. 12 Nov, 2021 1 commit
    • Warner Losh's avatar
      tcp: better congestion control defaults · 7e3c9ec9
      Warner Losh authored
      Define CC_NEWRENO in all the appropriate DEFAULTS and std.* config
      files. It's the default congestion control algorithm.  Add code to cc.c
      so that CC_DEFAULT is "newreno" if it's not overriden in the config
      Sponsored by: Netflix
      Fixes: b8d60729 ("tcp: Congestion control cleanup.")
      Revired by: manu, hselasky, jhb, glebius, tuexen
      Differential Revision:	https://reviews.freebsd.org/D32964
  2. 11 Nov, 2021 1 commit
    • Randall Stewart's avatar
      tcp: Congestion control cleanup. · b8d60729
      Randall Stewart authored
      NOTE: HEADS UP read the note below if your kernel config is not including GENERIC!!
      This patch does a bit of cleanup on TCP congestion control modules. There were some rather
      interesting surprises that one could get i.e. where you use a socket option to change
      from one CC (say cc_cubic) to another CC (say cc_vegas) and you could in theory get
      a memory failure and end up on cc_newreno. This is not what one would expect. The
      new code fixes this by requiring a cc_data_sz() function so we can malloc with M_WAITOK
      and pass in to the init function preallocated memory. The CC init is expected in this
      case *not* to fail but if it does and a module does break the
      "no fail with memory given" contract we do fall back to the CC that was in place at the time.
      This also fixes up a set of common newreno utilities that can be shared amongst other
      CC modules instead of the other CC modules reaching into newreno and executing
      what they think is a "common and understood" function. Lets put these functions in
      cc.c and that way we have a common place that is easily findable by future developers or
      bug fixers. This also allows newreno to evolve and grow support for its features i.e. ABE
      and HYSTART++ without having to dance through hoops for other CC modules, instead
      both newreno and the other modules just call into the common functions if they desire
      that behavior or roll there own if that makes more sense.
      Note: This commit changes the kernel configuration!! If you are not using GENERIC in
      some form you must add a CC module option (one of CC_NEWRENO, CC_VEGAS, CC_CUBIC,
      CC_CDG, CC_CHD, CC_DCTCP, CC_HTCP, CC_HD). You can have more than one defined
      as well if you desire. Note that if you create a kernel configuration that does not
      define a congestion control module and includes INET or INET6 the kernel compile will
      break. Also you need to define a default, generic adds 'options CC_DEFAULT=\"newreno\"
      but you can specify any string that represents the name of the CC module (same names
      that show up in the CC module list under net.inet.tcp.cc). If you fail to add the
      options CC_DEFAULT in your kernel configuration the kernel build will also break.
      Reviewed by: Michael Tuexen
      Sponsored by: Netflix Inc.
      Differential Revision: https://reviews.freebsd.org/D32693
  3. 26 Feb, 2020 1 commit
    • Pawel Biernacki's avatar
      Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) · 7029da5c
      Pawel Biernacki authored
      r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
      still not MPSAFE (or already are but aren’t properly marked).
      Use it in preparation for a general review of all nodes.
      This is non-functional change that adds annotations to SYSCTL_NODE and
      SYSCTL_PROC nodes using one of the soon-to-be-required flags.
      Mark all obvious cases as MPSAFE.  All entries that haven't been marked
      as MPSAFE before are by default marked as NEEDGIANT
      Approved by:	kib (mentor, blanket)
      Commented by:	kib, gallatin, melifaro
      Differential Revision:	https://reviews.freebsd.org/D23718
  4. 19 Mar, 2018 1 commit
    • Lawrence Stewart's avatar
      Add support for the experimental Internet-Draft "TCP Alternative Backoff with · 370efe5a
      Lawrence Stewart authored
      ECN (ABE)" proposal to the New Reno congestion control algorithm module.
      ABE reduces the amount of congestion window reduction in response to
      ECN-signalled congestion relative to the loss-inferred congestion response.
      More details about ABE can be found in the Internet-Draft:
      The implementation introduces four new sysctls:
      - net.inet.tcp.cc.abe defaults to 0 (disabled) and can be set to non-zero to
        enable ABE for ECN-enabled TCP connections.
      - net.inet.tcp.cc.newreno.beta and net.inet.tcp.cc.newreno.beta_ecn set the
        multiplicative window decrease factor, specified as a percentage, applied to
        the congestion window in response to a loss-based or ECN-based congestion
        signal respectively. They default to the values specified in the draft i.e.
        beta=50 and beta_ecn=80.
      - net.inet.tcp.cc.abe_frlossreduce defaults to 0 (disabled) and can be set to
        non-zero to enable the use of standard beta (50% by default) when repairing
        loss during an ECN-signalled congestion recovery episode. It enables a more
        conservative congestion response and is provided for the purposes of
        experimentation as a result of some discussion at IETF 100 in Singapore.
      The values of beta and beta_ecn can also be set per-connection by way of the
      TCP_CCALGOOPT TCP-level socket option and the new CC_NEWRENO_BETA or
      CC_NEWRENO_BETA_ECN CC algo sub-options.
      Submitted by:	Tom Jones <tj@enoti.me>
      Tested by:	Tom Jones <tj@enoti.me>, Grenville Armitage <garmitage@swin.edu.au>
      Relnotes:	Yes
      Differential Revision:	https://reviews.freebsd.org/D11616
  5. 27 Nov, 2017 1 commit
    • Pedro F. Giffuni's avatar
      sys: general adoption of SPDX licensing ID tags. · fe267a55
      Pedro F. Giffuni authored
      Mainly focus on files that use BSD 2-Clause license, however the tool I
      was using misidentified many licenses so this was mostly a manual - error
      prone - task.
      The Software Package Data Exchange (SPDX) group provides a specification
      to make it easier for automated tools to detect and summarize well known
      opensource licenses. We are gradually adopting the specification, noting
      that the tags are considered only advisory and do not, in any way,
      superceed or replace the license texts.
      No functional change intended.
  6. 26 Jul, 2016 1 commit
  7. 27 Jan, 2016 1 commit
  8. 21 Jan, 2016 2 commits
  9. 07 Nov, 2014 1 commit
  10. 28 Oct, 2014 1 commit
  11. 27 Oct, 2014 2 commits
  12. 10 Aug, 2014 1 commit
  13. 12 Apr, 2011 1 commit
  14. 23 Jan, 2011 1 commit
    • Lawrence Stewart's avatar
      An sbuf configured with SBUF_AUTOEXTEND will call malloc with M_WAITOK when a · a66ac850
      Lawrence Stewart authored
      write to the buffer causes it to overflow. We therefore can't hold the CC list
      rwlock over a call to sbuf_printf() for an sbuf configured with SBUF_AUTOEXTEND.
      Switch to a fixed length sbuf which should be of sufficient size except in the
      very unlikely event that the sysctl is being processed as one or more new
      algorithms are loaded. If that happens, we accept the race and may fail the
      sysctl gracefully if there is insufficient room to print the names of all the
      This should address a WITNESS warning and the potential panic that would occur
      if the sbuf call to malloc did sleep whilst holding the CC list rwlock.
      Sponsored by:	FreeBSD Foundation
      Reported by:	Nick Hibma
      Reviewed by:	bz
      MFC after:	3 weeks
      X-MFC with:	r215166
  15. 16 Nov, 2010 5 commits
    • Lawrence Stewart's avatar
      Make the CC framework more VIMAGE friendly by adding the machinery to allow · 78b01840
      Lawrence Stewart authored
      vnets to select their own default CC algorithm independent of each other and the
      base system. If the base system or a vnet has set a default which gets unloaded,
      we reset that netstack's default to NewReno.
      Sponsored by:	FreeBSD Foundation
      Tested by:	Mikolaj Golub <to.my.trociny at gmail com>
      Reviewed by:	bz (briefly)
      MFC after:	3 months
    • Lawrence Stewart's avatar
      - Querying the default CC algo is more common than setting it and the function · ebf92e86
      Lawrence Stewart authored
        is small, so there is no good reason not to declare the buffer at the top.
      - Fix a whitespace nit.
      Sponsored by:	FreeBSD Foundation
      MFC after:	11 weeks
      X-MFC with:	r215166
    • Lawrence Stewart's avatar
      Move protocol specific implementation detail out of the core CC framework. · 99065ae6
      Lawrence Stewart authored
      Sponsored by:	FreeBSD Foundation
      Tested by:	Mikolaj Golub <to.my.trociny at gmail com>
      MFC after:	11 weeks
      X-MFC with:	r215166
    • Lawrence Stewart's avatar
      On CC algorithm module unload, we walk the list of active TCP control blocks. · 4e805854
      Lawrence Stewart authored
      Any found to be using the algorithm that is about to go away are switched back
      to NewReno to avoid leaving dangling pointers which would trigger a panic. For
      VIMAGE kernels, there is a list per vnet to walk, yet the implementation was
      only examining one of the vnet lists.
      Fix the implementation of the above feature for VIMAGE kernels by looping
      through all active TCP control blocks across all vnets.
      Sponsored by:	FreeBSD Foundation
      Tested by:	Mikolaj Golub <to.my.trociny at gmail com>
      Reviewed by:	bz (briefly)
      MFC after:	11 weeks
    • Lawrence Stewart's avatar
      cc_init() should only be run once on system boot, but with VIMAGE kernels it · 14f57a8b
      Lawrence Stewart authored
      runs on boot and each time a vnet jail is created. Running cc_init() multiple
      times results in a panic when attempting to initialise the cc_list lock again,
      and so r215166 effectively broke the use of vnet jails.
      Switch to using a SYSINIT to run cc_init() on boot. CC algorithm modules loaded
      on boot register in the same SI_SUB_PROTO_IFATTACHDOMAIN category as is used in
      this patch, so cc_init() is run at SI_ORDER_FIRST to ensure the framework is
      initialised before module registration is attempted.
      Sponsored by:	FreeBSD Foundation
      Reported and tested by:	Mikolaj Golub <to.my.trociny at gmail com>
      MFC after:	11 weeks
      X-MFC with:	r215166
  16. 12 Nov, 2010 1 commit
    • Lawrence Stewart's avatar
      This commit marks the first formal contribution of the "Five New TCP Congestion · dbc42409
      Lawrence Stewart authored
      Control Algorithms for FreeBSD" FreeBSD Foundation funded project. More details
      about the project are available at: http://caia.swin.edu.au/freebsd/5cc/
      - Add a KPI and supporting infrastructure to allow modular congestion control
        algorithms to be used in the net stack. Algorithms can maintain per-connection
        state if required, and connections maintain their own algorithm pointer, which
        allows different connections to concurrently use different algorithms. The
        TCP_CONGESTION socket option can be used with getsockopt()/setsockopt() to
        programmatically query or change the congestion control algorithm respectively
        from within an application at runtime.
      - Integrate the framework with the TCP stack in as least intrusive a manner as
        possible. Care was also taken to develop the framework in a way that should
        allow integration with other congestion aware transport protocols (e.g. SCTP)
        in the future. The hope is that we will one day be able to share a single set
        of congestion control algorithm modules between all congestion aware transport
      - Introduce a new congestion recovery (TF_CONGRECOVERY) state into the TCP stack
        and use it to decouple the meaning of recovery from a congestion event and
        recovery from packet loss (TF_FASTRECOVERY) a la RFC2581. ECN and delay based
        congestion control protocols don't generally need to recover from packet loss
        and need a different way to note a congestion recovery episode within the
      - Remove the net.inet.tcp.newreno sysctl, which simplifies some portions of code
        and ensures the stack always uses the appropriate mechanisms for recovering
        from packet loss during a congestion recovery episode.
      - Extract the NewReno congestion control algorithm from the TCP stack and
        massage it into module form. NewReno is always built into the kernel and will
        remain the default algorithm for the forseeable future. Implementations of
        additional different algorithms will become available in the near future.
      - Bump __FreeBSD_version to 900025 and note in UPDATING that rebuilding code
        that relies on the size of "struct tcpcb" is required.
      Many thanks go to the Cisco University Research Program Fund at Community
      Foundation Silicon Valley and the FreeBSD Foundation. Their support of our work
      at the Centre for Advanced Internet Architectures, Swinburne University of
      Technology is greatly appreciated.
      In collaboration with:	David Hayes <dahayes at swin edu au> and
      			Grenville Armitage <garmitage at swin edu au>
      Sponsored by:	Cisco URP, FreeBSD Foundation
      Reviewed by:	rpaulo
      Tested by:	David Hayes (and many others over the years)
      MFC after:	3 months