From owner-freebsd-net@FreeBSD.ORG Mon Aug 11 17:40:12 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 F11DB63B for ; Mon, 11 Aug 2014 17:40:12 +0000 (UTC) Received: from mail-la0-x22c.google.com (mail-la0-x22c.google.com [IPv6:2a00:1450:4010:c03::22c]) (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 7BE7B2894 for ; Mon, 11 Aug 2014 17:40:12 +0000 (UTC) Received: by mail-la0-f44.google.com with SMTP id el20so5997306lab.31 for ; Mon, 11 Aug 2014 10:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RZamDK5lZh0SAScR0GnwIVjH2CaYGmX1j+ZVFLF7eaw=; b=SfhOrz2wKnBvPqg3ZR9vnRv5ZmYKla19RXAFUndWKN2O3YIJRWOkjl2iiBsa0W6pDm 7OTGRQy6p6/1zOHiXH+cNMq7s+lrKbdXiUvXMZuLuV2O1DHRrE7JAHRxm5OtkZ6bWaRf y+HBTIGRJabY57MSGKMAtyKowmunp8JpQWqRQc0+Ra4jzPTW1UJUym9bZf684wEoYa34 YaZ1sxirSkQTWlArM7LyDBE9ZIyuvowN/fF0qJdGjlMHD1w9N7nCEdOjCQDmQRXhLA0O jKJ5SX/KMl9MKkSbsJ8JA6XPwKdemqYuq0zcLPh4r7Z6I2VcU3hB7b7OjlbUp4u2v+Bq 195Q== MIME-Version: 1.0 X-Received: by 10.112.166.200 with SMTP id zi8mr2601316lbb.102.1407778810279; Mon, 11 Aug 2014 10:40:10 -0700 (PDT) Received: by 10.114.81.73 with HTTP; Mon, 11 Aug 2014 10:40:10 -0700 (PDT) In-Reply-To: <53E8B424.2000904@cloudius-systems.com> References: <53E8B424.2000904@cloudius-systems.com> Date: Mon, 11 Aug 2014 10:40:10 -0700 Message-ID: Subject: Re: TCP Rx window auto sizing relies on TCP timestamp option? From: hiren panchasara To: Vlad Zolotarov Content-Type: text/plain; charset=UTF-8 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 17:40:13 -0000 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? cheers, Hiren