* a question on tcp_highspeed.c (in 2.6.16)
@ 2006-05-04 14:03 Xiaoliang (David) Wei
2006-05-04 19:06 ` [PATCH] " John Heffner
0 siblings, 1 reply; 3+ messages in thread
From: Xiaoliang (David) Wei @ 2006-05-04 14:03 UTC (permalink / raw)
To: netdev
Hi gurus,
I am reading the code of tcp_highspeed.c in the kernel and have a
question on the hstcp_cong_avoid function, specifically the following
AI part (line 136~143 in net/ipv4/tcp_highspeed.c ):
/* Do additive increase */
if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
tp->snd_cwnd_cnt += ca->ai;
if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
tp->snd_cwnd++;
tp->snd_cwnd_cnt -= tp->snd_cwnd;
}
}
In this part, when (tp->snd_cwnd_cnt == tp->snd_cwnd),
snd_cwnd_cnt will be -1... snd_cwnd_cnt is defined as u16, will this
small chance of getting -1 becomes a problem?
Shall we change it by reversing the order of the cwnd++ and cwnd_cnt -= cwnd?
Thanks.
-David
--
Xiaoliang (David) Wei Graduate Student, CS@Caltech
http://davidwei.org
***********************************************
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] Re: a question on tcp_highspeed.c (in 2.6.16)
2006-05-04 14:03 a question on tcp_highspeed.c (in 2.6.16) Xiaoliang (David) Wei
@ 2006-05-04 19:06 ` John Heffner
2006-05-06 0:42 ` David S. Miller
0 siblings, 1 reply; 3+ messages in thread
From: John Heffner @ 2006-05-04 19:06 UTC (permalink / raw)
To: Xiaoliang (David) Wei; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
Xiaoliang (David) Wei wrote:
> Hi gurus,
>
> I am reading the code of tcp_highspeed.c in the kernel and have a
> question on the hstcp_cong_avoid function, specifically the following
> AI part (line 136~143 in net/ipv4/tcp_highspeed.c ):
>
> /* Do additive increase */
> if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
> tp->snd_cwnd_cnt += ca->ai;
> if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
> tp->snd_cwnd++;
> tp->snd_cwnd_cnt -= tp->snd_cwnd;
> }
> }
>
> In this part, when (tp->snd_cwnd_cnt == tp->snd_cwnd),
> snd_cwnd_cnt will be -1... snd_cwnd_cnt is defined as u16, will this
> small chance of getting -1 becomes a problem?
> Shall we change it by reversing the order of the cwnd++ and cwnd_cnt -=
> cwnd?
Absolutely correct. Thanks.
Signed-off-by: John Heffner <jheffner@psc.edu>
[-- Attachment #2: highspeed_cwnd_cnt.patch --]
[-- Type: text/plain, Size: 434 bytes --]
diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c
index e0e9d13..b72fa55 100644
--- a/net/ipv4/tcp_highspeed.c
+++ b/net/ipv4/tcp_highspeed.c
@@ -137,8 +137,8 @@ static void hstcp_cong_avoid(struct sock
if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
tp->snd_cwnd_cnt += ca->ai;
if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
- tp->snd_cwnd++;
tp->snd_cwnd_cnt -= tp->snd_cwnd;
+ tp->snd_cwnd++;
}
}
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Re: a question on tcp_highspeed.c (in 2.6.16)
2006-05-04 19:06 ` [PATCH] " John Heffner
@ 2006-05-06 0:42 ` David S. Miller
0 siblings, 0 replies; 3+ messages in thread
From: David S. Miller @ 2006-05-06 0:42 UTC (permalink / raw)
To: jheffner; +Cc: davidwei79, netdev
From: John Heffner <jheffner@psc.edu>
Date: Thu, 04 May 2006 15:06:00 -0400
> Xiaoliang (David) Wei wrote:
> > Hi gurus,
> >
> > I am reading the code of tcp_highspeed.c in the kernel and have a
> > question on the hstcp_cong_avoid function, specifically the following
> > AI part (line 136~143 in net/ipv4/tcp_highspeed.c ):
> >
> > /* Do additive increase */
> > if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
> > tp->snd_cwnd_cnt += ca->ai;
> > if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
> > tp->snd_cwnd++;
> > tp->snd_cwnd_cnt -= tp->snd_cwnd;
> > }
> > }
> >
> > In this part, when (tp->snd_cwnd_cnt == tp->snd_cwnd),
> > snd_cwnd_cnt will be -1... snd_cwnd_cnt is defined as u16, will this
> > small chance of getting -1 becomes a problem?
> > Shall we change it by reversing the order of the cwnd++ and cwnd_cnt -=
> > cwnd?
>
> Absolutely correct. Thanks.
>
> Signed-off-by: John Heffner <jheffner@psc.edu>
Applied, thanks a lot everyone.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-05-06 0:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-04 14:03 a question on tcp_highspeed.c (in 2.6.16) Xiaoliang (David) Wei
2006-05-04 19:06 ` [PATCH] " John Heffner
2006-05-06 0:42 ` David S. Miller
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).