netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* initial congestion window for connections in the listen queue
@ 2009-04-13 20:46 Octavian Purdila
  2009-04-13 21:26 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Octavian Purdila @ 2009-04-13 20:46 UTC (permalink / raw)
  To: netdev


A question for the TCP wizards:

>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?

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

Thanks,
tavi


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

* Re: initial congestion window for connections in the listen queue
  2009-04-13 20:46 initial congestion window for connections in the listen queue Octavian Purdila
@ 2009-04-13 21:26 ` David Miller
  2009-04-13 21:54   ` Ilpo Järvinen
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2009-04-13 21:26 UTC (permalink / raw)
  To: opurdila; +Cc: netdev

From: Octavian Purdila <opurdila@ixiacom.com>
Date: Mon, 13 Apr 2009 23:46:15 +0300

> 
> A question for the TCP wizards:
> 
>>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?
> 
>>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.

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

* Re: initial congestion window for connections in the listen queue
  2009-04-13 21:26 ` David Miller
@ 2009-04-13 21:54   ` Ilpo Järvinen
  2009-04-13 21:58     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Ilpo Järvinen @ 2009-04-13 21:54 UTC (permalink / raw)
  To: David Miller; +Cc: opurdila, Netdev

On Mon, 13 Apr 2009, David Miller wrote:

> From: Octavian Purdila <opurdila@ixiacom.com>
> Date: Mon, 13 Apr 2009 23:46:15 +0300
> 
> > 
> > A question for the TCP wizards:
> > 
> >>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?
> > 
> >>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.

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.

-- 
 i.

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

* Re: initial congestion window for connections in the listen queue
  2009-04-13 21:54   ` Ilpo Järvinen
@ 2009-04-13 21:58     ` David Miller
  2009-04-14  8:37       ` Ilpo Järvinen
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2009-04-13 21:58 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: opurdila, netdev

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Tue, 14 Apr 2009 00:54:40 +0300 (EEST)

> 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.

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

* Re: initial congestion window for connections in the listen queue
  2009-04-13 21:58     ` David Miller
@ 2009-04-14  8:37       ` Ilpo Järvinen
  2009-04-14  9:09         ` David Miller
  2009-04-14 13:48         ` Octavian Purdila
  0 siblings, 2 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2009-04-14  8:37 UTC (permalink / raw)
  To: David Miller; +Cc: opurdila, Netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1987 bytes --]

On Mon, 13 Apr 2009, David Miller wrote:

> From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
> Date: Tue, 14 Apr 2009 00:54:40 +0300 (EEST)
> 
> > 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?

> 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.

> 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.

-- 
[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 <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/tcp_input.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 4872524..00ba37b 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -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,
-- 
1.5.2.2

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

* Re: initial congestion window for connections in the listen queue
  2009-04-14  8:37       ` Ilpo Järvinen
@ 2009-04-14  9:09         ` David Miller
  2009-04-14 13:48         ` Octavian Purdila
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2009-04-14  9:09 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: opurdila, netdev

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Tue, 14 Apr 2009 11:37:08 +0300 (EEST)

> [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 <ilpo.jarvinen@helsinki.fi>

Looks good, applied, thanks!

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

* Re: initial congestion window for connections in the listen queue
  2009-04-14  8:37       ` Ilpo Järvinen
  2009-04-14  9:09         ` David Miller
@ 2009-04-14 13:48         ` Octavian Purdila
  1 sibling, 0 replies; 7+ messages in thread
From: Octavian Purdila @ 2009-04-14 13:48 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: David Miller, Netdev

On Tuesday 14 April 2009 11:37:08 Ilpo Järvinen wrote:

> > 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



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

end of thread, other threads:[~2009-04-14 13:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-13 20:46 initial congestion window for connections in the listen queue Octavian Purdila
2009-04-13 21:26 ` David Miller
2009-04-13 21:54   ` Ilpo Järvinen
2009-04-13 21:58     ` David Miller
2009-04-14  8:37       ` Ilpo Järvinen
2009-04-14  9:09         ` David Miller
2009-04-14 13:48         ` Octavian Purdila

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).