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
31efc5c8
Commit
31efc5c8
authored
Jun 19, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify computation of neighbour cost.
parent
f0e3e486
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
neighbour.c
neighbour.c
+11
-12
No files found.
neighbour.c
View file @
31efc5c8
...
@@ -235,27 +235,26 @@ neighbour_rxcost(struct neighbour *neigh)
...
@@ -235,27 +235,26 @@ neighbour_rxcost(struct neighbour *neigh)
int
int
neighbour_cost
(
struct
neighbour
*
neigh
)
neighbour_cost
(
struct
neighbour
*
neigh
)
{
{
int
c
;
int
a
,
b
;
if
(
neigh
->
txcost
>=
INFINITY
)
a
=
neigh
->
txcost
;
if
(
a
>=
INFINITY
)
return
INFINITY
;
return
INFINITY
;
c
=
neighbour_rxcost
(
neigh
);
b
=
neighbour_rxcost
(
neigh
);
if
(
c
>=
INFINITY
)
if
(
b
>=
INFINITY
)
return
INFINITY
;
return
INFINITY
;
if
(
neigh
->
network
->
wired
)
{
if
(
a
<=
256
&&
b
<=
256
)
{
/* On a wired interface, only the txcost is significant.
return
MAX
(
a
,
b
);
However, a low txcost with a large rxcost probably indicates
a malfunctioning interface, so penalise it. This doesn't
matter much, as we usually don't perform link quality estimation
on wired interfaces. */
return
MIN
(
INFINITY
,
MAX
(
neigh
->
txcost
,
c
/
4
));
}
else
{
}
else
{
a
=
MAX
(
a
,
256
);
b
=
MAX
(
b
,
256
);
/* (1/(alpha * beta) + 1/beta) / 2, which is half the expected
/* (1/(alpha * beta) + 1/beta) / 2, which is half the expected
number of transmissions, in both directions.
number of transmissions, in both directions.
ETX uses 1/(alpha * beta), which is the expected number of
ETX uses 1/(alpha * beta), which is the expected number of
transmissions in the forward direction. */
transmissions in the forward direction. */
return
(
c
+
((
c
*
neigh
->
txcost
+
128
)
>>
8
)
+
1
)
/
2
;
return
(
((
a
*
b
+
128
)
>>
8
)
+
b
+
1
)
>>
1
;
}
}
}
}
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