From owner-svn-src-head@FreeBSD.ORG Fri Sep 17 18:53:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AE46106564A; Fri, 17 Sep 2010 18:53:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED5F48FC16; Fri, 17 Sep 2010 18:53:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8HIr7fb038696; Fri, 17 Sep 2010 18:53:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8HIr7a2038692; Fri, 17 Sep 2010 18:53:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201009171853.o8HIr7a2038692@svn.freebsd.org> From: Michael Tuexen Date: Fri, 17 Sep 2010 18:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212800 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2010 18:53:08 -0000 Author: tuexen Date: Fri Sep 17 18:53:07 2010 New Revision: 212800 URL: http://svn.freebsd.org/changeset/base/212800 Log: Make the initial congestion window configurable via sysctl. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_cc_functions.c ============================================================================== --- head/sys/netinet/sctp_cc_functions.c Fri Sep 17 16:20:29 2010 (r212799) +++ head/sys/netinet/sctp_cc_functions.c Fri Sep 17 18:53:07 2010 (r212800) @@ -44,18 +44,27 @@ #include #include __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; + 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)) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & + (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); } } Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Fri Sep 17 16:20:29 2010 (r212799) +++ head/sys/netinet/sctp_sysctl.c Fri Sep 17 18:53:07 2010 (r212800) @@ -110,6 +110,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT; SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT; + SCTP_BASE_SYSCTL(sctp_initial_cwnd) = SCTPCTL_INITIAL_CWND_DEFAULT; #if defined(SCTP_LOCAL_TRACE_BUF) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif @@ -622,6 +623,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX); + RANGECHK(SCTP_BASE_SYSCTL(sctp_initial_cwnd), SCTPCTL_INITIAL_CWND_MIN, SCTPCTL_INITIAL_CWND_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX); @@ -1072,6 +1074,10 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, bu &SCTP_BASE_SYSCTL(sctp_buffer_splitting), 0, sysctl_sctp_check, "IU", SCTPCTL_BUFFER_SPLITTING_DESC); +SYSCTL_PROC(_net_inet_sctp, OID_AUTO, initial_cwnd, CTLTYPE_INT | CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_initial_cwnd), 0, sysctl_sctp_check, "IU", + SCTPCTL_INITIAL_CWND_DESC); + #ifdef SCTP_DEBUG SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU", Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Fri Sep 17 16:20:29 2010 (r212799) +++ head/sys/netinet/sctp_sysctl.h Fri Sep 17 18:53:07 2010 (r212800) @@ -108,6 +108,7 @@ struct sctp_sysctl { uint32_t sctp_enable_sack_immediately; uint32_t sctp_vtag_time_wait; uint32_t sctp_buffer_splitting; + uint32_t sctp_initial_cwnd; #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif @@ -497,6 +498,12 @@ struct sctp_sysctl { #define SCTPCTL_BUFFER_SPLITTING_MAX 0x3 #define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN +/* Initial congestion window in MTU */ +#define SCTPCTL_INITIAL_CWND_DESC "Initial congestion window in MTU" +#define SCTPCTL_INITIAL_CWND_MIN 2 +#define SCTPCTL_INITIAL_CWND_MAX 0xffffffff +#define SCTPCTL_INITIAL_CWND_DEFAULT 3 + #if defined(SCTP_DEBUG) /* debug: Configure debug output */ #define SCTPCTL_DEBUG_DESC "Configure debug output"