Re: [PATCH] tcp: use RTAX_CWND for outgoing connections properly

From: Jiri Kosina
Date: Wed Dec 22 2010 - 05:00:47 EST


On Fri, 17 Dec 2010, Jiri Kosina wrote:

> For outgoing connections, the initial value of cwnd is always set to 2 (in
> tcp_v4_init_sock()) regardless of setting of RTAX_CWND. For incoming
> connections, this is handled properly in tcp_init_metrics().
>
> As a result of this, Linux TCP stack always uses cwnd == 2 at the beginning of
> outgoing TCP session (i.e. waits for ACK after 2 packets once the connection
> has been established) and grows it in accordance with slow-start algorithm
> only after it receives ACK for first two packets.
>
> When slow-start triggers later during the connection (e.g. after idle),
> cwnd is properly re-initialized to RTAX_CWND value (if specified) through
> tcp_cwnd_restart() -> tcp_init_cwnd().
>
> Initialize tp->snd_cwnd properly so that RTAX_CWND value is being used
> also in the slow-start phase for the first packets in the connection.

This should of course read RTAX_INITCWND instead of RTAX_CWND in the whole
changelog, sorry.

Besides that, any comments on this, please?

Thanks.

>
> Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
> ---
> net/ipv4/tcp_output.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 61c2463..6dbc55b 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -2572,6 +2572,8 @@ static void tcp_connect_init(struct sock *sk)
> &rcv_wscale,
> dst_metric(dst, RTAX_INITRWND));
>
> + tp->snd_cwnd = tcp_init_cwnd(tp, dst);
> +
> tp->rx_opt.rcv_wscale = rcv_wscale;
> tp->rcv_ssthresh = tp->rcv_wnd;
>
> --
> 1.7.3.1
>
>

--
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/