From patchwork Wed Aug 22 21:43:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kevin(Yudong) Yang" X-Patchwork-Id: 961081 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="IofoLyK0"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41wgyr0LFhz9s4V for ; Thu, 23 Aug 2018 07:43:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728106AbeHWBKF (ORCPT ); Wed, 22 Aug 2018 21:10:05 -0400 Received: from mail-qt0-f201.google.com ([209.85.216.201]:51478 "EHLO mail-qt0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbeHWBKE (ORCPT ); Wed, 22 Aug 2018 21:10:04 -0400 Received: by mail-qt0-f201.google.com with SMTP id u13-v6so2791765qtb.18 for ; Wed, 22 Aug 2018 14:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=nWnKy8YRBVBBKYhwn9ESauQOjvPFjjHabimGAYJv/To=; b=IofoLyK0rq0RZmtFi7Jmz45CxzpgF3eG8WQuVBJuXjSCKT0oXEP1tiaz7J7D9XAhNV EEV5NFXhQ8PR0pm8qsbgNXkbdy9a31vkid0jiUD5h6jpb5vaHjI6F0fgDvTmh9gnkeFY +clO0iBdzPztAH1SurGBzZwxX3KCrz3BgwgNMDXkyKezdz/KIyLlv8485ECmbA6+8TeH uOWbnJN3Cz6ybSinNStom0qVMYuGkECzixkg6b611xOXWjkl0OFNIkaCx8rb8CwRBPy/ QBCE/eStkAKnrF8KNT1U5k1JsHkBet1VNuUn6mB869rQbhWb5lyz5Bfufm5OEkuSWBWW MIwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=nWnKy8YRBVBBKYhwn9ESauQOjvPFjjHabimGAYJv/To=; b=FYYFbDfib3JcRqa66eETKaC09PYyOoudQXh2BGwH+ggoBrfs/wTK1ZTJLT8yyYq3Iw KxDE71Bvh04vcH5J5beSPiN7z4bQGCMTEb2LgyTVenfxZJSIfOPwHL3IZKKUg57dzsy9 l1oKs0rZD3Ri2NlS+y1lbfqib4+plP1Pt/jmv6BXkH0eboXdFWe+E1WWMhxbJYuJEPXj p0zcWE1xmhiBkSLOFKcEHO/X/RhmZkz9Ntvcs0l9NYnCiu5CEEzkP0ZoNKZ2PPgGAx0y MY8G2weFNv05Bsk4yr4WDCTSCHkO0TtaOL41/iroVgPF39mtKEdVtsSyF4MxkfynQUak rtMg== X-Gm-Message-State: AOUpUlGLg7hpGneE+movwqIGaK+yREZwrPMfZs1hYWz10cSIoi+s1004 pp+UzTktoT8vsKAdAW3yBtUKJTg= X-Google-Smtp-Source: AA+uWPySBwpseP97CQeQ7AsAnNZi1b7VUI+A+urfLzgT3MLpVBtHQ5O+x/JVs7MmweLTtvOHm0DXyw4= X-Received: by 2002:a37:1a13:: with SMTP id a19-v6mr15110285qka.4.1534974208292; Wed, 22 Aug 2018 14:43:28 -0700 (PDT) Date: Wed, 22 Aug 2018 17:43:16 -0400 In-Reply-To: <20180822214316.174161-1-yyd@google.com> Message-Id: <20180822214316.174161-4-yyd@google.com> Mime-Version: 1.0 References: <20180822214316.174161-1-yyd@google.com> X-Mailer: git-send-email 2.18.0.1017.ga543ac7ca45-goog Subject: [PATCH net 3/3] tcp_bbr: apply PROBE_RTT cwnd cap even if acked==0 From: Kevin Yang To: David Miller Cc: netdev@vger.kernel.org, Kevin Yang , Neal Cardwell Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit fixes a corner case where TCP BBR would enter PROBE_RTT mode but not reduce its cwnd. If a TCP receiver ACKed less than one full segment, the number of delivered/acked packets was 0, so that bbr_set_cwnd() would short-circuit and exit early, without cutting cwnd to the value we want for PROBE_RTT. The fix is to instead make sure that even when 0 full packets are ACKed, we do apply all the appropriate caps, including the cap that applies in PROBE_RTT mode. Fixes: 0f8782ea1497 ("tcp_bbr: add BBR congestion control") Signed-off-by: Kevin Yang Signed-off-by: Neal Cardwell Reviewed-by: Yuchung Cheng Reviewed-by: Soheil Hassas Yeganeh --- net/ipv4/tcp_bbr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c index 1d4bdd3b5e4d0..02ff2dde96094 100644 --- a/net/ipv4/tcp_bbr.c +++ b/net/ipv4/tcp_bbr.c @@ -420,10 +420,10 @@ static void bbr_set_cwnd(struct sock *sk, const struct rate_sample *rs, { struct tcp_sock *tp = tcp_sk(sk); struct bbr *bbr = inet_csk_ca(sk); - u32 cwnd = 0, target_cwnd = 0; + u32 cwnd = tp->snd_cwnd, target_cwnd = 0; if (!acked) - return; + goto done; /* no packet fully ACKed; just apply caps */ if (bbr_set_cwnd_to_recover_or_restore(sk, rs, acked, &cwnd)) goto done;