1.\" 2.\" Copyright (c) 2010-2011 The FreeBSD Foundation 3.\" All rights reserved. 4.\" 5.\" This documentation was written at the Centre for Advanced Internet 6.\" Architectures, Swinburne University of Technology, Melbourne, Australia by 7.\" David Hayes and Lawrence Stewart under sponsorship from the FreeBSD 8.\" Foundation. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 23.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" $FreeBSD$ 32.\" 33.Dd August 6, 2019 34.Dt MOD_CC 4 35.Os 36.Sh NAME 37.Nm mod_cc 38.Nd Modular congestion control 39.Sh DESCRIPTION 40The modular congestion control framework allows the TCP implementation to 41dynamically change the congestion control algorithm used by new and existing 42connections. 43Algorithms are identified by a unique 44.Xr ascii 7 45name. 46Algorithm modules can be compiled into the kernel or loaded as kernel modules 47using the 48.Xr kld 4 49facility. 50.Pp 51The default algorithm is NewReno, and all connections use the default unless 52explicitly overridden using the 53.Dv TCP_CONGESTION 54socket option (see 55.Xr tcp 4 56for details). 57The default can be changed using a 58.Xr sysctl 3 59MIB variable detailed in the 60.Sx MIB Variables 61section below. 62.Pp 63Algorithm specific parameters can be set or queried using the 64.Dv TCP_CCALGOOPT 65socket option (see 66.Xr tcp 4 67for details). 68Callers must pass a pointer to an algorithm specific data, and specify 69its size. 70.Pp 71Unloading a congestion control module will fail if it is used as a 72default by any Vnet. 73When unloading a module, the Vnet default is 74used to switch a connection to an alternate congestion control. 75Note that the new congestion control module may fail to initialize its 76internal memory, if so it will fail the module unload. 77If this occurs often times retrying the unload will succeed since the temporary 78memory shortage as the new CC module malloc's memory, that prevented the 79switch is often transient. 80.Sh MIB Variables 81The framework exposes the following variables in the 82.Va net.inet.tcp.cc 83branch of the 84.Xr sysctl 3 85MIB: 86.Bl -tag -width ".Va hystartplusplus.css_growth_div" 87.It Va available 88Read-only list of currently available congestion control algorithms by name. 89.It Va algorithm 90Returns the current default congestion control algorithm when read, and changes 91the default when set. 92When attempting to change the default algorithm, this variable should be set to 93one of the names listed by the 94.Va net.inet.tcp.cc.available 95MIB variable. 96.It Va abe 97Enable support for RFC 8511, 98which alters the window decrease factor applied to the congestion window in 99response to an ECN congestion signal. 100Refer to individual congestion control man pages to determine if they implement 101support for ABE and for configuration details. 102.It Va abe_frlossreduce 103If non-zero, apply standard beta instead of ABE-beta during ECN-signalled 104congestion recovery episodes if loss also needs to be repaired. 105.It Va hystartplusplus.bblogs 106This boolean controls if black box logging will be done for hystart++ events. 107If set to zero (the default) no logging is performed. 108If set to one then black box logs will be generated on all hystart++ events. 109.It Va hystartplusplus.css_rounds 110This value controls the number of rounds that CSS runs for. 111The default value matches the current internet-draft of 5. 112.It Va hystartplusplus.css_growth_div 113This value controls the divisor applied to slowstart during CSS. 114The default value matches the current internet-draft of 4. 115.It Va hystartplusplus.n_rttsamples 116This value controls how many rtt samples must be collected in each round for 117hystart++ to be active. 118The default value matches the current internet-draft of 8. 119.It Va hystartplusplus.maxrtt_thresh 120This value controls the maximum rtt variance clamp when considering if CSS is needed. 121The default value matches the current internet-draft of 16000 (in microseconds). 122For further explanation please see the internet-draft. 123.It Va hystartplusplus.minrtt_thresh 124This value controls the minimum rtt variance clamp when considering if CSS is needed. 125The default value matches the current internet-draft of 4000 (in microseconds). 126For further explanation please see the internet-draft. 127.El 128.Pp 129Each congestion control module may also expose other MIB variables 130to control their behaviour. 131Note that both newreno and cubic now support hystart++ based on the version 3 of the internet-draft. 132.Sh Kernel Configuration 133All of the available congestion control modules may also be loaded 134via kernel configutation options. 135A kernel configuration is required to have at least one congestion control 136algorithm built into it via kernel option and a system default specified. 137Compilation of the kernel will fail if these two conditions are not met. 138.Sh Kernel Configuration Options 139The framework exposes the following kernel configuration options. 140.Bl -tag -width ".Va CC_NEWRENO" 141.It Va CC_NEWRENO 142This directive loads the newreno congestion control algorithm and is included 143in GENERIC by default. 144.It Va CC_CUBIC 145This directive loads the cubic congestion control algorithm. 146.It Va CC_VEGAS 147This directive loads the vegas congestion control algorithm, note that 148this algorithm also requires the TCP_HHOOK option as well. 149.It Va CC_CDG 150This directive loads the cdg congestion control algorithm, note that 151this algorithm also requires the TCP_HHOOK option as well. 152.It Va CC_DCTCP 153This directive loads the dctcp congestion control algorithm. 154.It Va CC_HD 155This directive loads the hd congestion control algorithm, note that 156this algorithm also requires the TCP_HHOOK option as well. 157.It Va CC_CHD 158This directive loads the chd congestion control algorithm, note that 159this algorithm also requires the TCP_HHOOK option as well. 160.It Va CC_HTCP 161This directive loads the htcp congestion control algorithm. 162.It Va CC_DEFAULT 163This directive specifies the string that represents the name of the system default algorithm, the GENERIC kernel 164defaults this to newreno. 165.El 166.Sh SEE ALSO 167.Xr cc_cdg 4 , 168.Xr cc_chd 4 , 169.Xr cc_cubic 4 , 170.Xr cc_dctcp 4 , 171.Xr cc_hd 4 , 172.Xr cc_htcp 4 , 173.Xr cc_newreno 4 , 174.Xr cc_vegas 4 , 175.Xr tcp 4 , 176.Xr config 5 , 177.Xr config 8 , 178.Xr mod_cc 9 179.Sh ACKNOWLEDGEMENTS 180Development and testing of this software were made possible in part by grants 181from the FreeBSD Foundation and Cisco University Research Program Fund at 182Community Foundation Silicon Valley. 183.Sh HISTORY 184The 185.Nm 186modular congestion control framework first appeared in 187.Fx 9.0 . 188.Pp 189The framework was first released in 2007 by James Healy and Lawrence Stewart 190whilst working on the NewTCP research project at Swinburne University of 191Technology's Centre for Advanced Internet Architectures, Melbourne, Australia, 192which was made possible in part by a grant from the Cisco University Research 193Program Fund at Community Foundation Silicon Valley. 194More details are available at: 195.Pp 196http://caia.swin.edu.au/urp/newtcp/ 197.Sh AUTHORS 198.An -nosplit 199The 200.Nm 201facility was written by 202.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org , 203.An James Healy Aq Mt jimmy@deefa.com 204and 205.An David Hayes Aq Mt david.hayes@ieee.org . 206.Pp 207This manual page was written by 208.An David Hayes Aq Mt david.hayes@ieee.org 209and 210.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . 211