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 abe_frlossreduce" 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.El 106.Pp 107Each congestion control module may also expose other MIB variables 108to control their behaviour. 109.Sh Kernel Configuration 110.Pp 111All of the available congestion control modules may also be loaded 112via kernel configutation options. 113A kernel configuration is required to have at least one congestion control 114algorithm built into it via kernel option and a system default specified. 115Compilation of the kernel will fail if these two conditions are not met. 116.Sh Kernel Configuration Options 117The framework exposes the following kernel configuration options. 118.Bl -tag -width ".Va CC_NEWRENO" 119.It Va CC_NEWRENO 120This directive loads the newreno congestion control algorithm and is included 121in GENERIC by default. 122.It Va CC_CUBIC 123This directive loads the cubic congestion control algorithm. 124.It Va CC_VEGAS 125This directive loads the vegas congestion control algorithm, note that 126this algorithm also requires the TCP_HHOOK option as well. 127.It Va CC_CDG 128This directive loads the cdg congestion control algorithm, note that 129this algorithm also requires the TCP_HHOOK option as well. 130.It Va CC_DCTCP 131This directive loads the dctcp congestion control algorithm. 132.It Va CC_HD 133This directive loads the hd congestion control algorithm, note that 134this algorithm also requires the TCP_HHOOK option as well. 135.It Va CC_CHD 136This directive loads the chd congestion control algorithm, note that 137this algorithm also requires the TCP_HHOOK option as well. 138.It Va CC_HTCP 139This directive loads the htcp congestion control algorithm. 140.It Va CC_DEFAULT 141This directive specifies the string that represents the name of the system default algorithm, the GENERIC kernel 142defaults this to newreno. 143.El 144.Sh SEE ALSO 145.Xr cc_cdg 4 , 146.Xr cc_chd 4 , 147.Xr cc_cubic 4 , 148.Xr cc_dctcp 4 , 149.Xr cc_hd 4 , 150.Xr cc_htcp 4 , 151.Xr cc_newreno 4 , 152.Xr cc_vegas 4 , 153.Xr tcp 4 , 154.Xr config 5 , 155.Xr config 8 , 156.Xr mod_cc 9 157.Sh ACKNOWLEDGEMENTS 158Development and testing of this software were made possible in part by grants 159from the FreeBSD Foundation and Cisco University Research Program Fund at 160Community Foundation Silicon Valley. 161.Sh HISTORY 162The 163.Nm 164modular congestion control framework first appeared in 165.Fx 9.0 . 166.Pp 167The framework was first released in 2007 by James Healy and Lawrence Stewart 168whilst working on the NewTCP research project at Swinburne University of 169Technology's Centre for Advanced Internet Architectures, Melbourne, Australia, 170which was made possible in part by a grant from the Cisco University Research 171Program Fund at Community Foundation Silicon Valley. 172More details are available at: 173.Pp 174http://caia.swin.edu.au/urp/newtcp/ 175.Sh AUTHORS 176.An -nosplit 177The 178.Nm 179facility was written by 180.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org , 181.An James Healy Aq Mt jimmy@deefa.com 182and 183.An David Hayes Aq Mt david.hayes@ieee.org . 184.Pp 185This manual page was written by 186.An David Hayes Aq Mt david.hayes@ieee.org 187and 188.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . 189