Commit bf8555b2 authored by Baptiste Jonglez's avatar Baptiste Jonglez Committed by Juliusz Chroboczek

Switch to TCP conventions for the RTT decay factor

parent fe538cc4
...@@ -342,9 +342,9 @@ otherwise. ...@@ -342,9 +342,9 @@ otherwise.
.TP .TP
.BI rtt\-exponential\-decay " decay" .BI rtt\-exponential\-decay " decay"
This specifies the decay factor for the exponential moving average of This specifies the decay factor for the exponential moving average of
RTT samples, in units of 1/256. Must be between 1 and 256, inclusive. RTT samples, in units of 1/256. Must be between 0 and 255, inclusive.
Higher values discard old samples faster. The default is Lower values discard old samples faster. The default is
.BR 42 . .BR 214 .
.TP .TP
.BI rtt\-min " rtt" .BI rtt\-min " rtt"
This specifies the minimum RTT, in milliseconds, starting from which This specifies the minimum RTT, in milliseconds, starting from which
......
...@@ -307,7 +307,7 @@ interface_up(struct interface *ifp, int up) ...@@ -307,7 +307,7 @@ interface_up(struct interface *ifp, int up)
ifp->rtt_exponential_decay = ifp->rtt_exponential_decay =
IF_CONF(ifp, rtt_exponential_decay) > 0 ? IF_CONF(ifp, rtt_exponential_decay) > 0 ?
IF_CONF(ifp, rtt_exponential_decay) : 42; IF_CONF(ifp, rtt_exponential_decay) : 214;
ifp->rtt_min = ifp->rtt_min =
IF_CONF(ifp, rtt_min) > 0 ? IF_CONF(ifp, rtt_min) > 0 ?
......
...@@ -618,8 +618,8 @@ parse_packet(const unsigned char *from, struct interface *ifp, ...@@ -618,8 +618,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
old_rttcost = neighbour_rttcost(neigh); old_rttcost = neighbour_rttcost(neigh);
if (valid_rtt(neigh)) { if (valid_rtt(neigh)) {
/* Running exponential average. */ /* Running exponential average. */
smoothed_rtt = (ifp->rtt_exponential_decay * rtt smoothed_rtt = ((256 - ifp->rtt_exponential_decay) * rtt
+ (256 - ifp->rtt_exponential_decay) * neigh->rtt); + ifp->rtt_exponential_decay * neigh->rtt);
/* Rounding (up or down) to get closer to the sample. */ /* Rounding (up or down) to get closer to the sample. */
neigh->rtt = (neigh->rtt >= rtt) ? smoothed_rtt / 256 : neigh->rtt = (neigh->rtt >= rtt) ? smoothed_rtt / 256 :
(smoothed_rtt + 255) / 256; (smoothed_rtt + 255) / 256;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment