From owner-freebsd-net@FreeBSD.ORG Mon Aug 11 18:41:25 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 483B261C for ; Mon, 11 Aug 2014 18:41:25 +0000 (UTC) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D23D521EC for ; Mon, 11 Aug 2014 18:41:24 +0000 (UTC) Received: by mail-we0-f171.google.com with SMTP id p10so9116058wes.2 for ; Mon, 11 Aug 2014 11:41:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=mocSbU7uDg/nKOVerPnLfyqIRTWoaN/hV6D2hUFshmI=; b=UExUdEZu9MfGBzT7U4Q0Fgd9wzV5dxq7BdJZMbYyZKAO3v2GGn646vMTcnGtN2CF6Z ALfTDBcdxzfuencLR5sXqPNKv93eZSjCIMvaMu41N4hgMJ+XiIAkOOSw9uyHVtVxBUqX 3KuEELorahjRthU1wSSkc7XnhSerQ72NpBBjqhIMko0K/+I0aLog/Y+Q90nTFCi9tz/C xXPPyWhPfYed2+XjVHeXhV4ikUErb1MCZrFHTs3cA1y9/6AwlWWmdqGAmLKPI9lB1RDm SrVf0gZYfyo3FiHxGONK5HsdQeq22rlPOPd7FplOWjeD2OChRpJw2I8oWKlUij473zYt Fmrw== X-Gm-Message-State: ALoCoQlLAdmKIFNut87x1gRoJBaDUoA0X7n78qsCAfHRSKkuPn17agwZ6izHFScTMnzMHydKCW7y MIME-Version: 1.0 X-Received: by 10.194.8.35 with SMTP id o3mr55769500wja.3.1407782481964; Mon, 11 Aug 2014 11:41:21 -0700 (PDT) Received: by 10.194.88.66 with HTTP; Mon, 11 Aug 2014 11:41:21 -0700 (PDT) Received: by 10.194.88.66 with HTTP; Mon, 11 Aug 2014 11:41:21 -0700 (PDT) In-Reply-To: References: <53E8B424.2000904@cloudius-systems.com> Date: Mon, 11 Aug 2014 21:41:21 +0300 Message-ID: Subject: Re: TCP Rx window auto sizing relies on TCP timestamp option? From: Vladislav Zolotarov To: hiren panchasara Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 18:41:25 -0000 On Aug 11, 2014 8:40 PM, "hiren panchasara" wrote: > > On Mon, Aug 11, 2014 at 5:16 AM, Vlad Zolotarov > wrote: > > Hi, I have the most strange question about the TCP Rx window auto sizing > > implementation in a FreeBSD networking stack. > > When I looked at the FreeBSD code (hash > > 9abce0e567c9a5a0520cdd94d5c633c7baf9a184) I noticed that > > the mentioned above feature will not be "enabled" if there isn't a TCP > > timestamp option present in the current TCP session: > > > > See sys/netinet/tcp_input.c: line 1813 in tcp_do_segment() function: > > > > if (V_tcp_do_autorcvbuf && > > *to.to_tsecr* && <-------- this is what I'm > > talking about > > (so->so_rcv.sb_flags & SB_AUTOSIZE)) > > > > So, if i read the code correctly, if there isn't a TS option (negotiated and > > thus present in every received packet) the receive socket buffer won't grow > > thus preventing the growth of the Rx window. > > If that's the case this is very strange since TS option is not promised and > > even more - in many cases it won't be present. > > For example in Linux this feature is disabled by default (controlled by > > /proc/sys/net/ipv4/tcp_timestamps). > > This is how I actually noticed the problem the first place: I ran iperf test > > where Linux was an initiator and a transmitter (iperf -c) FreeBSD box was a > > receiver (iperf -s) and I noticed that the Rx window wasn't opening up > > because Linux box hasn't negotiated the TS option in the SYN. As a result, > > the throughput numbers were significantly lower compared to Linux-to-Linux > > setup (Linux uses a Dynamic Right-Sizing (DRS) algorithm > > http://public.lanl.gov/radiant/pubs.html#DRS, which doesn't rely on TS). > > > > Could anybody comment on this, pls.? > > Did I miss anything? > > Is it true that FreeBSD assumes that TS option is always present and if not > > how can I cause an Rx Window to open up when TS option hasn't been > > negotiated? > > In my limited understanding, we (FreeBSD) want to base Rx window size > increase on accurate RTT which is not possible if TS option is not > negotiated. And that's why this requirement. > > Do you know how does it work in Linux? Linux uses an algorithm mentioned above for estimating the RTT and that algorithm doesn't require a TS. They use a TS if it is present though. > > cheers, > Hiren