FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include <opt_cc.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/libkern.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/rwlock.h>
#include <sys/sbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/tcp.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp_log_buf.h>
#include <netinet/tcp_hpts.h>
#include <netinet/cc/cc.h>
#include <netinet/cc/cc_module.h>
Go to the source code of this file.
Macros | |
#define | CC_DEFAULT "newreno" |
#define | V_newreno_beta VNET(newreno_beta) |
Functions | |
__FBSDID ("$FreeBSD$") | |
MALLOC_DEFINE (M_CC_MEM, "CC Mem", "Congestion Control State memory") | |
VNET_DEFINE (struct cc_algo *, default_cc_ptr) | |
VNET_DEFINE (uint32_t, newreno_beta) | |
void | cc_refer (struct cc_algo *algo) |
void | cc_release (struct cc_algo *algo) |
void | cc_attach (struct tcpcb *tp, struct cc_algo *algo) |
void | cc_detach (struct tcpcb *tp) |
static int | cc_default_algo (SYSCTL_HANDLER_ARGS) |
static int | cc_list_available (SYSCTL_HANDLER_ARGS) |
static int | cc_check_default (struct cc_algo *remove_cc) |
static void | cc_init (void) |
int | cc_deregister_algo (struct cc_algo *remove_cc) |
int | cc_register_algo (struct cc_algo *add_cc) |
static void | vnet_cc_sysinit (void *arg) |
VNET_SYSINIT (vnet_cc_sysinit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, vnet_cc_sysinit, NULL) | |
void | newreno_cc_post_recovery (struct cc_var *ccv) |
void | newreno_cc_after_idle (struct cc_var *ccv) |
void | newreno_cc_cong_signal (struct cc_var *ccv, uint32_t type) |
void | newreno_cc_ack_received (struct cc_var *ccv, uint16_t type) |
static int | cc_stop_new_assignments (struct cc_algo *algo) |
int | cc_modevent (module_t mod, int event_type, void *data) |
SYSINIT (cc, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, cc_init, NULL) | |
SYSCTL_NODE (_net_inet_tcp, OID_AUTO, cc, CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, "Congestion control related settings") | |
SYSCTL_PROC (_net_inet_tcp_cc, OID_AUTO, algorithm, CTLFLAG_VNET|CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, 0, cc_default_algo, "A", "Default congestion control algorithm") | |
SYSCTL_PROC (_net_inet_tcp_cc, OID_AUTO, available, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, cc_list_available, "A", "List available congestion control algorithms") | |
SYSCTL_NODE (_net_inet_tcp_cc, OID_AUTO, hystartplusplus, CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, "New Reno related HyStart++ settings") | |
SYSCTL_UINT (_net_inet_tcp_cc_hystartplusplus, OID_AUTO, minrtt_thresh, CTLFLAG_RW, &hystart_minrtt_thresh, 4000, "HyStarts++ minimum RTT thresh used in clamp (in microseconds)") | |
SYSCTL_UINT (_net_inet_tcp_cc_hystartplusplus, OID_AUTO, maxrtt_thresh, CTLFLAG_RW, &hystart_maxrtt_thresh, 16000, "HyStarts++ maximum RTT thresh used in clamp (in microseconds)") | |
SYSCTL_UINT (_net_inet_tcp_cc_hystartplusplus, OID_AUTO, n_rttsamples, CTLFLAG_RW, &hystart_n_rttsamples, 8, "The number of RTT samples that must be seen to consider HyStart++") | |
SYSCTL_UINT (_net_inet_tcp_cc_hystartplusplus, OID_AUTO, css_growth_div, CTLFLAG_RW, &hystart_css_growth_div, 4, "The divisor to the growth when in Hystart++ CSS") | |
SYSCTL_UINT (_net_inet_tcp_cc_hystartplusplus, OID_AUTO, css_rounds, CTLFLAG_RW, &hystart_css_rounds, 5, "The number of rounds HyStart++ lasts in CSS before falling to CA") | |
SYSCTL_UINT (_net_inet_tcp_cc_hystartplusplus, OID_AUTO, bblogs, CTLFLAG_RW, &hystart_bblogs, 0, "Do we enable HyStart++ Black Box logs to be generated if BB logging is on") | |
VNET_DEFINE (int, cc_do_abe)=0 | |
SYSCTL_INT (_net_inet_tcp_cc, OID_AUTO, abe, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(cc_do_abe), 0, "Enable draft-ietf-tcpm-alternativebackoff-ecn (TCP Alternative Backoff with ECN)") | |
VNET_DEFINE (int, cc_abe_frlossreduce)=0 | |
SYSCTL_INT (_net_inet_tcp_cc, OID_AUTO, abe_frlossreduce, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(cc_abe_frlossreduce), 0, "Apply standard beta instead of ABE-beta during ECN-signalled congestion " "recovery episodes if loss also needs to be repaired") | |
Variables | |
uint32_t | hystart_minrtt_thresh = 4000 |
uint32_t | hystart_maxrtt_thresh = 16000 |
uint32_t | hystart_n_rttsamples = 8 |
uint32_t | hystart_css_growth_div = 4 |
uint32_t | hystart_css_rounds = 5 |
uint32_t | hystart_bblogs = 0 |
struct cc_head | cc_list = STAILQ_HEAD_INITIALIZER(cc_list) |
struct rwlock | cc_list_lock |
__FBSDID | ( | "$FreeBSD$" | ) |
Definition at line 126 of file cc.c.
References CC_ALGO, CC_LIST_RLOCK, CC_LIST_RUNLOCK, and cc_refer().
Referenced by tcp_newtcpcb(), and tcp_set_cc_mod().
|
static |
Definition at line 248 of file cc.c.
References CC_DEFAULT_ALGO, CC_LIST_LOCK_ASSERT, and cc_algo::name.
Referenced by cc_deregister_algo(), cc_modevent(), and cc_stop_new_assignments().
|
static |
Definition at line 153 of file cc.c.
References CC_DEFAULT_ALGO, cc_list, CC_LIST_RLOCK, CC_LIST_RUNLOCK, CC_MODULE_BEING_REMOVED, cc_algo::flags, cc_algo::name, and V_default_cc_ptr.
int cc_deregister_algo | ( | struct cc_algo * | remove_cc | ) |
Definition at line 284 of file cc.c.
References cc_check_default(), cc_list, CC_LIST_WLOCK, CC_LIST_WUNLOCK, CC_MODULE_BEING_REMOVED, cc_algo::cc_refcount, and cc_algo::flags.
Referenced by cc_modevent().
void cc_detach | ( | struct tcpcb * | tp | ) |
Definition at line 138 of file cc.c.
References CC_ALGO, CC_LIST_RLOCK, CC_LIST_RUNLOCK, and cc_release().
Referenced by tcp_discardcb(), tcp_newtcpcb(), and tcp_set_cc_mod().
|
static |
Definition at line 274 of file cc.c.
References cc_list, and CC_LIST_LOCK_INIT.
|
static |
Definition at line 196 of file cc.c.
References CC_DEFAULT_ALGO, cc_list, CC_LIST_RLOCK, CC_LIST_RUNLOCK, cc_algo::cc_refcount, and cc_algo::name.
int cc_modevent | ( | module_t | mod, |
int | event_type, | ||
void * | data | ||
) |
Definition at line 585 of file cc.c.
References cc_algo::cb_init, cc_check_default(), cc_algo::cc_data_sz, cc_deregister_algo(), CC_LIST_WLOCK, CC_LIST_WUNLOCK, cc_register_algo(), cc_stop_new_assignments(), cc_algo::mod_destroy, and cc_algo::mod_init.
void cc_refer | ( | struct cc_algo * | algo | ) |
Definition at line 111 of file cc.c.
References CC_LIST_LOCK_ASSERT, and cc_algo::cc_refcount.
Referenced by cc_attach(), and tcp_set_cc_mod().
int cc_register_algo | ( | struct cc_algo * | add_cc | ) |
Definition at line 322 of file cc.c.
References CC_DEFAULT, cc_list, CC_LIST_WLOCK, CC_LIST_WUNLOCK, cc_algo::cc_refcount, cc_algo::name, and V_default_cc_ptr.
Referenced by cc_modevent().
void cc_release | ( | struct cc_algo * | algo | ) |
Definition at line 118 of file cc.c.
References CC_LIST_LOCK_ASSERT, and cc_algo::cc_refcount.
Referenced by cc_detach(), and tcp_set_cc_mod().
|
static |
Definition at line 568 of file cc.c.
References cc_check_default(), CC_LIST_WLOCK, CC_LIST_WUNLOCK, CC_MODULE_BEING_REMOVED, and cc_algo::flags.
Referenced by cc_modevent().
MALLOC_DEFINE | ( | M_CC_MEM | , |
"CC Mem" | , | ||
"Congestion Control State memory" | |||
) |
Definition at line 493 of file cc.c.
References cc_var::bytes_this_ack, CC_ACK, CCF_ABC_SENTAWND, CCF_CWND_LIMITED, CCF_USE_LOCAL_ABC, CCV, cc_var::flags, IN_RECOVERY, cc_var::labc, cc_var::nsegs, V_tcp_abc_l_var, and V_tcp_do_rfc3465.
Referenced by dctcp_ack_received(), hd_ack_received(), htcp_ack_received(), and vegas_ack_received().
void newreno_cc_after_idle | ( | struct cc_var * | ccv | ) |
Definition at line 415 of file cc.c.
References CCV, cc_var::ccvc, cc_var::ccv_container::tcp, tcp_compute_initwnd(), and tcp_maxseg().
Referenced by cubic_after_idle(), dctcp_after_idle(), and newreno_after_idle().
Definition at line 447 of file cc.c.
References CC_ECN, CC_NDUPACK, CC_RTO, CC_SIGPRIVMASK, CCV, cc_var::ccvc, ENTER_CONGRECOVERY, ENTER_RECOVERY, IN_CONGRECOVERY, IN_FASTRECOVERY, cc_var::ccv_container::tcp, tcp_fixed_maxseg(), and V_newreno_beta.
Referenced by cdg_cong_signal(), chd_cong_signal(), dctcp_cong_signal(), hd_ack_received(), and vegas_cong_signal().
void newreno_cc_post_recovery | ( | struct cc_var * | ccv | ) |
Definition at line 384 of file cc.c.
References CCV, cc_var::ccvc, cc_var::curack, IN_FASTRECOVERY, cc_var::ccv_container::tcp, tcp_compute_pipe(), and V_tcp_do_newsack.
Referenced by dctcp_post_recovery().
SYSCTL_INT | ( | _net_inet_tcp_cc | , |
OID_AUTO | , | ||
abe | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEcc_do_abe, | ||
0 | , | ||
"Enable draft-ietf-tcpm-alternativebackoff-ecn (TCP Alternative Backoff with ECN)" | |||
) |
SYSCTL_INT | ( | _net_inet_tcp_cc | , |
OID_AUTO | , | ||
abe_frlossreduce | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEcc_abe_frlossreduce, | ||
0 | , | ||
"Apply standard beta instead of ABE-beta during ECN-signalled congestion " "recovery episodes if loss also needs to be repaired" | |||
) |
SYSCTL_NODE | ( | _net_inet_tcp | , |
OID_AUTO | , | ||
cc | , | ||
CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
"Congestion control related settings" | |||
) |
SYSCTL_NODE | ( | _net_inet_tcp_cc | , |
OID_AUTO | , | ||
hystartplusplus | , | ||
CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
"New Reno related HyStart++ settings" | |||
) |
SYSCTL_PROC | ( | _net_inet_tcp_cc | , |
OID_AUTO | , | ||
algorithm | , | ||
CTLFLAG_VNET|CTLTYPE_STRING|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
cc_default_algo | , | ||
"A" | , | ||
"Default congestion control algorithm" | |||
) |
SYSCTL_PROC | ( | _net_inet_tcp_cc | , |
OID_AUTO | , | ||
available | , | ||
CTLTYPE_STRING|CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
cc_list_available | , | ||
"A" | , | ||
"List available congestion control algorithms" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_hystartplusplus | , |
OID_AUTO | , | ||
bblogs | , | ||
CTLFLAG_RW | , | ||
& | hystart_bblogs, | ||
0 | , | ||
"Do we enable HyStart++ Black Box logs to be generated if BB logging is on" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_hystartplusplus | , |
OID_AUTO | , | ||
css_growth_div | , | ||
CTLFLAG_RW | , | ||
& | hystart_css_growth_div, | ||
4 | , | ||
"The divisor to the growth when in Hystart++ CSS" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_hystartplusplus | , |
OID_AUTO | , | ||
css_rounds | , | ||
CTLFLAG_RW | , | ||
& | hystart_css_rounds, | ||
5 | , | ||
"The number of rounds HyStart++ lasts in CSS before falling to CA" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_hystartplusplus | , |
OID_AUTO | , | ||
maxrtt_thresh | , | ||
CTLFLAG_RW | , | ||
& | hystart_maxrtt_thresh, | ||
16000 | , | ||
"HyStarts++ maximum RTT thresh used in clamp (in microseconds)" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_hystartplusplus | , |
OID_AUTO | , | ||
minrtt_thresh | , | ||
CTLFLAG_RW | , | ||
& | hystart_minrtt_thresh, | ||
4000 | , | ||
"HyStarts++ minimum RTT thresh used in clamp (in microseconds)" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_hystartplusplus | , |
OID_AUTO | , | ||
n_rttsamples | , | ||
CTLFLAG_RW | , | ||
& | hystart_n_rttsamples, | ||
8 | , | ||
"The number of RTT samples that must be seen to consider HyStart++" | |||
) |
SYSINIT | ( | cc | , |
SI_SUB_PROTO_IFATTACHDOMAIN | , | ||
SI_ORDER_FIRST | , | ||
cc_init | , | ||
NULL | |||
) |
|
static |
Definition at line 364 of file cc.c.
References V_default_cc_ptr.
|
pure virtual |
|
pure virtual |
VNET_DEFINE | ( | struct cc_algo * | , |
default_cc_ptr | |||
) |
VNET_DEFINE | ( | uint32_t | , |
newreno_beta | |||
) |
VNET_SYSINIT | ( | vnet_cc_sysinit | , |
SI_SUB_PROTO_IFATTACHDOMAIN | , | ||
SI_ORDER_ANY | , | ||
vnet_cc_sysinit | , | ||
NULL | |||
) |
struct cc_head cc_list = STAILQ_HEAD_INITIALIZER(cc_list) |
Definition at line 100 of file cc.c.
Referenced by cc_default_algo(), cc_deregister_algo(), cc_init(), cc_list_available(), cc_register_algo(), and tcp_set_cc_mod().
uint32_t hystart_bblogs = 0 |
Definition at line 92 of file cc.c.
Referenced by cubic_log_hystart_event(), and newreno_log_hystart_event().
uint32_t hystart_css_growth_div = 4 |
Definition at line 90 of file cc.c.
Referenced by cubic_does_slow_start(), and newreno_ack_received().
uint32_t hystart_css_rounds = 5 |
Definition at line 91 of file cc.c.
Referenced by cubic_newround(), and newreno_newround().
uint32_t hystart_maxrtt_thresh = 16000 |
Definition at line 88 of file cc.c.
Referenced by cubic_does_slow_start(), and newreno_ack_received().
uint32_t hystart_minrtt_thresh = 4000 |
Definition at line 87 of file cc.c.
Referenced by cubic_does_slow_start(), and newreno_ack_received().
uint32_t hystart_n_rttsamples = 8 |
Definition at line 89 of file cc.c.
Referenced by cubic_does_slow_start(), cubic_rttsample(), newreno_ack_received(), and newreno_rttsample().