From patchwork Mon Jan 11 18:42:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 566072 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 E88601402BF for ; Tue, 12 Jan 2016 05:42:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=EJUhhqZC; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933235AbcAKSmq (ORCPT ); Mon, 11 Jan 2016 13:42:46 -0500 Received: from mail-qg0-f49.google.com ([209.85.192.49]:33187 "EHLO mail-qg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933143AbcAKSmp (ORCPT ); Mon, 11 Jan 2016 13:42:45 -0500 Received: by mail-qg0-f49.google.com with SMTP id b35so280001523qge.0 for ; Mon, 11 Jan 2016 10:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=thFPA0Mwj2+eyJ56AqI3CLokfS9uJMXrYAZU3BgFMBg=; b=EJUhhqZCntHsDXFYEaPjcpoLQYFjRfSNrQRjvXWnvLuNx+KBUoxqhUc1wo3qUYVBSG RqLqzUK11UCIqUPEG92fu8adVG+LGt1WLEnZqqF4268ti9/gmRdFR6B2XEOU6hHBHG6v LQatw7vG8Uh0TXSLIkrRrlOU5dSdtKd/AN3vYWvbyqlPQaNoF8wc6PUda0bYqKqMw86i GIHBqWXvLrf5v1CPaMDebmhRy5ukn2WsWFb8uNZ4u/h9ybqMtCrRoWKK73PW174+lGmW PrICNHZVSHwD56ZpZObsZtbSUlbVo6Py2Hw4Om7YKhO7FgsNWhn6X2cKYI6BO1hmOgvC rDvQ== 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; bh=thFPA0Mwj2+eyJ56AqI3CLokfS9uJMXrYAZU3BgFMBg=; b=Rn9EutPcw5MpMsstxy8kzkY71CFpo+FT9QYhbvEQ8ZYekYXh8Cc5T7Sls3fTxUWaDS L8iidsnWTrugLYpxspuPhbWbmwnaHTIAUjmE63A/X75Xi2wYfxroPRj9D/T329kArmpj OA5VIZ7IuGJFl8L4Xf7TZSpeYt1yKPxj/mDe/Lx5t9qCM1JNONeio3JITO2jh2Nn6xm3 9nC0+/kZn80wQv/SlJvWs28oM+d/XlAYPgE+vGu4B10pXdX4UvwALJO8FcdeJgC/0wgY Z6eKoab7u/kz7KACSEn+CDdw4ESiWBtej+0oWpOs6ffkvnSMM7KuQ67ytkS4aoPYPMNF xeWw== X-Gm-Message-State: ALoCoQkJmALcCf1iSYGrpE2CilvDETKDDxryTRliQxvYa4+tX1Ue9ZWnS3tstNlu80U25MobnLYGfwVFTMxCNF7scwoQIom5rQ== X-Received: by 10.140.27.202 with SMTP id 68mr98763854qgx.4.1452537764808; Mon, 11 Jan 2016 10:42:44 -0800 (PST) Received: from joy.nyc.corp.google.com ([172.29.18.4]) by smtp.gmail.com with ESMTPSA id 17sm54567764qhp.1.2016.01.11.10.42.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 10:42:44 -0800 (PST) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Neal Cardwell , Yuchung Cheng , Eric Dumazet Subject: [PATCH net] tcp_yeah: don't set ssthresh below 2 Date: Mon, 11 Jan 2016 13:42:43 -0500 Message-Id: <1452537763-28163-1-git-send-email-ncardwell@google.com> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For tcp_yeah, use an ssthresh floor of 2, the same floor used by Reno and CUBIC, per RFC 5681 (equation 4). tcp_yeah_ssthresh() was sometimes returning a 0 or negative ssthresh value if the intended reduction is as big or bigger than the current cwnd. Congestion control modules should never return a zero or negative ssthresh. A zero ssthresh generally results in a zero cwnd, causing the connection to stall. A negative ssthresh value will be interpreted as a u32 and will set a target cwnd for PRR near 4 billion. Oleksandr Natalenko reported that a system using tcp_yeah with ECN could see a warning about a prior_cwnd of 0 in tcp_cwnd_reduction(). Testing verified that this was due to tcp_yeah_ssthresh() misbehaving in this way. Reported-by: Oleksandr Natalenko Signed-off-by: Neal Cardwell Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet --- net/ipv4/tcp_yeah.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c index 17d3566..3e6a472 100644 --- a/net/ipv4/tcp_yeah.c +++ b/net/ipv4/tcp_yeah.c @@ -219,7 +219,7 @@ static u32 tcp_yeah_ssthresh(struct sock *sk) yeah->fast_count = 0; yeah->reno_count = max(yeah->reno_count>>1, 2U); - return tp->snd_cwnd - reduction; + return max_t(int, tp->snd_cwnd - reduction, 2); } static struct tcp_congestion_ops tcp_yeah __read_mostly = {