diff options
author | Antonio Quartulli <antonio@open-mesh.com> | 2013-09-02 12:15:07 +0200 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-23 15:33:12 +0200 |
commit | 81e26b1a1c0ad32a3c80e31024b5c4ff4842299a (patch) | |
tree | 09bbe714d5bf3a5fc56d407eac3a0f1d9760671e /net/batman-adv | |
parent | 6680a1249f76c28e19fc24b0c85f671b019c8bc7 (diff) | |
download | linux-81e26b1a1c0ad32a3c80e31024b5c4ff4842299a.tar.gz linux-81e26b1a1c0ad32a3c80e31024b5c4ff4842299a.tar.bz2 linux-81e26b1a1c0ad32a3c80e31024b5c4ff4842299a.zip |
batman-adv: adapt the neighbor purging routine to use the new API functions
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/originator.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 8d1b16eb12d1..9cee053f6a5c 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -378,16 +378,16 @@ free_orig_node: static bool batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, struct batadv_orig_node *orig_node, - struct batadv_neigh_node **best_neigh_node) + struct batadv_neigh_node **best_neigh) { + struct batadv_algo_ops *bao = bat_priv->bat_algo_ops; struct hlist_node *node_tmp; struct batadv_neigh_node *neigh_node; bool neigh_purged = false; unsigned long last_seen; struct batadv_hard_iface *if_incoming; - uint8_t best_metric = 0; - *best_neigh_node = NULL; + *best_neigh = NULL; spin_lock_bh(&orig_node->neigh_list_lock); @@ -420,11 +420,12 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, batadv_bonding_candidate_del(orig_node, neigh_node); batadv_neigh_node_free_ref(neigh_node); } else { - if ((!*best_neigh_node) || - (neigh_node->bat_iv.tq_avg > best_metric)) { - *best_neigh_node = neigh_node; - best_metric = neigh_node->bat_iv.tq_avg; - } + /* store the best_neighbour if this is the first + * iteration or if a better neighbor has been found + */ + if (!*best_neigh || + bao->bat_neigh_cmp(neigh_node, *best_neigh) > 0) + *best_neigh = neigh_node; } } |