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