From owner-freebsd-transport@freebsd.org Wed Oct 7 16:18:24 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 2E2D39D1C48 for ; Wed, 7 Oct 2015 16:18:24 +0000 (UTC) (envelope-from rrs@netflix.com) 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 08167F28 for ; Wed, 7 Oct 2015 16:18:24 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mailman.ysv.freebsd.org (Postfix) id 04F3C9D1C47; Wed, 7 Oct 2015 16:18:24 +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 DEAA79D1C46 for ; Wed, 7 Oct 2015 16:18:23 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-pa0-x229.google.com (mail-pa0-x229.google.com [IPv6:2607:f8b0:400e:c03::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC4D3F26 for ; Wed, 7 Oct 2015 16:18:23 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by pablk4 with SMTP id lk4so25593653pab.3 for ; Wed, 07 Oct 2015 09:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=from:content-type:subject:message-id:date:to:mime-version; bh=8wwMeOdk6UnlowtIWsUrXwbHSy8B78AkOExV9y504lE=; b=I4a5KPLPaRNC2z2F91jmgiCLNigsoD/WxXa3EGNg4PVZdRzsaKnewuOyEs1n//Zw9c f5JLTHukxZ3Wfuol62eb5AYoCU5J3iUQc/bhIuIx8k/lsdf2eJqfmwXjPX6M9cON9Yww xr4mV33PdWhoql5HcnJtJGRUwY19v+e3yNZ5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:subject:message-id:date:to :mime-version; bh=8wwMeOdk6UnlowtIWsUrXwbHSy8B78AkOExV9y504lE=; b=mo0DdC1ZbgQ0Xwq9+7yL2O0MDYdjvQcEmvMr2qPP0f/pKyibBdHr+VkdsEddVb+u/f ss4MscurJKTSKOVZ8a3ClV++fzE3KeXJl9bchWNy9Ml5R6jUHiXp0zcHzQQgJLEQs0Sf 2VL17p/JXSxn3GOhZLAtrY5T9+PVuG+3sKxvSj1lsC0fGx6OlA5N7aeTlFIShNyRpEnE kDDmn+HOVrrMs6KV6o+j6ufL9F+Bq/nAPdtWJVJ+KF+726/KcMQbOohKBNhff7YIGvji MOuSYgtRXM9VOzNRhjUU2fpCMxy+7tZCo58fYMB/0yXpMR+b1/LWObNrRiTHLQ2NLbYp ijPQ== X-Gm-Message-State: ALoCoQm1iZQ7H1zfnDZQx/CDe8yLZiG24JhoJuZ+C6LFozSltyOxRy70f5ruun6rJT1mToeKSfZe X-Received: by 10.69.26.5 with SMTP id iu5mr2065551pbd.12.1444234703144; Wed, 07 Oct 2015 09:18:23 -0700 (PDT) Received: from [192.168.120.14] ([69.53.245.112]) by smtp.gmail.com with ESMTPSA id ql7sm40354502pbc.45.2015.10.07.09.18.20 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Oct 2015 09:18:21 -0700 (PDT) From: Randall Stewart Subject: The trouble with sack.. Message-Id: Date: Wed, 7 Oct 2015 12:17:40 -0400 To: FreeBSD Transports Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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, 07 Oct 2015 16:18:24 -0000 Greetings all: Hiren and I have been poking a little bit with the TCP-Sack = implementation in FreeBSD and I think we have pretty much determined its sub-optimal to = phrase it nicely :-) All the sack-scoreboard stuff works, but what we do with the scoreboard = and how we handle SACKs really does not match what the TCP RFC=92s say we = should. Here are a few of examples (there are probably more that we will yet = discover): 1) When we finally recognize its time to Fast Retransmit we shut the = cwnd to 1MTU. The SACK RFC=92s tell us to go to 1/2 of the pervious cwnd (which is = also stored in ssthresh). 2) When we recognize a dup-ack we *will not* recognize it if for example = if the rwnd changes even if new SACK information is reported in the sack blocks. This is due = to the fact that in non-SACK you don=92t (on purpose) recognize ACK=92s where the window changed (since you = can=92t really tell if its a plain window update or a dup-ack).. This means we occasionally miss = out on stroking the dup-ack counter and getting out of recovery.... 3) When we have more than one hole the goal of SACK was to retransmit = every time that a hole had 3 dup-acks so that one could recover multiple blocks that = were lost. We just plain don=92t track dup-acks per hole. We do continue to count, but = we will wait to retransmit anything until after we have drained 1/2 the data in flight from the = network at a minimum. And only then do we start incrementing cwnd (remember we crashed it to 1 MTU) so = that we can retransmit. There may be some other twists in the code that we are missing but this is = what we believe (this could could probably win the C obfuscation contest if someone were willing to = enter it :-D) 4) The way we calculate what is in flight with SACK is wrong, basically = we don=92t arrive at whats really in flight, which with SACK you can know if you have a = properly maintained=20 scoreboard (which we do have). Hiren and I have a few ideas on how to fix some of these, but I think we = may want to discuss first what Gleb talked about doing at BSD-Canada, at least so I am = told, which is to have each inpcb have a set of function pointers so we can create =93new=94= versions of say tcp_do_segment and tcp_output.. without changing original ones.. This way, has we develop fixes and improvements, we can keep the old = code in place without disrupting everyone and then after everyone has vetted and played with = the =93new=94 code we can switch things out :-) By the way just looking around at NF and doing some quick survery=92s of = SACK, about 99% of NF connections seem to have sack enabled, so its pretty much widely = deployed now.. and its rare we are *not* using the SACK cases in our TCP stack.. Best wishes R -------- Randall Stewart rrs@netflix.com 803-317-4952