[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK6E8=dkwruGMtW2uQ--xZ_so9aZQt-KcmHsy2yE5GApKphrJQ@mail.gmail.com>
Date: Fri, 20 Jul 2012 08:07:37 -0700
From: Yuchung Cheng <ycheng@...gle.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Tom Herbert <therbert@...gle.com>,
Neal Cardwell <ncardwell@...gle.com>,
Stephen Hemminger <shemminger@...tta.com>,
John Heffner <johnwheffner@...il.com>,
Nandita Dukkipati <nanditad@...gle.com>
Subject: Re: [PATCH v2 net-next] tcp: fix ABC in tcp_slow_start()
On Fri, Jul 20, 2012 at 8:02 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> When/if sysctl_tcp_abc > 1, we expect to increase cwnd by 2 if the
> received ACK acknowledges more than 2*MSS bytes, in tcp_slow_start()
>
> Problem is this RFC 3465 statement is not correctly coded, as
> the while () loop increases snd_cwnd one by one.
>
> Add a new variable to avoid this off-by one error.
>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Acked-by: Yuchung Cheng <ycheng@...gle.com>
> Cc: Tom Herbert <therbert@...gle.com>
> Cc: Yuchung Cheng <ycheng@...gle.com>
> Cc: Neal Cardwell <ncardwell@...gle.com>
> Cc: Nandita Dukkipati <nanditad@...gle.com>
> Cc: John Heffner <johnwheffner@...il.com>
> Cc: Stephen Hemminger <shemminger@...tta.com>
> ---
> v2: added John suggestion
>
> net/ipv4/tcp_cong.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
> index 04dbd7a..4d4db16 100644
> --- a/net/ipv4/tcp_cong.c
> +++ b/net/ipv4/tcp_cong.c
> @@ -307,6 +307,7 @@ EXPORT_SYMBOL_GPL(tcp_is_cwnd_limited);
> void tcp_slow_start(struct tcp_sock *tp)
> {
> int cnt; /* increase in packets */
> + unsigned int delta = 0;
>
> /* RFC3465: ABC Slow start
> * Increase only after a full MSS of bytes is acked
> @@ -333,9 +334,9 @@ void tcp_slow_start(struct tcp_sock *tp)
> tp->snd_cwnd_cnt += cnt;
> while (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
> tp->snd_cwnd_cnt -= tp->snd_cwnd;
> - if (tp->snd_cwnd < tp->snd_cwnd_clamp)
> - tp->snd_cwnd++;
> + delta++;
Nice! this also removes wasteful iteration when clamp << cwnd_cnt.
> }
> + tp->snd_cwnd = min(tp->snd_cwnd + delta, tp->snd_cwnd_clamp);
> }
> EXPORT_SYMBOL_GPL(tcp_slow_start);
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists