public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tcp: use RTAX_CWND for outgoing connections properly
@ 2010-12-17 22:14 Jiri Kosina
  2010-12-22 10:00 ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2010-12-17 22:14 UTC (permalink / raw)
  To: David Miller, netdev, Eric Dumazet; +Cc: linux-kernel, Vojtech Pavlik

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.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-12-22 23:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-17 22:14 [PATCH] tcp: use RTAX_CWND for outgoing connections properly Jiri Kosina
2010-12-22 10:00 ` Jiri Kosina
2010-12-22 11:29   ` Eric Dumazet
2010-12-22 11:38     ` Jiri Kosina
2010-12-22 14:07       ` Jiri Kosina
2010-12-22 14:37         ` Eric Dumazet
2010-12-22 19:57   ` David Miller
2010-12-22 23:26     ` Jiri Kosina
2010-12-22 23:27       ` David Miller
2010-12-22 23:33         ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox