From patchwork Fri Sep 16 18:49:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 671067 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sbPVl2TNRz9svs for ; Sat, 17 Sep 2016 04:50:39 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=kUKIuiwW; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935640AbcIPSug (ORCPT ); Fri, 16 Sep 2016 14:50:36 -0400 Received: from mail-qk0-f172.google.com ([209.85.220.172]:35410 "EHLO mail-qk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934585AbcIPSuK (ORCPT ); Fri, 16 Sep 2016 14:50:10 -0400 Received: by mail-qk0-f172.google.com with SMTP id t7so97133522qkh.2 for ; Fri, 16 Sep 2016 11:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1BHocJineOw7AXVACCAenAH9u7RyohsnjNMzYTyJp3Y=; b=kUKIuiwWL3RpY1PkMR8eoYeH5XSUF+1aCsigfVRnj9UJt5xhNHVe0qCbtLYg6V4PyK Zrq/jhY6XkbIyhnUDvkqDEk+M233Tgrvf/RUe7evM0dYhwlhw+B9wF+x1172YSMf95G8 96w4TNyw3PxirIUDtN4wPUp5GsE6cBlLmpS88QcnpqD1IJevGUDN4aS6PUZa+OVkBJQG EjkkadRhtK8SnIJ9uvZxnltE4F6NLRp1e2iLZvkxIj9vVNyoSpLdfqRKy1STDkofpuDK YJDLeFgjbpZPmJFq+VfdAdThAyAQ7xP/vgACi0trbwYtrvp1jF7G2nNjdaF8dt5bWHxk 7CxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1BHocJineOw7AXVACCAenAH9u7RyohsnjNMzYTyJp3Y=; b=N8lkzBFxY0tpVosXzQtXWcgP1wxi9QHM7JoyLV/QBR0KvrCZip9eHU9s1lP9XSbt9x FwkFsrlQMUmcUotdxlMCIUVM3BhKPRX/dPOD3bxm/lW0Nn2AwR4JsxiboHgvb/8PzYMk E2X9m9HNLJYolVMwGMwVDc4u7QMjvX4Dwmecw6R2WceSfhZOZokTApL8LWzwrrFotebK ATnp+shRjgNwgKyte77MvhM1baRUfpRuV1mC9Ytp5wDK4rrhmcXqWnbUWsXxlSvraviT dAiHkilfF3SzLP0V0bKXkSpGVFgiXfQ0izb0HlvF/B1D29Ko01mnMI5mhVFt0b6mMqB/ JBgw== X-Gm-Message-State: AE9vXwNKXM/lxsdbezINx9kKfZB5klu+DnrOfczKOyWxapoTrkAwtU6GcyO0O1MetMfWCxgh X-Received: by 10.55.164.193 with SMTP id n184mr17642070qke.197.1474051804319; Fri, 16 Sep 2016 11:50:04 -0700 (PDT) Received: from joy.nyc.corp.google.com ([100.101.230.104]) by smtp.gmail.com with ESMTPSA id s23sm5454444qka.10.2016.09.16.11.50.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Sep 2016 11:50:03 -0700 (PDT) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Yuchung Cheng , Van Jacobson , Neal Cardwell , Nandita Dukkipati , Eric Dumazet , Soheil Hassas Yeganeh Subject: [PATCH net-next 11/14] tcp: allow congestion control to expand send buffer differently Date: Fri, 16 Sep 2016 14:49:00 -0400 Message-Id: <1474051743-13311-12-git-send-email-ncardwell@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1474051743-13311-1-git-send-email-ncardwell@google.com> References: <1474051743-13311-1-git-send-email-ncardwell@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Yuchung Cheng Currently the TCP send buffer expands to twice cwnd, in order to allow limited transmits in the CA_Recovery state. This assumes that cwnd does not increase in the CA_Recovery. For some congestion control algorithms, like the upcoming BBR module, if the losses in recovery do not indicate congestion then we may continue to raise cwnd multiplicatively in recovery. In such cases the current multiplier will falsely limit the sending rate, much as if it were limited by the application. This commit adds an optional congestion control callback to use a different multiplier to expand the TCP send buffer. For congestion control modules that do not specificy this callback, TCP continues to use the previous default of 2. Signed-off-by: Van Jacobson Signed-off-by: Neal Cardwell Signed-off-by: Yuchung Cheng Signed-off-by: Nandita Dukkipati Signed-off-by: Eric Dumazet Signed-off-by: Soheil Hassas Yeganeh --- include/net/tcp.h | 2 ++ net/ipv4/tcp_input.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 8805c65..c4d2e46 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -917,6 +917,8 @@ struct tcp_congestion_ops { void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample); /* suggest number of segments for each skb to transmit (optional) */ u32 (*tso_segs_goal)(struct sock *sk); + /* returns the multiplier used in tcp_sndbuf_expand (optional) */ + u32 (*sndbuf_expand)(struct sock *sk); /* get info for inet_diag (optional) */ size_t (*get_info)(struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info); diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index df26af0..a134e66 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -289,6 +289,7 @@ static bool tcp_ecn_rcv_ecn_echo(const struct tcp_sock *tp, const struct tcphdr static void tcp_sndbuf_expand(struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); + const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; int sndmem, per_mss; u32 nr_segs; @@ -309,7 +310,8 @@ static void tcp_sndbuf_expand(struct sock *sk) * Cubic needs 1.7 factor, rounded to 2 to include * extra cushion (application might react slowly to POLLOUT) */ - sndmem = 2 * nr_segs * per_mss; + sndmem = ca_ops->sndbuf_expand ? ca_ops->sndbuf_expand(sk) : 2; + sndmem *= nr_segs * per_mss; if (sk->sk_sndbuf < sndmem) sk->sk_sndbuf = min(sndmem, sysctl_tcp_wmem[2]);