From patchwork Thu Jan 29 01:01:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 434351 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 7ABA61402D1 for ; Thu, 29 Jan 2015 14:58:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762431AbbA2D6u (ORCPT ); Wed, 28 Jan 2015 22:58:50 -0500 Received: from mail-yk0-f169.google.com ([209.85.160.169]:60428 "EHLO mail-yk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751703AbbA2BHS (ORCPT ); Wed, 28 Jan 2015 20:07:18 -0500 Received: by mail-yk0-f169.google.com with SMTP id 200so10938253ykr.0 for ; Wed, 28 Jan 2015 17:07:18 -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:in-reply-to:references; bh=CIbtadfnNq6NZBwE6vRlX2MBYH8hZqBXeoN5xUxDpOc=; b=F/vfAT7sOMbHphOBr8sYsIDw4yiyHGckS11rccGwHCoFX7pspiBxH8ydMnYEYDtqVp eeIndMbsxWSjawek2TuFj2mXrFT0NKUBxsxBykEIm387Fai8BkPqpxwvHxqC5P7X8Bkq sO60BPS52OqIxS0CuEZyzsmqbZSeiDmuZuWhQTxnOEz3VXh7fdjq3OqDVL2Jl/vu1GCP qT/MkZs2A/p3YbMAXh+1tse6vaepBHZ7S0jvYpuUT8lF0WA5QB7vK5/8Oafdv48I3/kd ywJiOch3BFcb2nFJtPfSj0OA4R5bOrYpvdoSZ5hMPIK7xKm33vJmh9n4CxwtWa4jQjb1 sVbw== 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=CIbtadfnNq6NZBwE6vRlX2MBYH8hZqBXeoN5xUxDpOc=; b=OhV8MD0HzV90SDhtxaS7c5Miib1vnw9rIuzj8FtFM4AMQDWSYArxQNZ5iHiusxlgwv u2CPESC16IyTiCTQx8aK+H1JETqxy/YqHuBBwOzslyzMxEv2wcM/aa2i7J+I7vDYUVvz oVMFXKdL/Fnp99u2CC/FOQRnBRpc+OeiIgwMV2E4Us3gmynqnTxYy7RUAAr0cy0dIOuY ah+bFSWkDplTGoQdzQy797uUcfP4RJE/uJ1v+XyJpDX8HXuaGvbzFq+DXKsa0ycRK6NY fOQtD0qoRZqswyb3/FST57iT1LPbUA8HPqtxasMsoRKx4dJPTsxu9S4TvHpdwQRTWooV 5fGw== X-Gm-Message-State: ALoCoQmUJ7vtP68h935NKxW+1xk3u0mrKInKE0861vkQTy6x4X4gPv2lqEL3bGPSyiqM3Np2hdfx X-Received: by 10.170.48.18 with SMTP id 18mr2415861ykq.112.1422493308893; Wed, 28 Jan 2015 17:01:48 -0800 (PST) Received: from coy.nyc.corp.google.com ([172.26.105.221]) by mx.google.com with ESMTPSA id l20sm3647168yhb.29.2015.01.28.17.01.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jan 2015 17:01:48 -0800 (PST) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Neal Cardwell , Yuchung Cheng , Eric Dumazet Subject: [PATCH net-next v2 2/5] tcp: fix the timid additive increase on stretch ACKs Date: Wed, 28 Jan 2015 20:01:36 -0500 Message-Id: <1422493299-22114-3-git-send-email-ncardwell@google.com> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1422493299-22114-1-git-send-email-ncardwell@google.com> References: <1422493299-22114-1-git-send-email-ncardwell@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org tcp_cong_avoid_ai() was too timid (snd_cwnd increased too slowly) on "stretch ACKs" -- cases where the receiver ACKed more than 1 packet in a single ACK. For example, suppose w is 10 and we get a stretch ACK for 20 packets, so acked is 20. We ought to increase snd_cwnd by 2 (since acked/w = 20/10 = 2), but instead we were only increasing cwnd by 1. This patch fixes that behavior. Reported-by: Eyal Perry Signed-off-by: Neal Cardwell Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet --- net/ipv4/tcp_cong.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 60bc170..389fe7a 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c @@ -373,16 +373,19 @@ u32 tcp_slow_start(struct tcp_sock *tp, u32 acked) } EXPORT_SYMBOL_GPL(tcp_slow_start); -/* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w) */ +/* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w), + * for every packet that was ACKed. + */ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked) { + tp->snd_cwnd_cnt += acked; if (tp->snd_cwnd_cnt >= w) { - if (tp->snd_cwnd < tp->snd_cwnd_clamp) - tp->snd_cwnd++; - tp->snd_cwnd_cnt = 0; - } else { - tp->snd_cwnd_cnt += acked; + u32 delta = tp->snd_cwnd_cnt / w; + + tp->snd_cwnd_cnt -= delta * w; + tp->snd_cwnd += delta; } + tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_cwnd_clamp); } EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai);