From owner-freebsd-transport@freebsd.org Wed Oct 21 01:32:02 2015 Return-Path: Delivered-To: freebsd-transport@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B90FA1977F for ; Wed, 21 Oct 2015 01:32:02 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 85D0B3D2 for ; Wed, 21 Oct 2015 01:32:02 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: by mailman.ysv.freebsd.org (Postfix) id 8568CA1977E; Wed, 21 Oct 2015 01:32:02 +0000 (UTC) Delivered-To: transport@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85042A1977D for ; Wed, 21 Oct 2015 01:32:02 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [65.19.130.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.strugglingcoder.info", Issuer "mail.strugglingcoder.info" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 75E5F3D1; Wed, 21 Oct 2015 01:32:02 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 9204A10A89C; Tue, 20 Oct 2015 18:32:01 -0700 (PDT) Date: Tue, 20 Oct 2015 18:32:01 -0700 From: hiren panchasara To: transport@FreeBSD.org Cc: rrs@FreeBSD.org Subject: Help me understand this SACK code in tcp_output() Message-ID: <20151021013201.GD28288@strugglingcoder.info> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="x4pBfXISqBoDm8sr" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: freebsd-transport@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions of transport level network protocols in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Oct 2015 01:32:02 -0000 --x4pBfXISqBoDm8sr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline tcp_output() starts out with following two vars set to zero: sack_rxmit = 0; sack_bytes_rxmt = 0; And if we are in recovery and trying to send from holes, i.e. if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags) && (p = tcp_sack_output(tp, &sack_bytes_rxmt))) { And if we end up with if (len > 0), we set sack_rxmit = 1; A little below is following code which I do not understand: /* If sack_rxmit is true we are retransmitting from the scoreboard * in which case len is already set. */ if (sack_rxmit == 0) { if (sack_bytes_rxmt == 0) ...... else { } } What I do not understand is how can we get into the 'else' part. AFAICT, sack_rxmit: when TRUE, we are retransmitting from the scoreboard sack_bytes_rxmt: number of retransmitted bytes from the scoreboard. Now, if sack_rxmit is false, how can sack_bytes_rxmt be > 0? OR is there something I am missing in the code OR how SACK works? Cheers, Hiren --x4pBfXISqBoDm8sr Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJWJusOXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/l+3QH/0edSDsmGh1SsXQg/TA6dQdg P0Sj6qMFTWtAwibmiDR0wbjZgxVGkXVXBRisN2eNHRIPeyil65K72cEF2W2Q5LUA PFaV5eQrc7ctGBbouQJcldm2gSS16OzAwwdJGRSy7TfeUsMvCRTHQI0AIN53pBRw Q7I2Tuzlh6txcmvHzkNCeSHbJprugPjHR8pEszOFG3njyHa3mNpkGW7OEvtNOmcO L6VIdu8PSPxMvR+33xhmC90qmHOs1PQoN6FiVdxWWEQKUOgtBvcBQpXUQUEe5l/k TXFFNdVzTHhdzMgAw1s8PQB6NuNdejR5etdPCXO8vo7AA553JIGydbIJG062pUo= =Q6gB -----END PGP SIGNATURE----- --x4pBfXISqBoDm8sr--