From owner-freebsd-net@FreeBSD.ORG  Thu Oct  9 22:56:40 2014
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 09F24E16
 for <freebsd-net@freebsd.org>; Thu,  9 Oct 2014 22:56:40 +0000 (UTC)
Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com
 [208.91.2.12])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C1B8D990
 for <freebsd-net@freebsd.org>; Thu,  9 Oct 2014 22:56:39 +0000 (UTC)
Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com
 [10.113.161.73])
 by smtp-outbound-1.vmware.com (Postfix) with ESMTP id B9B3898B20
 for <freebsd-net@freebsd.org>; Thu,  9 Oct 2014 15:47:38 -0700 (PDT)
Received: from EX13-CAS-003.vmware.com (EX13-CAS-003.vmware.com
 [10.113.191.53])
 by sc9-mailhost3.vmware.com (Postfix) with ESMTP id B4CD041666
 for <freebsd-net@freebsd.org>; Thu,  9 Oct 2014 15:47:38 -0700 (PDT)
Received: from EX13-MBX-003.vmware.com (10.113.191.23) by
 EX13-MBX-013.vmware.com (10.113.191.33) with Microsoft SMTP Server (TLS) id
 15.0.775.38; Thu, 9 Oct 2014 15:47:27 -0700
Received: from EX13-MBX-003.vmware.com ([fe80::8cf0:b7d5:ffd7:602d]) by
 EX13-MBX-003.vmware.com ([fe80::8cf0:b7d5:ffd7:602d%15]) with mapi id
 15.00.0775.031; Thu, 9 Oct 2014 15:47:27 -0700
From: Madhusudhan Ravi <mravi@vmware.com>
To: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject: TCP receive window management
Thread-Topic: TCP receive window management
Thread-Index: AQHP5BL/Sq2gqdLv0UCkeloj8ccyCw==
Date: Thu, 9 Oct 2014 22:47:27 +0000
Message-ID: <D05C5E8E.968D%mravi@vmware.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
user-agent: Microsoft-MacOutlook/14.3.9.131030
x-originating-ip: [10.113.160.246]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 09 Oct 2014 22:56:40 -0000

I have a question regarding the freeBSD receive window advertisement and up=
dating sender side flow control state based on this.

Is it expected that a retransmitted packet not carry an updated receive win=
dow?
The following are the state variables used for maintaining a peer's rcv win=
dow state on the sender side. snd_wnd, snd_wl1, snd_wl2. In tcp_input at th=
e label step6: where these states are updated there are checks which make s=
ure rcv window is not updated by old segments.

 if ((thflags & TH_ACK) &&
 (SEQ_LT(tp->snd_wl1, th->th_seq) ||
 (tp->snd_wl1 =3D=3D th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) ||
 (tp->snd_wl2 =3D=3D th->th_ack && tiwin > tp->snd_wnd))))) {

Based on the above checks for the case of a fast retransmitted packet that =
does ack additional data ((SEQ_LT(tp->snd_wl2, th->th_ack) is TRUE)  and ha=
s the latest rcv window. th_seq could be < snd_wl1 and in this case rcv win=
dow is not updated to the latest one. Is this intentional or is there somet=
hing that I am missing.

Thanks
Madhu