diff options
Diffstat (limited to 'net/batman-adv/vis.c')
-rw-r--r-- | net/batman-adv/vis.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 22d2785177d1..c053244b97bd 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -97,7 +97,6 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data) | |||
97 | { | 97 | { |
98 | struct batadv_hashtable *hash = bat_priv->vis.hash; | 98 | struct batadv_hashtable *hash = bat_priv->vis.hash; |
99 | struct hlist_head *head; | 99 | struct hlist_head *head; |
100 | struct hlist_node *node; | ||
101 | struct batadv_vis_info *vis_info, *vis_info_tmp = NULL; | 100 | struct batadv_vis_info *vis_info, *vis_info_tmp = NULL; |
102 | uint32_t index; | 101 | uint32_t index; |
103 | 102 | ||
@@ -108,8 +107,8 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data) | |||
108 | head = &hash->table[index]; | 107 | head = &hash->table[index]; |
109 | 108 | ||
110 | rcu_read_lock(); | 109 | rcu_read_lock(); |
111 | hlist_for_each_entry_rcu(vis_info, node, head, hash_entry) { | 110 | hlist_for_each_entry_rcu(vis_info, head, hash_entry) { |
112 | if (!batadv_vis_info_cmp(node, data)) | 111 | if (!batadv_vis_info_cmp(&vis_info->hash_entry, data)) |
113 | continue; | 112 | continue; |
114 | 113 | ||
115 | vis_info_tmp = vis_info; | 114 | vis_info_tmp = vis_info; |
@@ -128,9 +127,8 @@ static void batadv_vis_data_insert_interface(const uint8_t *interface, | |||
128 | bool primary) | 127 | bool primary) |
129 | { | 128 | { |
130 | struct batadv_vis_if_list_entry *entry; | 129 | struct batadv_vis_if_list_entry *entry; |
131 | struct hlist_node *pos; | ||
132 | 130 | ||
133 | hlist_for_each_entry(entry, pos, if_list, list) { | 131 | hlist_for_each_entry(entry, if_list, list) { |
134 | if (batadv_compare_eth(entry->addr, interface)) | 132 | if (batadv_compare_eth(entry->addr, interface)) |
135 | return; | 133 | return; |
136 | } | 134 | } |
@@ -148,9 +146,8 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq, | |||
148 | const struct hlist_head *if_list) | 146 | const struct hlist_head *if_list) |
149 | { | 147 | { |
150 | struct batadv_vis_if_list_entry *entry; | 148 | struct batadv_vis_if_list_entry *entry; |
151 | struct hlist_node *pos; | ||
152 | 149 | ||
153 | hlist_for_each_entry(entry, pos, if_list, list) { | 150 | hlist_for_each_entry(entry, if_list, list) { |
154 | if (entry->primary) | 151 | if (entry->primary) |
155 | seq_printf(seq, "PRIMARY, "); | 152 | seq_printf(seq, "PRIMARY, "); |
156 | else | 153 | else |
@@ -198,9 +195,8 @@ static void batadv_vis_data_read_entries(struct seq_file *seq, | |||
198 | { | 195 | { |
199 | int i; | 196 | int i; |
200 | struct batadv_vis_if_list_entry *entry; | 197 | struct batadv_vis_if_list_entry *entry; |
201 | struct hlist_node *pos; | ||
202 | 198 | ||
203 | hlist_for_each_entry(entry, pos, list, list) { | 199 | hlist_for_each_entry(entry, list, list) { |
204 | seq_printf(seq, "%pM,", entry->addr); | 200 | seq_printf(seq, "%pM,", entry->addr); |
205 | 201 | ||
206 | for (i = 0; i < packet->entries; i++) | 202 | for (i = 0; i < packet->entries; i++) |
@@ -218,17 +214,16 @@ static void batadv_vis_data_read_entries(struct seq_file *seq, | |||
218 | static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, | 214 | static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, |
219 | const struct hlist_head *head) | 215 | const struct hlist_head *head) |
220 | { | 216 | { |
221 | struct hlist_node *node; | ||
222 | struct batadv_vis_info *info; | 217 | struct batadv_vis_info *info; |
223 | struct batadv_vis_packet *packet; | 218 | struct batadv_vis_packet *packet; |
224 | uint8_t *entries_pos; | 219 | uint8_t *entries_pos; |
225 | struct batadv_vis_info_entry *entries; | 220 | struct batadv_vis_info_entry *entries; |
226 | struct batadv_vis_if_list_entry *entry; | 221 | struct batadv_vis_if_list_entry *entry; |
227 | struct hlist_node *pos, *n; | 222 | struct hlist_node *n; |
228 | 223 | ||
229 | HLIST_HEAD(vis_if_list); | 224 | HLIST_HEAD(vis_if_list); |
230 | 225 | ||
231 | hlist_for_each_entry_rcu(info, node, head, hash_entry) { | 226 | hlist_for_each_entry_rcu(info, head, hash_entry) { |
232 | packet = (struct batadv_vis_packet *)info->skb_packet->data; | 227 | packet = (struct batadv_vis_packet *)info->skb_packet->data; |
233 | entries_pos = (uint8_t *)packet + sizeof(*packet); | 228 | entries_pos = (uint8_t *)packet + sizeof(*packet); |
234 | entries = (struct batadv_vis_info_entry *)entries_pos; | 229 | entries = (struct batadv_vis_info_entry *)entries_pos; |
@@ -240,7 +235,7 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, | |||
240 | batadv_vis_data_read_entries(seq, &vis_if_list, packet, | 235 | batadv_vis_data_read_entries(seq, &vis_if_list, packet, |
241 | entries); | 236 | entries); |
242 | 237 | ||
243 | hlist_for_each_entry_safe(entry, pos, n, &vis_if_list, list) { | 238 | hlist_for_each_entry_safe(entry, n, &vis_if_list, list) { |
244 | hlist_del(&entry->list); | 239 | hlist_del(&entry->list); |
245 | kfree(entry); | 240 | kfree(entry); |
246 | } | 241 | } |
@@ -519,7 +514,6 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv, | |||
519 | { | 514 | { |
520 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 515 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
521 | struct batadv_neigh_node *router; | 516 | struct batadv_neigh_node *router; |
522 | struct hlist_node *node; | ||
523 | struct hlist_head *head; | 517 | struct hlist_head *head; |
524 | struct batadv_orig_node *orig_node; | 518 | struct batadv_orig_node *orig_node; |
525 | struct batadv_vis_packet *packet; | 519 | struct batadv_vis_packet *packet; |
@@ -532,7 +526,7 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv, | |||
532 | head = &hash->table[i]; | 526 | head = &hash->table[i]; |
533 | 527 | ||
534 | rcu_read_lock(); | 528 | rcu_read_lock(); |
535 | hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { | 529 | hlist_for_each_entry_rcu(orig_node, head, hash_entry) { |
536 | router = batadv_orig_node_get_router(orig_node); | 530 | router = batadv_orig_node_get_router(orig_node); |
537 | if (!router) | 531 | if (!router) |
538 | continue; | 532 | continue; |
@@ -571,7 +565,6 @@ static bool batadv_vis_packet_full(const struct batadv_vis_info *info) | |||
571 | static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) | 565 | static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) |
572 | { | 566 | { |
573 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 567 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
574 | struct hlist_node *node; | ||
575 | struct hlist_head *head; | 568 | struct hlist_head *head; |
576 | struct batadv_orig_node *orig_node; | 569 | struct batadv_orig_node *orig_node; |
577 | struct batadv_neigh_node *router; | 570 | struct batadv_neigh_node *router; |
@@ -605,7 +598,7 @@ static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) | |||
605 | head = &hash->table[i]; | 598 | head = &hash->table[i]; |
606 | 599 | ||
607 | rcu_read_lock(); | 600 | rcu_read_lock(); |
608 | hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { | 601 | hlist_for_each_entry_rcu(orig_node, head, hash_entry) { |
609 | router = batadv_orig_node_get_router(orig_node); | 602 | router = batadv_orig_node_get_router(orig_node); |
610 | if (!router) | 603 | if (!router) |
611 | continue; | 604 | continue; |
@@ -644,7 +637,7 @@ next: | |||
644 | head = &hash->table[i]; | 637 | head = &hash->table[i]; |
645 | 638 | ||
646 | rcu_read_lock(); | 639 | rcu_read_lock(); |
647 | hlist_for_each_entry_rcu(tt_common_entry, node, head, | 640 | hlist_for_each_entry_rcu(tt_common_entry, head, |
648 | hash_entry) { | 641 | hash_entry) { |
649 | packet_pos = skb_put(info->skb_packet, sizeof(*entry)); | 642 | packet_pos = skb_put(info->skb_packet, sizeof(*entry)); |
650 | entry = (struct batadv_vis_info_entry *)packet_pos; | 643 | entry = (struct batadv_vis_info_entry *)packet_pos; |
@@ -673,14 +666,14 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) | |||
673 | { | 666 | { |
674 | uint32_t i; | 667 | uint32_t i; |
675 | struct batadv_hashtable *hash = bat_priv->vis.hash; | 668 | struct batadv_hashtable *hash = bat_priv->vis.hash; |
676 | struct hlist_node *node, *node_tmp; | 669 | struct hlist_node *node_tmp; |
677 | struct hlist_head *head; | 670 | struct hlist_head *head; |
678 | struct batadv_vis_info *info; | 671 | struct batadv_vis_info *info; |
679 | 672 | ||
680 | for (i = 0; i < hash->size; i++) { | 673 | for (i = 0; i < hash->size; i++) { |
681 | head = &hash->table[i]; | 674 | head = &hash->table[i]; |
682 | 675 | ||
683 | hlist_for_each_entry_safe(info, node, node_tmp, | 676 | hlist_for_each_entry_safe(info, node_tmp, |
684 | head, hash_entry) { | 677 | head, hash_entry) { |
685 | /* never purge own data. */ | 678 | /* never purge own data. */ |
686 | if (info == bat_priv->vis.my_info) | 679 | if (info == bat_priv->vis.my_info) |
@@ -688,7 +681,7 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) | |||
688 | 681 | ||
689 | if (batadv_has_timed_out(info->first_seen, | 682 | if (batadv_has_timed_out(info->first_seen, |
690 | BATADV_VIS_TIMEOUT)) { | 683 | BATADV_VIS_TIMEOUT)) { |
691 | hlist_del(node); | 684 | hlist_del(&info->hash_entry); |
692 | batadv_send_list_del(info); | 685 | batadv_send_list_del(info); |
693 | kref_put(&info->refcount, batadv_free_info); | 686 | kref_put(&info->refcount, batadv_free_info); |
694 | } | 687 | } |
@@ -700,7 +693,6 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv, | |||
700 | struct batadv_vis_info *info) | 693 | struct batadv_vis_info *info) |
701 | { | 694 | { |
702 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 695 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
703 | struct hlist_node *node; | ||
704 | struct hlist_head *head; | 696 | struct hlist_head *head; |
705 | struct batadv_orig_node *orig_node; | 697 | struct batadv_orig_node *orig_node; |
706 | struct batadv_vis_packet *packet; | 698 | struct batadv_vis_packet *packet; |
@@ -715,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv, | |||
715 | head = &hash->table[i]; | 707 | head = &hash->table[i]; |
716 | 708 | ||
717 | rcu_read_lock(); | 709 | rcu_read_lock(); |
718 | hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { | 710 | hlist_for_each_entry_rcu(orig_node, head, hash_entry) { |
719 | /* if it's a vis server and reachable, send it. */ | 711 | /* if it's a vis server and reachable, send it. */ |
720 | if (!(orig_node->flags & BATADV_VIS_SERVER)) | 712 | if (!(orig_node->flags & BATADV_VIS_SERVER)) |
721 | continue; | 713 | continue; |