diff options
author | tuexen <tuexen@FreeBSD.org> | 2010-09-17 18:53:07 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2010-09-17 18:53:07 +0000 |
commit | 7b25487bee443fbdedc922982d86145a78dd5752 (patch) | |
tree | 24c1657427bb3240b933ccad4532bbc35e8dc8bf /sys/netinet/sctp_cc_functions.c | |
parent | 6397178431575de2cebaeac5bb0c05af09367120 (diff) | |
download | FreeBSD-src-7b25487bee443fbdedc922982d86145a78dd5752.zip FreeBSD-src-7b25487bee443fbdedc922982d86145a78dd5752.tar.gz |
Make the initial congestion window configurable via sysctl.
MFC after: 2 weeks.
Diffstat (limited to 'sys/netinet/sctp_cc_functions.c')
-rw-r--r-- | sys/netinet/sctp_cc_functions.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c index 8d2afc6..e40639b 100644 --- a/sys/netinet/sctp_cc_functions.c +++ b/sys/netinet/sctp_cc_functions.c @@ -44,18 +44,27 @@ #include <netinet/sctp_cc_functions.h> #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); + void sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) { + struct sctp_association *assoc; + uint32_t cwnd_in_mtu; + + assoc = &stcb->asoc; /* - * We take the max of the burst limit times a MTU or the - * INITIAL_CWND. We then limit this to 4 MTU's of sending. cwnd must - * be at least 2 MTU. + * We take the minimum of the burst limit and the initial congestion + * window. The initial congestion window is at least two times the + * MTU. */ - net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); - net->ssthresh = stcb->asoc.peers_rwnd; - - if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { + cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); + if ((assoc->max_burst > 0) && (cwnd_in_mtu > assoc->max_burst)) + cwnd_in_mtu = assoc->max_burst; + net->cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; + net->ssthresh = assoc->peers_rwnd; + + if (SCTP_BASE_SYSCTL(sctp_logging_level) & + (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); } } |