Skip to contentSkip to conversation

initial congestion window for connections in the listen queue

DISCUSSION Octavian Purdila 3 participants 7 messages Apr 13, 2009 – Apr 14, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

A question for the TCP wizards:

Quoted 10 lines

struct sock *tcp_create_openreq_child(struct sock *sk,
struct request_sock >*req, struct sk_buff *skb)
{
...
/* So many TCP implementations out there (incorrectly) count the
* initial SYN frame in their delayed-ACK and congestion control
* algorithms that we must have the following bandaid to talk
* efficiently to them. -DaveM
*/
newtp->snd_cwnd = 2;

Shouldn't the same logic from tcp_init_cwnd() be used here?

Quoted 1 line

From my traces, this seems to prevent TSO from helping short lived

connections.

Thanks,
tavi

maintainer
#1 lore raw

From: Octavian Purdila <[email protected]>
Date: Mon, 13 Apr 2009 23:46:15 +0300

Quoted 14 lines

A question for the TCP wizards:

Quoted 10 lines

struct sock *tcp_create_openreq_child(struct sock *sk,
struct request_sock >*req, struct sk_buff *skb)
{
...
/* So many TCP implementations out there (incorrectly) count the
* initial SYN frame in their delayed-ACK and congestion control
* algorithms that we must have the following bandaid to talk
* efficiently to them. -DaveM
*/
newtp->snd_cwnd = 2;

Quoted 4 lines

Shouldn't the same logic from tcp_init_cwnd() be used here?

Quoted 1 line

From my traces, this seems to prevent TSO from helping short lived

connections.

On any standard ethernet MTU or larger, you should be getting an initial CWND of 3 or 4 because of the logic in tcp_init_cwnd().

Don't just guesstimate what initial ->snd_cwnd value the kernel is using by looking casually at tcpdump traces. Add some kernel debugging printk's and find out for sure.

#2 lore raw
Quoted 20 lines · David Miller

From: Octavian Purdila <[email protected]>
Date: Mon, 13 Apr 2009 23:46:15 +0300

Quoted 17 lines

A question for the TCP wizards:

Quoted 10 lines

struct sock *tcp_create_openreq_child(struct sock *sk,
struct request_sock >*req, struct sk_buff *skb)
{
...
/* So many TCP implementations out there (incorrectly) count the
* initial SYN frame in their delayed-ACK and congestion control
* algorithms that we must have the following bandaid to talk
* efficiently to them. -DaveM
*/
newtp->snd_cwnd = 2;

Shouldn't the same logic from tcp_init_cwnd() be used here?

Quoted 1 line

From my traces, this seems to prevent TSO from helping short lived

Quoted 8 lines
Quoted 1 line

connections.

On any standard ethernet MTU or larger, you should be getting an initial CWND of 3 or 4 because of the logic in tcp_init_cwnd().

Don't just guesstimate what initial ->snd_cwnd value the kernel is using by looking casually at tcpdump traces. Add some kernel debugging printk's and find out for sure.

A long-standing feature in tcp_init_metrics() is such that any of its goto reset prevents call to tcp_init_cwnd(). I never remembered to fix that.

Signature · 1 line
 i.
maintainer
#3 lore raw

From: "Ilpo Järvinen" <[email protected]>
Date: Tue, 14 Apr 2009 00:54:40 +0300 (EEST)

Quoted 2 lines

A long-standing feature in tcp_init_metrics() is such that any of its goto reset prevents call to tcp_init_cwnd(). I never remembered to fix that.

Grumble, we definitely need to fix that!

I suspect I added that problem, because tcp_init_metrics() at one point couldn't cope with a NULL dst. But that is no longer the case so I'm pretty sure we can unconditionally go:

	tp->snd_cwnd = tcp_init_cwnd(tp, dst);
	tp->snd_cwnd_stamp = tcp_time_stamp;

in the 'reset' path too, right?

But note thata even if this reset path is taken, we should still have at least the default ->snd_cwnd value of 2.

#4 lore raw
Quoted 10 lines · David Miller

From: "Ilpo Järvinen" <[email protected]>
Date: Tue, 14 Apr 2009 00:54:40 +0300 (EEST)

Quoted 2 lines

A long-standing feature in tcp_init_metrics() is such that any of its goto reset prevents call to tcp_init_cwnd(). I never remembered to fix that.

Grumble, we definitely need to fix that!

I suspect I added that problem, because tcp_init_metrics() at one point couldn't cope with a NULL dst.

I suppose you meant tcp_init_cwnd() here, otherwise this doesn't make much sense to me?

Quoted 7 lines

But that is no longer the
case so I'm pretty sure we can unconditionally go:

	tp->snd_cwnd = tcp_init_cwnd(tp, dst);
	tp->snd_cwnd_stamp = tcp_time_stamp;

in the 'reset' path too, right?

At least it compiles... :-) ...I don't see any problems either.

Quoted 2 lines

But note thata even if this reset path is taken, we should still have at least the default ->snd_cwnd value of 2.

Right, it wasn't be uninitialized as we get that 2 from elsewhere.

A patch below.

Signature · 11 lines
[PATCH] tcp: fix >2 iw selection

A long-standing feature in tcp_init_metrics() is such that
any of its goto reset prevents call to tcp_init_cwnd().

Compile tested.

Signed-off-by: Ilpo Järvinen <[email protected]>
---
 net/ipv4/tcp_input.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
net/ipv4/tcp_input.c +3 -0
index 4872524..00ba37b 100644
@@ -928,6 +928,8 @@ static void tcp_init_metrics(struct sock *sk)
 	tcp_set_rto(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;
@@ -942,6 +944,7 @@ reset:
 		tp->mdev = tp->mdev_max = tp->rttvar = TCP_TIMEOUT_INIT;
 		inet_csk(sk)->icsk_rto = TCP_TIMEOUT_INIT;
 	}
+	goto cwnd;
 }
 
 static void tcp_update_reordering(struct sock *sk, const int metric,
Signature · 1 line
1.5.2.2
maintainer
#5 lore raw

From: "Ilpo Järvinen" <[email protected]>
Date: Tue, 14 Apr 2009 11:37:08 +0300 (EEST)

Quoted 8 lines

[PATCH] tcp: fix >2 iw selection

A long-standing feature in tcp_init_metrics() is such that any of its goto reset prevents call to tcp_init_cwnd().

Compile tested.

Looks good, applied, thanks!

#6 lore raw
In reply to Ilpo Järvinen
Quoted 10 lines · On Tuesday 14 April 2009 11:37:08 Ilpo Järvinen wrote:
Quoted 7 lines

But that is no longer the
case so I'm pretty sure we can unconditionally go:

	tp->snd_cwnd = tcp_init_cwnd(tp, dst);
	tp->snd_cwnd_stamp = tcp_time_stamp;

in the 'reset' path too, right?

At least it compiles... :-) ...I don't see any problems either.

Confirming that it is fixing the issue I was seeing.

Thanks a lot for the quick responses and the fix !

Thanks,
tavi