From patchwork Wed Dec 22 18:39:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 76439 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 7C4F7B6F1E for ; Thu, 23 Dec 2010 05:40:45 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753020Ab0LVSj6 (ORCPT ); Wed, 22 Dec 2010 13:39:58 -0500 Received: from cantor2.suse.de ([195.135.220.15]:51174 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751777Ab0LVSj5 (ORCPT ); Wed, 22 Dec 2010 13:39:57 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 7ED89890B6; Wed, 22 Dec 2010 19:39:56 +0100 (CET) Date: Wed, 22 Dec 2010 19:39:55 +0100 (CET) From: Jiri Kosina To: David Miller , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vojtech Pavlik , =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= Subject: [PATCH] tcp: cleanup of cwnd initialization in tcp_init_metrics() Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit 86bcebafc5e7f5 ("tcp: fix >2 iw selection") fixed a case when congestion window initialization has been mistakenly omitted by introducing cwnd label and putting backwards jump from the end of the function. This makes the code unnecessarily tricky to read and understand on a first sight. Shuffle the code around a little bit to make it more obvious. Signed-off-by: Jiri Kosina --- net/ipv4/tcp_input.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6d8ab1c..dddff6d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -915,11 +915,7 @@ static void tcp_init_metrics(struct sock *sk) if (inet_csk(sk)->icsk_rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp) goto reset; -cwnd: - tp->snd_cwnd = tcp_init_cwnd(tp, dst); - tp->snd_cwnd_stamp = tcp_time_stamp; - return; - + goto out; reset: /* Play conservative. If timestamps are not * supported, TCP will fail to recalculate correct @@ -930,7 +926,9 @@ reset: tp->mdev = tp->mdev_max = tp->rttvar = TCP_TIMEOUT_INIT; inet_csk(sk)->icsk_rto = TCP_TIMEOUT_INIT; } - goto cwnd; +out: + tp->snd_cwnd = tcp_init_cwnd(tp, dst); + tp->snd_cwnd_stamp = tcp_time_stamp; } static void tcp_update_reordering(struct sock *sk, const int metric,