Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
9a99f954
Commit
9a99f954
authored
Jun 19, 2013
by
Baptiste Jonglez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute the moving exponential average of the RTT
parent
675dc627
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
0 deletions
+26
-0
babeld.c
babeld.c
+4
-0
babeld.h
babeld.h
+1
-0
message.c
message.c
+10
-0
neighbour.c
neighbour.c
+8
-0
neighbour.h
neighbour.h
+3
-0
No files found.
babeld.c
View file @
9a99f954
...
@@ -58,6 +58,10 @@ struct timeval now;
...
@@ -58,6 +58,10 @@ struct timeval now;
unsigned
char
myid
[
8
];
unsigned
char
myid
[
8
];
int
debug
=
0
;
int
debug
=
0
;
/* A higher value means we forget old RTT samples faster. Must be
between 1 and 256, inclusive. */
unsigned
int
rtt_exponential_decay
=
42
;
int
link_detect
=
0
;
int
link_detect
=
0
;
int
all_wireless
=
0
;
int
all_wireless
=
0
;
int
default_wireless_hello_interval
=
-
1
;
int
default_wireless_hello_interval
=
-
1
;
...
...
babeld.h
View file @
9a99f954
...
@@ -90,6 +90,7 @@ extern int do_daemonise;
...
@@ -90,6 +90,7 @@ extern int do_daemonise;
extern
const
char
*
logfile
,
*
pidfile
,
*
state_file
;
extern
const
char
*
logfile
,
*
pidfile
,
*
state_file
;
extern
int
link_detect
;
extern
int
link_detect
;
extern
int
all_wireless
;
extern
int
all_wireless
;
extern
unsigned
int
rtt_exponential_decay
;
extern
unsigned
char
myid
[
8
];
extern
unsigned
char
myid
[
8
];
...
...
message.c
View file @
9a99f954
...
@@ -610,6 +610,16 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -610,6 +610,16 @@ parse_packet(const unsigned char *from, struct interface *ifp,
rtt
=
local_waiting_us
-
remote_waiting_us
;
rtt
=
local_waiting_us
-
remote_waiting_us
;
debugf
(
"RTT to %s on %s sample result: %d us.
\n
"
,
debugf
(
"RTT to %s on %s sample result: %d us.
\n
"
,
format_address
(
from
),
ifp
->
name
,
rtt
);
format_address
(
from
),
ifp
->
name
,
rtt
);
if
(
valid_rtt
(
neigh
))
/* Running exponential average. */
neigh
->
rtt
=
(
rtt_exponential_decay
*
MAX
(
rtt
,
0
)
+
(
256
-
rtt_exponential_decay
)
*
neigh
->
rtt
)
/
256
;
else
/* We prefer to be conservative with new neighbours
(higher RTT) */
neigh
->
rtt
=
MAX
(
2
*
rtt
,
0
);
neigh
->
rtt_time
=
now
;
}
}
return
;
return
;
}
}
...
...
neighbour.c
View file @
9a99f954
...
@@ -99,6 +99,8 @@ find_neighbour(const unsigned char *address, struct interface *ifp)
...
@@ -99,6 +99,8 @@ find_neighbour(const unsigned char *address, struct interface *ifp)
neigh
->
ihu_interval
=
0
;
neigh
->
ihu_interval
=
0
;
neigh
->
hello_send_us
=
0
;
neigh
->
hello_send_us
=
0
;
neigh
->
hello_rtt_receive_time
=
zero
;
neigh
->
hello_rtt_receive_time
=
zero
;
neigh
->
rtt
=
0
;
neigh
->
rtt_time
=
zero
;
neigh
->
ifp
=
ifp
;
neigh
->
ifp
=
ifp
;
neigh
->
next
=
neighs
;
neigh
->
next
=
neighs
;
neighs
=
neigh
;
neighs
=
neigh
;
...
@@ -325,3 +327,9 @@ neighbour_cost(struct neighbour *neigh)
...
@@ -325,3 +327,9 @@ neighbour_cost(struct neighbour *neigh)
return
MIN
((
a
*
b
+
128
)
>>
8
,
INFINITY
);
return
MIN
((
a
*
b
+
128
)
>>
8
,
INFINITY
);
}
}
}
}
int
valid_rtt
(
struct
neighbour
*
neigh
)
{
return
(
timeval_minus_msec
(
&
now
,
&
neigh
->
rtt_time
)
<
180000
)
?
1
:
0
;
}
neighbour.h
View file @
9a99f954
...
@@ -36,6 +36,8 @@ struct neighbour {
...
@@ -36,6 +36,8 @@ struct neighbour {
according to remote clock. */
according to remote clock. */
unsigned
int
hello_send_us
;
unsigned
int
hello_send_us
;
struct
timeval
hello_rtt_receive_time
;
struct
timeval
hello_rtt_receive_time
;
unsigned
int
rtt
;
struct
timeval
rtt_time
;
struct
interface
*
ifp
;
struct
interface
*
ifp
;
};
};
...
@@ -53,3 +55,4 @@ unsigned check_neighbours(void);
...
@@ -53,3 +55,4 @@ unsigned check_neighbours(void);
unsigned
neighbour_txcost
(
struct
neighbour
*
neigh
);
unsigned
neighbour_txcost
(
struct
neighbour
*
neigh
);
unsigned
neighbour_rxcost
(
struct
neighbour
*
neigh
);
unsigned
neighbour_rxcost
(
struct
neighbour
*
neigh
);
unsigned
neighbour_cost
(
struct
neighbour
*
neigh
);
unsigned
neighbour_cost
(
struct
neighbour
*
neigh
);
int
valid_rtt
(
struct
neighbour
*
neigh
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment