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