summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_cc_functions.c
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2010-12-22 19:04:14 +0000
committertuexen <tuexen@FreeBSD.org>2010-12-22 19:04:14 +0000
commit0826d29a2d8e53cc3f8de837cc3646c464f5cd20 (patch)
tree9c25fb3791f1ee5c0580c783b9635aec84319691 /sys/netinet/sctp_cc_functions.c
parent74fe88a37c5c61c7306bdbd9e13ee54a060b18c4 (diff)
downloadFreeBSD-src-0826d29a2d8e53cc3f8de837cc3646c464f5cd20.zip
FreeBSD-src-0826d29a2d8e53cc3f8de837cc3646c464f5cd20.tar.gz
Provide a possibility to configure the inital congestion window to the
value defined in RFC 4960. MFC after: 3 months.
Diffstat (limited to 'sys/netinet/sctp_cc_functions.c')
-rw-r--r--sys/netinet/sctp_cc_functions.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c
index c7a2415..fc8811b 100644
--- a/sys/netinet/sctp_cc_functions.c
+++ b/sys/netinet/sctp_cc_functions.c
@@ -53,15 +53,19 @@ sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net)
uint32_t cwnd_in_mtu;
assoc = &stcb->asoc;
- /*
- * We take the minimum of the burst limit and the initial congestion
- * window. The initial congestion window is at least two times the
- * MTU.
- */
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;
+ if (cwnd_in_mtu == 0) {
+ /* Using 0 means that the value of RFC 4960 is used. */
+ net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND));
+ } else {
+ /*
+ * We take the minimum of the burst limit and the initial
+ * congestion window.
+ */
+ 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;
SDT_PROBE(sctp, cwnd, net, init,
OpenPOWER on IntegriCloud