summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorAntonio Quartulli <antonio@open-mesh.com>2013-09-02 12:15:01 +0200
committerAntonio Quartulli <antonio@meshcoding.com>2013-10-23 15:33:08 +0200
commit0538f7599157b7bdef1814472048de5351c4fd6d (patch)
tree993f541259033b13a2d7847a2c735baf653b2130 /net/batman-adv/routing.c
parentmacvlan: resolve ENOENT errors on creation (diff)
downloadlinux-0538f7599157b7bdef1814472048de5351c4fd6d.tar.xz
linux-0538f7599157b7bdef1814472048de5351c4fd6d.zip
batman-adv: make struct batadv_neigh_node algorithm agnostic
some of the fields in struct batadv_neigh_node are strictly related to the B.A.T.M.A.N. IV algorithm. In order to make the struct usable by any routing algorithm it has to be split and made more generic Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4bcf22129ffe..5b78a71c1b02 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -119,7 +119,7 @@ void batadv_bonding_candidate_add(struct batadv_orig_node *orig_node,
struct batadv_neigh_node *neigh_node)
{
struct batadv_neigh_node *tmp_neigh_node, *router = NULL;
- uint8_t interference_candidate = 0;
+ uint8_t interference_candidate = 0, tq;
spin_lock_bh(&orig_node->neigh_list_lock);
@@ -132,8 +132,10 @@ void batadv_bonding_candidate_add(struct batadv_orig_node *orig_node,
if (!router)
goto candidate_del;
+
/* ... and is good enough to be considered */
- if (neigh_node->tq_avg < router->tq_avg - BATADV_BONDING_TQ_THRESHOLD)
+ tq = router->bat_iv.tq_avg - BATADV_BONDING_TQ_THRESHOLD;
+ if (neigh_node->bat_iv.tq_avg < tq)
goto candidate_del;
/* check if we have another candidate with the same mac address or
@@ -502,7 +504,8 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
if (tmp_neigh_node->if_incoming == recv_if)
continue;
- if (router && tmp_neigh_node->tq_avg <= router->tq_avg)
+ if (router &&
+ tmp_neigh_node->bat_iv.tq_avg <= router->bat_iv.tq_avg)
continue;
if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))