All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.