From owner-freebsd-net@FreeBSD.ORG Sat May 4 11:25:33 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B9002342 for ; Sat, 4 May 2013 11:25:33 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 310F91185 for ; Sat, 4 May 2013 11:25:32 +0000 (UTC) Received: (qmail 22357 invoked from network); 4 May 2013 10:41:48 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 4 May 2013 10:41:48 -0000 Message-ID: <5184D724.2070703@freebsd.org> Date: Sat, 04 May 2013 11:38:44 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Aris Angelo Subject: Re: Calculation of inflight data References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 11:25:33 -0000 On 03.05.2013 09:28, Aris Angelo wrote: > Hi, > > I am trying to implement an extension to the FreeBSD TCP stack. In order to > do that, I have a question regarding the calculation of the "pipe" > variable, the amount of data that the sender calculates as being inflight. > I am puzzled for the case when no SACK is negotiated and used. > > My idea would be that in this case the following is correct (during a > partial ack): > > pipe = tp->snd_max - th->th_ack; Actually pipe would decrease by one MSS for every duplicate ACK received, though we can't be sure that it really represents a full MSS due to smaller segments being possible with TCP_NODELAY. > But when looking at the tcp_output code, I can see that the off variable, > which is used as pipe to determine later how much data to send ( len = > snd_cwnd- off); ), is calculated as: > > off = tp->snd_nxt - tp->snd_una; off specifies the offset to send from in the send socket buffer and is not equal to pipe. > Obviously snd_una is used since there is no info on tcp_output for the ack > header, but I think using more up to date information is better (although > less data would be injected to the network). > > But why is snd_nxt instead of snd_max used? In case of a partial ack, > snd_nxt is readjusted for retransmit, that means, that it's closer to > snd_una. What is your opinion, how should this variable be calculated? Unfortunately the pipe value isn't really calculated at the moment. -- Andre