diff options
author | Antonio Quartulli <antonio@open-mesh.com> | 2013-09-02 06:15:07 -0400 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-23 09:33:12 -0400 |
commit | 81e26b1a1c0ad32a3c80e31024b5c4ff4842299a (patch) | |
tree | 09bbe714d5bf3a5fc56d407eac3a0f1d9760671e /net/batman-adv | |
parent | 6680a1249f76c28e19fc24b0c85f671b019c8bc7 (diff) |
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: | |||
378 | static bool | 378 | static bool |
379 | batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, | 379 | batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, |
380 | struct batadv_orig_node *orig_node, | 380 | struct batadv_orig_node *orig_node, |
381 | struct batadv_neigh_node **best_neigh_node) | 381 | struct batadv_neigh_node **best_neigh) |
382 | { | 382 | { |
383 | struct batadv_algo_ops *bao = bat_priv->bat_algo_ops; | ||
383 | struct hlist_node *node_tmp; | 384 | struct hlist_node *node_tmp; |
384 | struct batadv_neigh_node *neigh_node; | 385 | struct batadv_neigh_node *neigh_node; |
385 | bool neigh_purged = false; | 386 | bool neigh_purged = false; |
386 | unsigned long last_seen; | 387 | unsigned long last_seen; |
387 | struct batadv_hard_iface *if_incoming; | 388 | struct batadv_hard_iface *if_incoming; |
388 | uint8_t best_metric = 0; | ||
389 | 389 | ||
390 | *best_neigh_node = NULL; | 390 | *best_neigh = NULL; |
391 | 391 | ||
392 | spin_lock_bh(&orig_node->neigh_list_lock); | 392 | spin_lock_bh(&orig_node->neigh_list_lock); |
393 | 393 | ||
@@ -420,11 +420,12 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, | |||
420 | batadv_bonding_candidate_del(orig_node, neigh_node); | 420 | batadv_bonding_candidate_del(orig_node, neigh_node); |
421 | batadv_neigh_node_free_ref(neigh_node); | 421 | batadv_neigh_node_free_ref(neigh_node); |
422 | } else { | 422 | } else { |
423 | if ((!*best_neigh_node) || | 423 | /* store the best_neighbour if this is the first |
424 | (neigh_node->bat_iv.tq_avg > best_metric)) { | 424 | * iteration or if a better neighbor has been found |
425 | *best_neigh_node = neigh_node; | 425 | */ |
426 | best_metric = neigh_node->bat_iv.tq_avg; | 426 | if (!*best_neigh || |
427 | } | 427 | bao->bat_neigh_cmp(neigh_node, *best_neigh) > 0) |
428 | *best_neigh = neigh_node; | ||
428 | } | 429 | } |
429 | } | 430 | } |
430 | 431 | ||