* [PATCH] Error in calculation of RTTvar
@ 2010-10-05 4:36 Christian Schoch
2010-10-05 13:23 ` Vlad Yasevich
2010-10-05 13:53 ` Christian Schoch
0 siblings, 2 replies; 3+ messages in thread
From: Christian Schoch @ 2010-10-05 4:36 UTC (permalink / raw)
To: linux-sctp
The problem is inside the calculation of RTTVAR, which could last in
very high values for RTO. This wrong result exists when RTT is rising
and is bigger than SRTT (the subtraction goes negative).
With this patch it should be possible to set RTOmin = 1 and the RTO has
its minimum of 4 times the clock granularity - if the connection is
fast enough like a LAN connection.
abs() takes two long as argument and the output is long.
srtt, rtt and rttvar are __u32.
Subtraction of two unsigned values results in a value, that is not the
same as it would be if the arguments are two signed values and the
casted back.
Without typecasting the result is the one's complement +1 for carry.
This patch should eliminate the problem.
Schoch Christian
-----------------------------------------------------------------------
--- a/net/sctp/transport.c 2010-10-05 06:04:17.000000000 +0200
+++ b/net/sctp/transport.c 2010-10-05 06:09:09.000000000 +0200
@@ -334,7 +334,7 @@
* 1/8, rto_alpha would be expressed as 3.
*/
tp->rttvar = tp->rttvar - (tp->rttvar >> sctp_rto_beta)
- + ((abs(tp->srtt - rtt)) >> sctp_rto_beta);
+ + (((__u32)abs((long)tp->srtt - (long)rtt)) >>
sctp_rto_beta);
tp->srtt = tp->srtt - (tp->srtt >> sctp_rto_alpha)
+ (rtt >> sctp_rto_alpha);
} else {
---------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Error in calculation of RTTvar
2010-10-05 4:36 [PATCH] Error in calculation of RTTvar Christian Schoch
@ 2010-10-05 13:23 ` Vlad Yasevich
2010-10-05 13:53 ` Christian Schoch
1 sibling, 0 replies; 3+ messages in thread
From: Vlad Yasevich @ 2010-10-05 13:23 UTC (permalink / raw)
To: linux-sctp
On 10/05/2010 12:36 AM, Christian Schoch wrote:
> The problem is inside the calculation of RTTVAR, which could last in very high values for RTO. This wrong result exists when RTT is rising and is bigger than SRTT (the subtraction goes negative).
> With this patch it should be possible to set RTOmin = 1 and the RTO has its minimum of 4 times the clock granularity - if the connection is fast enough like a LAN connection.
>
> abs() takes two long as argument and the output is long.
> srtt, rtt and rttvar are __u32.
>
> Subtraction of two unsigned values results in a value, that is not the same as it would be if the arguments are two signed values and the casted back.
> Without typecasting the result is the one's complement +1 for carry.
>
> This patch should eliminate the problem.
All that missing is a sign off. Can you add
Signed-off-by: name <email>
to this patch, or reply with your sign-off.
Thanks
-vlad
>
> Schoch Christian
>
> -----------------------------------------------------------------------
>
> --- a/net/sctp/transport.c 2010-10-05 06:04:17.000000000 +0200
> +++ b/net/sctp/transport.c 2010-10-05 06:09:09.000000000 +0200
> @@ -334,7 +334,7 @@
> * 1/8, rto_alpha would be expressed as 3.
> */
> tp->rttvar = tp->rttvar - (tp->rttvar >> sctp_rto_beta)
> - + ((abs(tp->srtt - rtt)) >> sctp_rto_beta);
> + + (((__u32)abs((long)tp->srtt - (long)rtt)) >> sctp_rto_beta);
> tp->srtt = tp->srtt - (tp->srtt >> sctp_rto_alpha)
> + (rtt >> sctp_rto_alpha);
> } else {
>
> ---------------------------------------------
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Error in calculation of RTTvar
2010-10-05 4:36 [PATCH] Error in calculation of RTTvar Christian Schoch
2010-10-05 13:23 ` Vlad Yasevich
@ 2010-10-05 13:53 ` Christian Schoch
1 sibling, 0 replies; 3+ messages in thread
From: Christian Schoch @ 2010-10-05 13:53 UTC (permalink / raw)
To: linux-sctp
Sorry, forget that in the morning.
Signed-off-by: Christian Schoch <e0326715@student.tuwien.ac.at>
>
> All that missing is a sign off. Can you add
> Signed-off-by: name <email>
>
> to this patch, or reply with your sign-off.
>
> Thanks
> -vlad
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-05 13:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-05 4:36 [PATCH] Error in calculation of RTTvar Christian Schoch
2010-10-05 13:23 ` Vlad Yasevich
2010-10-05 13:53 ` Christian Schoch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.