From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: "David Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Vojtech Pavlik" <vojtech@suse.cz>,
"Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Subject: Re: [PATCH] tcp: cleanup of cwnd initialization in tcp_init_metrics()
Date: Thu, 23 Dec 2010 09:24:31 +0100 [thread overview]
Message-ID: <1293092671.2679.44.camel@edumazet-laptop> (raw)
In-Reply-To: <alpine.LNX.2.00.1012221938030.16569@pobox.suse.cz>
Le mercredi 22 décembre 2010 à 19:39 +0100, Jiri Kosina a écrit :
> 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.
Well in fine you have
if (inet_csk(sk)->icsk_rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp)
goto reset;
goto out;
reset:
Is that really more obvious ? ;)
>
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> ---
> 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,
next prev parent reply other threads:[~2010-12-23 8:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-22 18:39 [PATCH] tcp: cleanup of cwnd initialization in tcp_init_metrics() Jiri Kosina
2010-12-23 8:24 ` Eric Dumazet [this message]
2010-12-23 9:03 ` Jiri Kosina
2010-12-23 9:14 ` Eric Dumazet
2010-12-23 9:23 ` Jiri Kosina
2010-12-23 17:56 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1293092671.2679.44.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=ilpo.jarvinen@helsinki.fi \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vojtech@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox