From owner-freebsd-net@FreeBSD.ORG Tue Jul 13 14:01:06 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 388C51065672 for ; Tue, 13 Jul 2010 14:01:06 +0000 (UTC) (envelope-from mdounin@mdounin.ru) Received: from mdounin.cust.ramtel.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mx1.freebsd.org (Postfix) with ESMTP id E12798FC16 for ; Tue, 13 Jul 2010 14:01:05 +0000 (UTC) Received: from mdounin.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mdounin.cust.ramtel.ru (Postfix) with ESMTP id F1D0417021; Tue, 13 Jul 2010 18:01:02 +0400 (MSD) Date: Tue, 13 Jul 2010 18:01:02 +0400 From: Maxim Dounin To: Igor Sysoev Message-ID: <20100713140051.GV99657@mdounin.ru> References: <20100512124702.GJ2679@rambler-co.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100512124702.GJ2679@rambler-co.ru> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-net@freebsd.org, andre@freebsd.org Subject: Re: net.inet.tcp.slowstart_flightsize in 8-STABLE X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2010 14:01:06 -0000 Hello! On Wed, May 12, 2010 at 04:47:02PM +0400, Igor Sysoev wrote: > It seems that net.inet.tcp.slowstart_flightsize does not work in 8-STABLE. > For a long time I used slowstart_flightsize=2 on FreeBSD 4, 6, and 7 hosts. > However, FreeBSD-8 always starts with the single packet. > I saw this on different versions of 8-STABLE since 8 Oct 2009 till > 04 Apr 2010. Finally I had some time to look into it (sorry for long delay). 1. Slow start isn't used on recent FreeBSD versions for initial snd_cwnd calculations as long as you have rfc3390 support switched on (default since Jan 06 23:29:46 2004, at least in 7.*). It effectively sets initial snd_cwnd to 3*MSS on common networks and shouldn't cause any problems. Slowstart_flightsize only affects connection restarts. 2. Due to bug in syncache code (patch below) all accepted connections has their snd_cwnd reset to 1*MSS (since r171639, 7.0+ AFAIR). 3. Support for rfc3465 introduced in r187289 uncovered (2) as ACK to SYN/ACK no longer causes snd_cwnd increase by MSS (actually, this increase shouldn't happen as it's explicitly forbidden by rfc 3390, but it's another issue). Snd_cwnd remains really small (1*MSS + 1) and this causes really bad interaction with delayed acks on other side. As a workaround to delayed acks interaction problems you may disable rfc3465 by setting net.inet.tcp.rfc3465 to 0. Correct fix would be to apply the patch below. To Andre Oppermann: could you please take a look at the patch and commit it if found appropriate? # HG changeset patch # User Maxim Dounin # Date 1279028684 -14400 # Node ID 93699203f408fa8e22c971769bde9c26bd14d410 # Parent e2cf8c51a6294a0d09d5628d96c6ab3ab626957e Fix cwnd resetting problem introduced in r171639. Sc_rxmits counts timer engagements, not actual retransmits, and value 1 corresponds to no retransmits. Revert check to correct one as present before r171639. diff --git a/netinet/tcp_syncache.c b/netinet/tcp_syncache.c --- a/netinet/tcp_syncache.c +++ b/netinet/tcp_syncache.c @@ -804,8 +804,10 @@ syncache_socket(struct syncache *sc, str /* * If the SYN,ACK was retransmitted, reset cwnd to 1 segment. + * Note that sc_rxmits counts timer engagements, not actual + * retransmits. */ - if (sc->sc_rxmits) + if (sc->sc_rxmits > 1) tp->snd_cwnd = tp->t_maxseg; tcp_timer_activate(tp, TT_KEEP, tcp_keepinit); Maxim Dounin