From owner-svn-src-projects@FreeBSD.ORG Tue Dec 16 07:08:35 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 729991065675; Tue, 16 Dec 2008 07:08:35 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CED68FC18; Tue, 16 Dec 2008 07:08:35 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBG78Zch029679; Tue, 16 Dec 2008 07:08:35 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBG78Z65029677; Tue, 16 Dec 2008 07:08:35 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200812160708.mBG78Z65029677@svn.freebsd.org> From: Lawrence Stewart Date: Tue, 16 Dec 2008 07:08:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186171 - projects/tcp_ffcaia2008_8.x/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 07:08:35 -0000 Author: lstewart Date: Tue Dec 16 07:08:35 2008 New Revision: 186171 URL: http://svn.freebsd.org/changeset/base/186171 Log: More work on TCP ABC support. Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c ============================================================================== --- projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c Tue Dec 16 06:01:08 2008 (r186170) +++ projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c Tue Dec 16 07:08:35 2008 (r186171) @@ -137,7 +137,7 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet "Enable RFC 3465 (Appropriate Byte Counting)"); SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, abc_l_var, CTLFLAG_RW, tcp_abc_l_var, 1, - "Max # segments)"); + "Cap the max cwnd increment during slow-start to this number of segments"); int tcp_do_ecn = 0; int tcp_ecn_maxretries = 1; @@ -2111,23 +2111,53 @@ process_ACK: /* * When new data is acked, open the congestion window. - * If the window gives us less than ssthresh packets - * in flight, open exponentially (maxseg per packet). - * Otherwise open linearly: maxseg per window - * (maxseg^2 / cwnd per packet). - * If cwnd > maxseg^2, fix the cwnd increment at 1 byte - * to avoid capping cwnd (as suggested in RFC2581). + * Method depends on which congestion control state we're + * in (slow start or cong avoid) and if ABC (RFC 3465) is + * enabled. + * + * slow start: cwnd <= ssthresh + * cong avoid: cwnd > ssthresh + * + * slow start and ABC (RFC 3465): + * Grow cwnd exponentially by the amount of data + * ACKed capping the max increment per ACK to + * (abc_l_var * maxseg) bytes. + * + * slow start without ABC (RFC 2581): + * Grow cwnd exponentially by maxseg per ACK. + * + * cong avoid and ABC (RFC 3465): + * Grow cwnd linearly by maxseg per RTT for each + * cwnd worth of ACKed data. + * + * cong avoid without ABC (RFC 2581): + * Grow cwnd linearly by approximately maxseg per RTT using + * maxseg^2 / cwnd per ACK as the increment. + * If cwnd > maxseg^2, fix the cwnd increment at 1 byte to + * avoid capping cwnd (as suggested in RFC 2581). */ if ((!V_tcp_do_newreno && !(tp->t_flags & TF_SACK_PERMIT)) || !IN_FASTRECOVERY(tp)) { u_int cw = tp->snd_cwnd; u_int incr = tp->t_maxseg; - if (V_tcp_do_rfc3465) + /* In congestion avoidance? */ + if (cw > tp->snd_ssthresh) { + if (V_tcp_do_rfc3465) { + tp->t_bytes_acked += acked; + if (tp->t_bytes_acked >= tp->snd_cwnd) + tp->t_bytes_acked -= cw; + else + incr = 0; + } + else + incr = max((incr * incr / cw), 1); + /* In slow-start with ABC enabled? */ + } else if (V_tcp_do_rfc3465) incr = min(acked, V_tcp_abc_l_var * tp->t_maxseg); - else if (cw > tp->snd_ssthresh) - incr = max((incr * incr / cw), 1); - tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<snd_scale); + /* ABC is on by default, so (incr == 0) frequently. */ + if (incr > 0) + tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<snd_scale); } SOCKBUF_LOCK(&so->so_snd); if (acked > so->so_snd.sb_cc) { Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h ============================================================================== --- projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h Tue Dec 16 06:01:08 2008 (r186170) +++ projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h Tue Dec 16 07:08:35 2008 (r186171) @@ -213,6 +213,7 @@ struct tcpcb { void *t_pspare[3]; /* toe usrreqs / toepcb * / congestion algo / vimage / 1 general use */ struct toe_usrreqs *t_tu; /* offload operations vector */ void *t_toe; /* TOE pcb pointer */ + int t_bytes_acked; /* # bytes acked during current RTT */ }; #define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY)