aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2010-12-12 16:57:11 -0500
committerMarek Lindner <lindner_marek@yahoo.de>2011-03-05 06:49:53 -0500
commit9591a79f280ede740e44aeb8ad93a6692d482dce (patch)
tree4472796690f19a55f56a1974537a120965978903 /net/batman-adv/routing.c
parenta8e7f4bc38c4a90ee308cd7f1f8604f71db59d05 (diff)
batman-adv: convert neighbor list to hlist
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 36351d374f28..e8379ba25e95 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -149,12 +149,12 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
149{ 149{
150 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 150 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
151 struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; 151 struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
152 struct hlist_node *node;
152 unsigned char total_count; 153 unsigned char total_count;
153 154
154 if (orig_node == orig_neigh_node) { 155 if (orig_node == orig_neigh_node) {
155 list_for_each_entry(tmp_neigh_node, 156 hlist_for_each_entry(tmp_neigh_node, node,
156 &orig_node->neigh_list, 157 &orig_node->neigh_list, list) {
157 list) {
158 158
159 if (compare_orig(tmp_neigh_node->addr, 159 if (compare_orig(tmp_neigh_node->addr,
160 orig_neigh_node->orig) && 160 orig_neigh_node->orig) &&
@@ -174,8 +174,8 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
174 neigh_node->last_valid = jiffies; 174 neigh_node->last_valid = jiffies;
175 } else { 175 } else {
176 /* find packet count of corresponding one hop neighbor */ 176 /* find packet count of corresponding one hop neighbor */
177 list_for_each_entry(tmp_neigh_node, 177 hlist_for_each_entry(tmp_neigh_node, node,
178 &orig_neigh_node->neigh_list, list) { 178 &orig_neigh_node->neigh_list, list) {
179 179
180 if (compare_orig(tmp_neigh_node->addr, 180 if (compare_orig(tmp_neigh_node->addr,
181 orig_neigh_node->orig) && 181 orig_neigh_node->orig) &&
@@ -260,12 +260,14 @@ static void update_orig(struct bat_priv *bat_priv,
260 char is_duplicate) 260 char is_duplicate)
261{ 261{
262 struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; 262 struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
263 struct hlist_node *node;
263 int tmp_hna_buff_len; 264 int tmp_hna_buff_len;
264 265
265 bat_dbg(DBG_BATMAN, bat_priv, "update_originator(): " 266 bat_dbg(DBG_BATMAN, bat_priv, "update_originator(): "
266 "Searching and updating originator entry of received packet\n"); 267 "Searching and updating originator entry of received packet\n");
267 268
268 list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { 269 hlist_for_each_entry(tmp_neigh_node, node,
270 &orig_node->neigh_list, list) {
269 if (compare_orig(tmp_neigh_node->addr, ethhdr->h_source) && 271 if (compare_orig(tmp_neigh_node->addr, ethhdr->h_source) &&
270 (tmp_neigh_node->if_incoming == if_incoming)) { 272 (tmp_neigh_node->if_incoming == if_incoming)) {
271 neigh_node = tmp_neigh_node; 273 neigh_node = tmp_neigh_node;
@@ -391,6 +393,7 @@ static char count_real_packets(struct ethhdr *ethhdr,
391 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 393 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
392 struct orig_node *orig_node; 394 struct orig_node *orig_node;
393 struct neigh_node *tmp_neigh_node; 395 struct neigh_node *tmp_neigh_node;
396 struct hlist_node *node;
394 char is_duplicate = 0; 397 char is_duplicate = 0;
395 int32_t seq_diff; 398 int32_t seq_diff;
396 int need_update = 0; 399 int need_update = 0;
@@ -407,7 +410,8 @@ static char count_real_packets(struct ethhdr *ethhdr,
407 &orig_node->batman_seqno_reset)) 410 &orig_node->batman_seqno_reset))
408 return -1; 411 return -1;
409 412
410 list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { 413 hlist_for_each_entry(tmp_neigh_node, node,
414 &orig_node->neigh_list, list) {
411 415
412 is_duplicate |= get_bit_status(tmp_neigh_node->real_bits, 416 is_duplicate |= get_bit_status(tmp_neigh_node->real_bits,
413 orig_node->last_real_seqno, 417 orig_node->last_real_seqno,
@@ -457,6 +461,7 @@ void update_bonding_candidates(struct orig_node *orig_node)
457 int candidates; 461 int candidates;
458 int interference_candidate; 462 int interference_candidate;
459 int best_tq; 463 int best_tq;
464 struct hlist_node *node, *node2;
460 struct neigh_node *tmp_neigh_node, *tmp_neigh_node2; 465 struct neigh_node *tmp_neigh_node, *tmp_neigh_node2;
461 struct neigh_node *first_candidate, *last_candidate; 466 struct neigh_node *first_candidate, *last_candidate;
462 467
@@ -476,13 +481,15 @@ void update_bonding_candidates(struct orig_node *orig_node)
476 * as "bonding partner" */ 481 * as "bonding partner" */
477 482
478 /* first, zero the list */ 483 /* first, zero the list */
479 list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { 484 hlist_for_each_entry(tmp_neigh_node, node,
485 &orig_node->neigh_list, list) {
480 tmp_neigh_node->next_bond_candidate = NULL; 486 tmp_neigh_node->next_bond_candidate = NULL;
481 } 487 }
482 488
483 first_candidate = NULL; 489 first_candidate = NULL;
484 last_candidate = NULL; 490 last_candidate = NULL;
485 list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { 491 hlist_for_each_entry(tmp_neigh_node, node,
492 &orig_node->neigh_list, list) {
486 493
487 /* only consider if it has the same primary address ... */ 494 /* only consider if it has the same primary address ... */
488 if (memcmp(orig_node->orig, 495 if (memcmp(orig_node->orig,
@@ -499,8 +506,8 @@ void update_bonding_candidates(struct orig_node *orig_node)
499 * select this candidate because of possible interference. */ 506 * select this candidate because of possible interference. */
500 507
501 interference_candidate = 0; 508 interference_candidate = 0;
502 list_for_each_entry(tmp_neigh_node2, 509 hlist_for_each_entry(tmp_neigh_node2, node2,
503 &orig_node->neigh_list, list) { 510 &orig_node->neigh_list, list) {
504 511
505 if (tmp_neigh_node2 == tmp_neigh_node) 512 if (tmp_neigh_node2 == tmp_neigh_node)
506 continue; 513 continue;