From patchwork Fri Jul 27 21:19:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 950367 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="YdVSkPnB"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41chft2xxLz9ryn for ; Sat, 28 Jul 2018 07:19:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389703AbeG0Wm7 (ORCPT ); Fri, 27 Jul 2018 18:42:59 -0400 Received: from mail-qt0-f201.google.com ([209.85.216.201]:50658 "EHLO mail-qt0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389523AbeG0Wm6 (ORCPT ); Fri, 27 Jul 2018 18:42:58 -0400 Received: by mail-qt0-f201.google.com with SMTP id e14-v6so4919597qtp.17 for ; Fri, 27 Jul 2018 14:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=LFtLAs4i0VEh6VfWlhY9Bus+YvqwhYaf19zcKWDuz2o=; b=YdVSkPnBaZvaRk0xJC2i/SLKvkAXE1YTm487nO5otlK4MInOUQvZ5fE6/oiucYcaWJ RvNJBJ2P03eSIvhX393zFhqpVPt/nwFBKl9uetnmTnigDbdbZtej8wrInOWPRcJWcC5L Bin53iAVoWb3kPGNw5PM+nc3KpOe/pGLJGaj0HeKOvURTVbSYrR1QwGlz3lv0J7rQ00o 79sJs7jqhz7tJ3q+W71hKrirgB/3wAOIOFXWVYNRL+xo0y3ngCCI6mAhwMaMe9TRGv1W qB3BomyD07dQt70Y95H7Abfpt5mR1Pqb0a2Eovak0WV2I92/E+IWsJRAJ8MhT27BkYrr CqTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=LFtLAs4i0VEh6VfWlhY9Bus+YvqwhYaf19zcKWDuz2o=; b=YAug+y6u+4tRhpUc+GZCGVJXJfIauNp9FOqJ8RtLD4+jPKAhde+dG5Ifc5SXpUSf6C QytAi2eir5Z1SvB6sbUPCqVKsE/WMFthedsLhJSg9kF/xfXHreYkplOXGdZEbon1iomw grRDv3VN5qE003gh8D4TSagMYb2UHdhnHH4FuDINEkOChpd4prkZw7PH+1xIA/27lpG2 wR1+NQSLc7SuGmIVq6BIAk7dvC6hKnELHD4xXjK0DiOkw2u/62BH5u99ZDhBsNhJ9Iwe Jm8odULb+qnOO/aY9A4bxCpLXG9Z+3EwzLulHRl2xje2neeuD4UYPBukYn17yhvXO+zR vHLg== X-Gm-Message-State: AOUpUlF1mZzf9q4NWawUcqMNF/u1qRZIPtygEjOL2Cu5L5d8rcl7ivFR 5+opYAa/D5Ddp+K2W3U9k4xEmbEZRukRmtw= X-Google-Smtp-Source: AAOMgpdjmx3Mb8wXt4kT7G0uBzMkKTL7BCt9bdNHZBHGuVhJyFbif/lNBgGCnUgKT2CDaR3OgLqwNQ2KVw1mp4s= X-Received: by 2002:a0c:936c:: with SMTP id e41-v6mr4186542qve.53.1532726355503; Fri, 27 Jul 2018 14:19:15 -0700 (PDT) Date: Fri, 27 Jul 2018 17:19:12 -0400 Message-Id: <20180727211912.241232-1-ncardwell@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog Subject: [PATCH net] tcp_bbr: fix bw probing to raise in-flight data for very small BDPs From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Neal Cardwell Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For some very small BDPs (with just a few packets) there was a quantization effect where the target number of packets in flight during the super-unity-gain (1.25x) phase of gain cycling was implicitly truncated to a number of packets no larger than the normal unity-gain (1.0x) phase of gain cycling. This meant that in multi-flow scenarios some flows could get stuck with a lower bandwidth, because they did not push enough packets inflight to discover that there was more bandwidth available. This was really only an issue in multi-flow LAN scenarios, where RTTs and BDPs are low enough for this to be an issue. This fix ensures that gain cycling can raise inflight for small BDPs by ensuring that in PROBE_BW mode target inflight values with a super-unity gain are always greater than inflight values with a gain <= 1. Importantly, this applies whether the inflight value is calculated for use as a cwnd value, or as a target inflight value for the end of the super-unity phase in bbr_is_next_cycle_phase() (both need to be bigger to ensure we can probe with more packets in flight reliably). This is a candidate fix for stable releases. Fixes: 0f8782ea1497 ("tcp_bbr: add BBR congestion control") Signed-off-by: Neal Cardwell Acked-by: Yuchung Cheng Acked-by: Soheil Hassas Yeganeh Acked-by: Priyaranjan Jha Reviewed-by: Eric Dumazet --- net/ipv4/tcp_bbr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c index 3b5f45b9e81eb..13d34427ca3dd 100644 --- a/net/ipv4/tcp_bbr.c +++ b/net/ipv4/tcp_bbr.c @@ -358,6 +358,10 @@ static u32 bbr_target_cwnd(struct sock *sk, u32 bw, int gain) /* Reduce delayed ACKs by rounding up cwnd to the next even number. */ cwnd = (cwnd + 1) & ~1U; + /* Ensure gain cycling gets inflight above BDP even for small BDPs. */ + if (bbr->mode == BBR_PROBE_BW && gain > BBR_UNIT) + cwnd += 2; + return cwnd; }