diff options
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 446 |
1 files changed, 231 insertions, 215 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 48217cc6729d..245cc9a068d8 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -29,34 +29,35 @@ | |||
29 | 29 | ||
30 | #include <linux/crc16.h> | 30 | #include <linux/crc16.h> |
31 | 31 | ||
32 | static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, | 32 | static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client, |
33 | struct orig_node *orig_node); | 33 | struct batadv_orig_node *orig_node); |
34 | static void batadv_tt_purge(struct work_struct *work); | 34 | static void batadv_tt_purge(struct work_struct *work); |
35 | static void | 35 | static void |
36 | batadv_tt_global_del_orig_list(struct tt_global_entry *tt_global_entry); | 36 | batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry); |
37 | 37 | ||
38 | /* returns 1 if they are the same mac addr */ | 38 | /* returns 1 if they are the same mac addr */ |
39 | static int batadv_compare_tt(const struct hlist_node *node, const void *data2) | 39 | static int batadv_compare_tt(const struct hlist_node *node, const void *data2) |
40 | { | 40 | { |
41 | const void *data1 = container_of(node, struct tt_common_entry, | 41 | const void *data1 = container_of(node, struct batadv_tt_common_entry, |
42 | hash_entry); | 42 | hash_entry); |
43 | 43 | ||
44 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 44 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void batadv_tt_start_timer(struct bat_priv *bat_priv) | 47 | static void batadv_tt_start_timer(struct batadv_priv *bat_priv) |
48 | { | 48 | { |
49 | INIT_DELAYED_WORK(&bat_priv->tt_work, batadv_tt_purge); | 49 | INIT_DELAYED_WORK(&bat_priv->tt_work, batadv_tt_purge); |
50 | queue_delayed_work(batadv_event_workqueue, &bat_priv->tt_work, | 50 | queue_delayed_work(batadv_event_workqueue, &bat_priv->tt_work, |
51 | msecs_to_jiffies(5000)); | 51 | msecs_to_jiffies(5000)); |
52 | } | 52 | } |
53 | 53 | ||
54 | static struct tt_common_entry * | 54 | static struct batadv_tt_common_entry * |
55 | batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) | 55 | batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) |
56 | { | 56 | { |
57 | struct hlist_head *head; | 57 | struct hlist_head *head; |
58 | struct hlist_node *node; | 58 | struct hlist_node *node; |
59 | struct tt_common_entry *tt_common_entry, *tt_common_entry_tmp = NULL; | 59 | struct batadv_tt_common_entry *tt_common_entry; |
60 | struct batadv_tt_common_entry *tt_common_entry_tmp = NULL; | ||
60 | uint32_t index; | 61 | uint32_t index; |
61 | 62 | ||
62 | if (!hash) | 63 | if (!hash) |
@@ -81,35 +82,37 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) | |||
81 | return tt_common_entry_tmp; | 82 | return tt_common_entry_tmp; |
82 | } | 83 | } |
83 | 84 | ||
84 | static struct tt_local_entry * | 85 | static struct batadv_tt_local_entry * |
85 | batadv_tt_local_hash_find(struct bat_priv *bat_priv, const void *data) | 86 | batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const void *data) |
86 | { | 87 | { |
87 | struct tt_common_entry *tt_common_entry; | 88 | struct batadv_tt_common_entry *tt_common_entry; |
88 | struct tt_local_entry *tt_local_entry = NULL; | 89 | struct batadv_tt_local_entry *tt_local_entry = NULL; |
89 | 90 | ||
90 | tt_common_entry = batadv_tt_hash_find(bat_priv->tt_local_hash, data); | 91 | tt_common_entry = batadv_tt_hash_find(bat_priv->tt_local_hash, data); |
91 | if (tt_common_entry) | 92 | if (tt_common_entry) |
92 | tt_local_entry = container_of(tt_common_entry, | 93 | tt_local_entry = container_of(tt_common_entry, |
93 | struct tt_local_entry, common); | 94 | struct batadv_tt_local_entry, |
95 | common); | ||
94 | return tt_local_entry; | 96 | return tt_local_entry; |
95 | } | 97 | } |
96 | 98 | ||
97 | static struct tt_global_entry * | 99 | static struct batadv_tt_global_entry * |
98 | batadv_tt_global_hash_find(struct bat_priv *bat_priv, const void *data) | 100 | batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const void *data) |
99 | { | 101 | { |
100 | struct tt_common_entry *tt_common_entry; | 102 | struct batadv_tt_common_entry *tt_common_entry; |
101 | struct tt_global_entry *tt_global_entry = NULL; | 103 | struct batadv_tt_global_entry *tt_global_entry = NULL; |
102 | 104 | ||
103 | tt_common_entry = batadv_tt_hash_find(bat_priv->tt_global_hash, data); | 105 | tt_common_entry = batadv_tt_hash_find(bat_priv->tt_global_hash, data); |
104 | if (tt_common_entry) | 106 | if (tt_common_entry) |
105 | tt_global_entry = container_of(tt_common_entry, | 107 | tt_global_entry = container_of(tt_common_entry, |
106 | struct tt_global_entry, common); | 108 | struct batadv_tt_global_entry, |
109 | common); | ||
107 | return tt_global_entry; | 110 | return tt_global_entry; |
108 | 111 | ||
109 | } | 112 | } |
110 | 113 | ||
111 | static void | 114 | static void |
112 | batadv_tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry) | 115 | batadv_tt_local_entry_free_ref(struct batadv_tt_local_entry *tt_local_entry) |
113 | { | 116 | { |
114 | if (atomic_dec_and_test(&tt_local_entry->common.refcount)) | 117 | if (atomic_dec_and_test(&tt_local_entry->common.refcount)) |
115 | kfree_rcu(tt_local_entry, common.rcu); | 118 | kfree_rcu(tt_local_entry, common.rcu); |
@@ -117,18 +120,18 @@ batadv_tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry) | |||
117 | 120 | ||
118 | static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu) | 121 | static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu) |
119 | { | 122 | { |
120 | struct tt_common_entry *tt_common_entry; | 123 | struct batadv_tt_common_entry *tt_common_entry; |
121 | struct tt_global_entry *tt_global_entry; | 124 | struct batadv_tt_global_entry *tt_global_entry; |
122 | 125 | ||
123 | tt_common_entry = container_of(rcu, struct tt_common_entry, rcu); | 126 | tt_common_entry = container_of(rcu, struct batadv_tt_common_entry, rcu); |
124 | tt_global_entry = container_of(tt_common_entry, struct tt_global_entry, | 127 | tt_global_entry = container_of(tt_common_entry, |
125 | common); | 128 | struct batadv_tt_global_entry, common); |
126 | 129 | ||
127 | kfree(tt_global_entry); | 130 | kfree(tt_global_entry); |
128 | } | 131 | } |
129 | 132 | ||
130 | static void | 133 | static void |
131 | batadv_tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) | 134 | batadv_tt_global_entry_free_ref(struct batadv_tt_global_entry *tt_global_entry) |
132 | { | 135 | { |
133 | if (atomic_dec_and_test(&tt_global_entry->common.refcount)) { | 136 | if (atomic_dec_and_test(&tt_global_entry->common.refcount)) { |
134 | batadv_tt_global_del_orig_list(tt_global_entry); | 137 | batadv_tt_global_del_orig_list(tt_global_entry); |
@@ -139,25 +142,25 @@ batadv_tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) | |||
139 | 142 | ||
140 | static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu) | 143 | static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu) |
141 | { | 144 | { |
142 | struct tt_orig_list_entry *orig_entry; | 145 | struct batadv_tt_orig_list_entry *orig_entry; |
143 | 146 | ||
144 | orig_entry = container_of(rcu, struct tt_orig_list_entry, rcu); | 147 | orig_entry = container_of(rcu, struct batadv_tt_orig_list_entry, rcu); |
145 | batadv_orig_node_free_ref(orig_entry->orig_node); | 148 | batadv_orig_node_free_ref(orig_entry->orig_node); |
146 | kfree(orig_entry); | 149 | kfree(orig_entry); |
147 | } | 150 | } |
148 | 151 | ||
149 | static void | 152 | static void |
150 | batadv_tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry) | 153 | batadv_tt_orig_list_entry_free_ref(struct batadv_tt_orig_list_entry *orig_entry) |
151 | { | 154 | { |
152 | /* to avoid race conditions, immediately decrease the tt counter */ | 155 | /* to avoid race conditions, immediately decrease the tt counter */ |
153 | atomic_dec(&orig_entry->orig_node->tt_size); | 156 | atomic_dec(&orig_entry->orig_node->tt_size); |
154 | call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu); | 157 | call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu); |
155 | } | 158 | } |
156 | 159 | ||
157 | static void batadv_tt_local_event(struct bat_priv *bat_priv, | 160 | static void batadv_tt_local_event(struct batadv_priv *bat_priv, |
158 | const uint8_t *addr, uint8_t flags) | 161 | const uint8_t *addr, uint8_t flags) |
159 | { | 162 | { |
160 | struct tt_change_node *tt_change_node, *entry, *safe; | 163 | struct batadv_tt_change_node *tt_change_node, *entry, *safe; |
161 | bool event_removed = false; | 164 | bool event_removed = false; |
162 | bool del_op_requested, del_op_entry; | 165 | bool del_op_requested, del_op_entry; |
163 | 166 | ||
@@ -215,7 +218,7 @@ int batadv_tt_len(int changes_num) | |||
215 | return changes_num * sizeof(struct batadv_tt_change); | 218 | return changes_num * sizeof(struct batadv_tt_change); |
216 | } | 219 | } |
217 | 220 | ||
218 | static int batadv_tt_local_init(struct bat_priv *bat_priv) | 221 | static int batadv_tt_local_init(struct batadv_priv *bat_priv) |
219 | { | 222 | { |
220 | if (bat_priv->tt_local_hash) | 223 | if (bat_priv->tt_local_hash) |
221 | return 0; | 224 | return 0; |
@@ -231,12 +234,12 @@ static int batadv_tt_local_init(struct bat_priv *bat_priv) | |||
231 | void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | 234 | void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, |
232 | int ifindex) | 235 | int ifindex) |
233 | { | 236 | { |
234 | struct bat_priv *bat_priv = netdev_priv(soft_iface); | 237 | struct batadv_priv *bat_priv = netdev_priv(soft_iface); |
235 | struct tt_local_entry *tt_local_entry = NULL; | 238 | struct batadv_tt_local_entry *tt_local_entry = NULL; |
236 | struct tt_global_entry *tt_global_entry = NULL; | 239 | struct batadv_tt_global_entry *tt_global_entry = NULL; |
237 | struct hlist_head *head; | 240 | struct hlist_head *head; |
238 | struct hlist_node *node; | 241 | struct hlist_node *node; |
239 | struct tt_orig_list_entry *orig_entry; | 242 | struct batadv_tt_orig_list_entry *orig_entry; |
240 | int hash_added; | 243 | int hash_added; |
241 | 244 | ||
242 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); | 245 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); |
@@ -333,12 +336,12 @@ static void batadv_tt_realloc_packet_buff(unsigned char **packet_buff, | |||
333 | } | 336 | } |
334 | } | 337 | } |
335 | 338 | ||
336 | static void batadv_tt_prepare_packet_buff(struct bat_priv *bat_priv, | 339 | static void batadv_tt_prepare_packet_buff(struct batadv_priv *bat_priv, |
337 | unsigned char **packet_buff, | 340 | unsigned char **packet_buff, |
338 | int *packet_buff_len, | 341 | int *packet_buff_len, |
339 | int min_packet_len) | 342 | int min_packet_len) |
340 | { | 343 | { |
341 | struct hard_iface *primary_if; | 344 | struct batadv_hard_iface *primary_if; |
342 | int req_len; | 345 | int req_len; |
343 | 346 | ||
344 | primary_if = batadv_primary_if_get_selected(bat_priv); | 347 | primary_if = batadv_primary_if_get_selected(bat_priv); |
@@ -359,12 +362,12 @@ static void batadv_tt_prepare_packet_buff(struct bat_priv *bat_priv, | |||
359 | batadv_hardif_free_ref(primary_if); | 362 | batadv_hardif_free_ref(primary_if); |
360 | } | 363 | } |
361 | 364 | ||
362 | static int batadv_tt_changes_fill_buff(struct bat_priv *bat_priv, | 365 | static int batadv_tt_changes_fill_buff(struct batadv_priv *bat_priv, |
363 | unsigned char **packet_buff, | 366 | unsigned char **packet_buff, |
364 | int *packet_buff_len, | 367 | int *packet_buff_len, |
365 | int min_packet_len) | 368 | int min_packet_len) |
366 | { | 369 | { |
367 | struct tt_change_node *entry, *safe; | 370 | struct batadv_tt_change_node *entry, *safe; |
368 | int count = 0, tot_changes = 0, new_len; | 371 | int count = 0, tot_changes = 0, new_len; |
369 | unsigned char *tt_buff; | 372 | unsigned char *tt_buff; |
370 | 373 | ||
@@ -416,10 +419,10 @@ static int batadv_tt_changes_fill_buff(struct bat_priv *bat_priv, | |||
416 | int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | 419 | int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) |
417 | { | 420 | { |
418 | struct net_device *net_dev = (struct net_device *)seq->private; | 421 | struct net_device *net_dev = (struct net_device *)seq->private; |
419 | struct bat_priv *bat_priv = netdev_priv(net_dev); | 422 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
420 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; | 423 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; |
421 | struct tt_common_entry *tt_common_entry; | 424 | struct batadv_tt_common_entry *tt_common_entry; |
422 | struct hard_iface *primary_if; | 425 | struct batadv_hard_iface *primary_if; |
423 | struct hlist_node *node; | 426 | struct hlist_node *node; |
424 | struct hlist_head *head; | 427 | struct hlist_head *head; |
425 | uint32_t i; | 428 | uint32_t i; |
@@ -471,9 +474,10 @@ out: | |||
471 | return ret; | 474 | return ret; |
472 | } | 475 | } |
473 | 476 | ||
474 | static void batadv_tt_local_set_pending(struct bat_priv *bat_priv, | 477 | static void |
475 | struct tt_local_entry *tt_local_entry, | 478 | batadv_tt_local_set_pending(struct batadv_priv *bat_priv, |
476 | uint16_t flags, const char *message) | 479 | struct batadv_tt_local_entry *tt_local_entry, |
480 | uint16_t flags, const char *message) | ||
477 | { | 481 | { |
478 | batadv_tt_local_event(bat_priv, tt_local_entry->common.addr, | 482 | batadv_tt_local_event(bat_priv, tt_local_entry->common.addr, |
479 | tt_local_entry->common.flags | flags); | 483 | tt_local_entry->common.flags | flags); |
@@ -489,10 +493,10 @@ static void batadv_tt_local_set_pending(struct bat_priv *bat_priv, | |||
489 | tt_local_entry->common.addr, message); | 493 | tt_local_entry->common.addr, message); |
490 | } | 494 | } |
491 | 495 | ||
492 | void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, | 496 | void batadv_tt_local_remove(struct batadv_priv *bat_priv, const uint8_t *addr, |
493 | const char *message, bool roaming) | 497 | const char *message, bool roaming) |
494 | { | 498 | { |
495 | struct tt_local_entry *tt_local_entry = NULL; | 499 | struct batadv_tt_local_entry *tt_local_entry = NULL; |
496 | uint16_t flags; | 500 | uint16_t flags; |
497 | 501 | ||
498 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); | 502 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); |
@@ -509,17 +513,18 @@ out: | |||
509 | batadv_tt_local_entry_free_ref(tt_local_entry); | 513 | batadv_tt_local_entry_free_ref(tt_local_entry); |
510 | } | 514 | } |
511 | 515 | ||
512 | static void batadv_tt_local_purge_list(struct bat_priv *bat_priv, | 516 | static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, |
513 | struct hlist_head *head) | 517 | struct hlist_head *head) |
514 | { | 518 | { |
515 | struct tt_local_entry *tt_local_entry; | 519 | struct batadv_tt_local_entry *tt_local_entry; |
516 | struct tt_common_entry *tt_common_entry; | 520 | struct batadv_tt_common_entry *tt_common_entry; |
517 | struct hlist_node *node, *node_tmp; | 521 | struct hlist_node *node, *node_tmp; |
518 | 522 | ||
519 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, | 523 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, |
520 | hash_entry) { | 524 | hash_entry) { |
521 | tt_local_entry = container_of(tt_common_entry, | 525 | tt_local_entry = container_of(tt_common_entry, |
522 | struct tt_local_entry, common); | 526 | struct batadv_tt_local_entry, |
527 | common); | ||
523 | if (tt_local_entry->common.flags & BATADV_TT_CLIENT_NOPURGE) | 528 | if (tt_local_entry->common.flags & BATADV_TT_CLIENT_NOPURGE) |
524 | continue; | 529 | continue; |
525 | 530 | ||
@@ -536,7 +541,7 @@ static void batadv_tt_local_purge_list(struct bat_priv *bat_priv, | |||
536 | } | 541 | } |
537 | } | 542 | } |
538 | 543 | ||
539 | static void batadv_tt_local_purge(struct bat_priv *bat_priv) | 544 | static void batadv_tt_local_purge(struct batadv_priv *bat_priv) |
540 | { | 545 | { |
541 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; | 546 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; |
542 | struct hlist_head *head; | 547 | struct hlist_head *head; |
@@ -554,12 +559,12 @@ static void batadv_tt_local_purge(struct bat_priv *bat_priv) | |||
554 | 559 | ||
555 | } | 560 | } |
556 | 561 | ||
557 | static void batadv_tt_local_table_free(struct bat_priv *bat_priv) | 562 | static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) |
558 | { | 563 | { |
559 | struct batadv_hashtable *hash; | 564 | struct batadv_hashtable *hash; |
560 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 565 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
561 | struct tt_common_entry *tt_common_entry; | 566 | struct batadv_tt_common_entry *tt_common_entry; |
562 | struct tt_local_entry *tt_local_entry; | 567 | struct batadv_tt_local_entry *tt_local; |
563 | struct hlist_node *node, *node_tmp; | 568 | struct hlist_node *node, *node_tmp; |
564 | struct hlist_head *head; | 569 | struct hlist_head *head; |
565 | uint32_t i; | 570 | uint32_t i; |
@@ -577,10 +582,10 @@ static void batadv_tt_local_table_free(struct bat_priv *bat_priv) | |||
577 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, | 582 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, |
578 | head, hash_entry) { | 583 | head, hash_entry) { |
579 | hlist_del_rcu(node); | 584 | hlist_del_rcu(node); |
580 | tt_local_entry = container_of(tt_common_entry, | 585 | tt_local = container_of(tt_common_entry, |
581 | struct tt_local_entry, | 586 | struct batadv_tt_local_entry, |
582 | common); | 587 | common); |
583 | batadv_tt_local_entry_free_ref(tt_local_entry); | 588 | batadv_tt_local_entry_free_ref(tt_local); |
584 | } | 589 | } |
585 | spin_unlock_bh(list_lock); | 590 | spin_unlock_bh(list_lock); |
586 | } | 591 | } |
@@ -590,7 +595,7 @@ static void batadv_tt_local_table_free(struct bat_priv *bat_priv) | |||
590 | bat_priv->tt_local_hash = NULL; | 595 | bat_priv->tt_local_hash = NULL; |
591 | } | 596 | } |
592 | 597 | ||
593 | static int batadv_tt_global_init(struct bat_priv *bat_priv) | 598 | static int batadv_tt_global_init(struct batadv_priv *bat_priv) |
594 | { | 599 | { |
595 | if (bat_priv->tt_global_hash) | 600 | if (bat_priv->tt_global_hash) |
596 | return 0; | 601 | return 0; |
@@ -603,9 +608,9 @@ static int batadv_tt_global_init(struct bat_priv *bat_priv) | |||
603 | return 0; | 608 | return 0; |
604 | } | 609 | } |
605 | 610 | ||
606 | static void batadv_tt_changes_list_free(struct bat_priv *bat_priv) | 611 | static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) |
607 | { | 612 | { |
608 | struct tt_change_node *entry, *safe; | 613 | struct batadv_tt_change_node *entry, *safe; |
609 | 614 | ||
610 | spin_lock_bh(&bat_priv->tt_changes_list_lock); | 615 | spin_lock_bh(&bat_priv->tt_changes_list_lock); |
611 | 616 | ||
@@ -622,10 +627,11 @@ static void batadv_tt_changes_list_free(struct bat_priv *bat_priv) | |||
622 | /* find out if an orig_node is already in the list of a tt_global_entry. | 627 | /* find out if an orig_node is already in the list of a tt_global_entry. |
623 | * returns 1 if found, 0 otherwise | 628 | * returns 1 if found, 0 otherwise |
624 | */ | 629 | */ |
625 | static bool batadv_tt_global_entry_has_orig(const struct tt_global_entry *entry, | 630 | static bool |
626 | const struct orig_node *orig_node) | 631 | batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry, |
632 | const struct batadv_orig_node *orig_node) | ||
627 | { | 633 | { |
628 | struct tt_orig_list_entry *tmp_orig_entry; | 634 | struct batadv_tt_orig_list_entry *tmp_orig_entry; |
629 | const struct hlist_head *head; | 635 | const struct hlist_head *head; |
630 | struct hlist_node *node; | 636 | struct hlist_node *node; |
631 | bool found = false; | 637 | bool found = false; |
@@ -643,10 +649,10 @@ static bool batadv_tt_global_entry_has_orig(const struct tt_global_entry *entry, | |||
643 | } | 649 | } |
644 | 650 | ||
645 | static void | 651 | static void |
646 | batadv_tt_global_add_orig_entry(struct tt_global_entry *tt_global_entry, | 652 | batadv_tt_global_add_orig_entry(struct batadv_tt_global_entry *tt_global_entry, |
647 | struct orig_node *orig_node, int ttvn) | 653 | struct batadv_orig_node *orig_node, int ttvn) |
648 | { | 654 | { |
649 | struct tt_orig_list_entry *orig_entry; | 655 | struct batadv_tt_orig_list_entry *orig_entry; |
650 | 656 | ||
651 | orig_entry = kzalloc(sizeof(*orig_entry), GFP_ATOMIC); | 657 | orig_entry = kzalloc(sizeof(*orig_entry), GFP_ATOMIC); |
652 | if (!orig_entry) | 658 | if (!orig_entry) |
@@ -665,14 +671,15 @@ batadv_tt_global_add_orig_entry(struct tt_global_entry *tt_global_entry, | |||
665 | } | 671 | } |
666 | 672 | ||
667 | /* caller must hold orig_node refcount */ | 673 | /* caller must hold orig_node refcount */ |
668 | int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, | 674 | int batadv_tt_global_add(struct batadv_priv *bat_priv, |
675 | struct batadv_orig_node *orig_node, | ||
669 | const unsigned char *tt_addr, uint8_t flags, | 676 | const unsigned char *tt_addr, uint8_t flags, |
670 | uint8_t ttvn) | 677 | uint8_t ttvn) |
671 | { | 678 | { |
672 | struct tt_global_entry *tt_global_entry = NULL; | 679 | struct batadv_tt_global_entry *tt_global_entry = NULL; |
673 | int ret = 0; | 680 | int ret = 0; |
674 | int hash_added; | 681 | int hash_added; |
675 | struct tt_common_entry *common; | 682 | struct batadv_tt_common_entry *common; |
676 | 683 | ||
677 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr); | 684 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr); |
678 | 685 | ||
@@ -746,13 +753,13 @@ out: | |||
746 | * it is assumed that the caller holds rcu_read_lock(); | 753 | * it is assumed that the caller holds rcu_read_lock(); |
747 | */ | 754 | */ |
748 | static void | 755 | static void |
749 | batadv_tt_global_print_entry(struct tt_global_entry *tt_global_entry, | 756 | batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry, |
750 | struct seq_file *seq) | 757 | struct seq_file *seq) |
751 | { | 758 | { |
752 | struct hlist_head *head; | 759 | struct hlist_head *head; |
753 | struct hlist_node *node; | 760 | struct hlist_node *node; |
754 | struct tt_orig_list_entry *orig_entry; | 761 | struct batadv_tt_orig_list_entry *orig_entry; |
755 | struct tt_common_entry *tt_common_entry; | 762 | struct batadv_tt_common_entry *tt_common_entry; |
756 | uint16_t flags; | 763 | uint16_t flags; |
757 | uint8_t last_ttvn; | 764 | uint8_t last_ttvn; |
758 | 765 | ||
@@ -774,11 +781,11 @@ batadv_tt_global_print_entry(struct tt_global_entry *tt_global_entry, | |||
774 | int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) | 781 | int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) |
775 | { | 782 | { |
776 | struct net_device *net_dev = (struct net_device *)seq->private; | 783 | struct net_device *net_dev = (struct net_device *)seq->private; |
777 | struct bat_priv *bat_priv = netdev_priv(net_dev); | 784 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
778 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; | 785 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; |
779 | struct tt_common_entry *tt_common_entry; | 786 | struct batadv_tt_common_entry *tt_common_entry; |
780 | struct tt_global_entry *tt_global_entry; | 787 | struct batadv_tt_global_entry *tt_global; |
781 | struct hard_iface *primary_if; | 788 | struct batadv_hard_iface *primary_if; |
782 | struct hlist_node *node; | 789 | struct hlist_node *node; |
783 | struct hlist_head *head; | 790 | struct hlist_head *head; |
784 | uint32_t i; | 791 | uint32_t i; |
@@ -811,10 +818,10 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) | |||
811 | rcu_read_lock(); | 818 | rcu_read_lock(); |
812 | hlist_for_each_entry_rcu(tt_common_entry, node, | 819 | hlist_for_each_entry_rcu(tt_common_entry, node, |
813 | head, hash_entry) { | 820 | head, hash_entry) { |
814 | tt_global_entry = container_of(tt_common_entry, | 821 | tt_global = container_of(tt_common_entry, |
815 | struct tt_global_entry, | 822 | struct batadv_tt_global_entry, |
816 | common); | 823 | common); |
817 | batadv_tt_global_print_entry(tt_global_entry, seq); | 824 | batadv_tt_global_print_entry(tt_global, seq); |
818 | } | 825 | } |
819 | rcu_read_unlock(); | 826 | rcu_read_unlock(); |
820 | } | 827 | } |
@@ -826,11 +833,11 @@ out: | |||
826 | 833 | ||
827 | /* deletes the orig list of a tt_global_entry */ | 834 | /* deletes the orig list of a tt_global_entry */ |
828 | static void | 835 | static void |
829 | batadv_tt_global_del_orig_list(struct tt_global_entry *tt_global_entry) | 836 | batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry) |
830 | { | 837 | { |
831 | struct hlist_head *head; | 838 | struct hlist_head *head; |
832 | struct hlist_node *node, *safe; | 839 | struct hlist_node *node, *safe; |
833 | struct tt_orig_list_entry *orig_entry; | 840 | struct batadv_tt_orig_list_entry *orig_entry; |
834 | 841 | ||
835 | spin_lock_bh(&tt_global_entry->list_lock); | 842 | spin_lock_bh(&tt_global_entry->list_lock); |
836 | head = &tt_global_entry->orig_list; | 843 | head = &tt_global_entry->orig_list; |
@@ -843,14 +850,14 @@ batadv_tt_global_del_orig_list(struct tt_global_entry *tt_global_entry) | |||
843 | } | 850 | } |
844 | 851 | ||
845 | static void | 852 | static void |
846 | batadv_tt_global_del_orig_entry(struct bat_priv *bat_priv, | 853 | batadv_tt_global_del_orig_entry(struct batadv_priv *bat_priv, |
847 | struct tt_global_entry *tt_global_entry, | 854 | struct batadv_tt_global_entry *tt_global_entry, |
848 | struct orig_node *orig_node, | 855 | struct batadv_orig_node *orig_node, |
849 | const char *message) | 856 | const char *message) |
850 | { | 857 | { |
851 | struct hlist_head *head; | 858 | struct hlist_head *head; |
852 | struct hlist_node *node, *safe; | 859 | struct hlist_node *node, *safe; |
853 | struct tt_orig_list_entry *orig_entry; | 860 | struct batadv_tt_orig_list_entry *orig_entry; |
854 | 861 | ||
855 | spin_lock_bh(&tt_global_entry->list_lock); | 862 | spin_lock_bh(&tt_global_entry->list_lock); |
856 | head = &tt_global_entry->orig_list; | 863 | head = &tt_global_entry->orig_list; |
@@ -867,9 +874,10 @@ batadv_tt_global_del_orig_entry(struct bat_priv *bat_priv, | |||
867 | spin_unlock_bh(&tt_global_entry->list_lock); | 874 | spin_unlock_bh(&tt_global_entry->list_lock); |
868 | } | 875 | } |
869 | 876 | ||
870 | static void batadv_tt_global_del_struct(struct bat_priv *bat_priv, | 877 | static void |
871 | struct tt_global_entry *tt_global_entry, | 878 | batadv_tt_global_del_struct(struct batadv_priv *bat_priv, |
872 | const char *message) | 879 | struct batadv_tt_global_entry *tt_global_entry, |
880 | const char *message) | ||
873 | { | 881 | { |
874 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 882 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
875 | "Deleting global tt entry %pM: %s\n", | 883 | "Deleting global tt entry %pM: %s\n", |
@@ -886,14 +894,15 @@ static void batadv_tt_global_del_struct(struct bat_priv *bat_priv, | |||
886 | * timer, otherwise we simply remove the originator scheduled for deletion. | 894 | * timer, otherwise we simply remove the originator scheduled for deletion. |
887 | */ | 895 | */ |
888 | static void | 896 | static void |
889 | batadv_tt_global_del_roaming(struct bat_priv *bat_priv, | 897 | batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, |
890 | struct tt_global_entry *tt_global_entry, | 898 | struct batadv_tt_global_entry *tt_global_entry, |
891 | struct orig_node *orig_node, const char *message) | 899 | struct batadv_orig_node *orig_node, |
900 | const char *message) | ||
892 | { | 901 | { |
893 | bool last_entry = true; | 902 | bool last_entry = true; |
894 | struct hlist_head *head; | 903 | struct hlist_head *head; |
895 | struct hlist_node *node; | 904 | struct hlist_node *node; |
896 | struct tt_orig_list_entry *orig_entry; | 905 | struct batadv_tt_orig_list_entry *orig_entry; |
897 | 906 | ||
898 | /* no local entry exists, case 1: | 907 | /* no local entry exists, case 1: |
899 | * Check if this is the last one or if other entries exist. | 908 | * Check if this is the last one or if other entries exist. |
@@ -923,13 +932,13 @@ batadv_tt_global_del_roaming(struct bat_priv *bat_priv, | |||
923 | 932 | ||
924 | 933 | ||
925 | 934 | ||
926 | static void batadv_tt_global_del(struct bat_priv *bat_priv, | 935 | static void batadv_tt_global_del(struct batadv_priv *bat_priv, |
927 | struct orig_node *orig_node, | 936 | struct batadv_orig_node *orig_node, |
928 | const unsigned char *addr, | 937 | const unsigned char *addr, |
929 | const char *message, bool roaming) | 938 | const char *message, bool roaming) |
930 | { | 939 | { |
931 | struct tt_global_entry *tt_global_entry = NULL; | 940 | struct batadv_tt_global_entry *tt_global_entry = NULL; |
932 | struct tt_local_entry *local_entry = NULL; | 941 | struct batadv_tt_local_entry *local_entry = NULL; |
933 | 942 | ||
934 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr); | 943 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr); |
935 | if (!tt_global_entry) | 944 | if (!tt_global_entry) |
@@ -978,11 +987,12 @@ out: | |||
978 | batadv_tt_local_entry_free_ref(local_entry); | 987 | batadv_tt_local_entry_free_ref(local_entry); |
979 | } | 988 | } |
980 | 989 | ||
981 | void batadv_tt_global_del_orig(struct bat_priv *bat_priv, | 990 | void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, |
982 | struct orig_node *orig_node, const char *message) | 991 | struct batadv_orig_node *orig_node, |
992 | const char *message) | ||
983 | { | 993 | { |
984 | struct tt_global_entry *global_entry; | 994 | struct batadv_tt_global_entry *tt_global; |
985 | struct tt_common_entry *tt_common_entry; | 995 | struct batadv_tt_common_entry *tt_common_entry; |
986 | uint32_t i; | 996 | uint32_t i; |
987 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; | 997 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; |
988 | struct hlist_node *node, *safe; | 998 | struct hlist_node *node, *safe; |
@@ -999,19 +1009,19 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv, | |||
999 | spin_lock_bh(list_lock); | 1009 | spin_lock_bh(list_lock); |
1000 | hlist_for_each_entry_safe(tt_common_entry, node, safe, | 1010 | hlist_for_each_entry_safe(tt_common_entry, node, safe, |
1001 | head, hash_entry) { | 1011 | head, hash_entry) { |
1002 | global_entry = container_of(tt_common_entry, | 1012 | tt_global = container_of(tt_common_entry, |
1003 | struct tt_global_entry, | 1013 | struct batadv_tt_global_entry, |
1004 | common); | 1014 | common); |
1005 | 1015 | ||
1006 | batadv_tt_global_del_orig_entry(bat_priv, global_entry, | 1016 | batadv_tt_global_del_orig_entry(bat_priv, tt_global, |
1007 | orig_node, message); | 1017 | orig_node, message); |
1008 | 1018 | ||
1009 | if (hlist_empty(&global_entry->orig_list)) { | 1019 | if (hlist_empty(&tt_global->orig_list)) { |
1010 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 1020 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
1011 | "Deleting global tt entry %pM: %s\n", | 1021 | "Deleting global tt entry %pM: %s\n", |
1012 | global_entry->common.addr, message); | 1022 | tt_global->common.addr, message); |
1013 | hlist_del_rcu(node); | 1023 | hlist_del_rcu(node); |
1014 | batadv_tt_global_entry_free_ref(global_entry); | 1024 | batadv_tt_global_entry_free_ref(tt_global); |
1015 | } | 1025 | } |
1016 | } | 1026 | } |
1017 | spin_unlock_bh(list_lock); | 1027 | spin_unlock_bh(list_lock); |
@@ -1019,17 +1029,18 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv, | |||
1019 | orig_node->tt_initialised = false; | 1029 | orig_node->tt_initialised = false; |
1020 | } | 1030 | } |
1021 | 1031 | ||
1022 | static void batadv_tt_global_roam_purge_list(struct bat_priv *bat_priv, | 1032 | static void batadv_tt_global_roam_purge_list(struct batadv_priv *bat_priv, |
1023 | struct hlist_head *head) | 1033 | struct hlist_head *head) |
1024 | { | 1034 | { |
1025 | struct tt_common_entry *tt_common_entry; | 1035 | struct batadv_tt_common_entry *tt_common_entry; |
1026 | struct tt_global_entry *tt_global_entry; | 1036 | struct batadv_tt_global_entry *tt_global_entry; |
1027 | struct hlist_node *node, *node_tmp; | 1037 | struct hlist_node *node, *node_tmp; |
1028 | 1038 | ||
1029 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, | 1039 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, |
1030 | hash_entry) { | 1040 | hash_entry) { |
1031 | tt_global_entry = container_of(tt_common_entry, | 1041 | tt_global_entry = container_of(tt_common_entry, |
1032 | struct tt_global_entry, common); | 1042 | struct batadv_tt_global_entry, |
1043 | common); | ||
1033 | if (!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM)) | 1044 | if (!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM)) |
1034 | continue; | 1045 | continue; |
1035 | if (!batadv_has_timed_out(tt_global_entry->roam_at, | 1046 | if (!batadv_has_timed_out(tt_global_entry->roam_at, |
@@ -1045,7 +1056,7 @@ static void batadv_tt_global_roam_purge_list(struct bat_priv *bat_priv, | |||
1045 | } | 1056 | } |
1046 | } | 1057 | } |
1047 | 1058 | ||
1048 | static void batadv_tt_global_roam_purge(struct bat_priv *bat_priv) | 1059 | static void batadv_tt_global_roam_purge(struct batadv_priv *bat_priv) |
1049 | { | 1060 | { |
1050 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; | 1061 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; |
1051 | struct hlist_head *head; | 1062 | struct hlist_head *head; |
@@ -1063,12 +1074,12 @@ static void batadv_tt_global_roam_purge(struct bat_priv *bat_priv) | |||
1063 | 1074 | ||
1064 | } | 1075 | } |
1065 | 1076 | ||
1066 | static void batadv_tt_global_table_free(struct bat_priv *bat_priv) | 1077 | static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) |
1067 | { | 1078 | { |
1068 | struct batadv_hashtable *hash; | 1079 | struct batadv_hashtable *hash; |
1069 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 1080 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
1070 | struct tt_common_entry *tt_common_entry; | 1081 | struct batadv_tt_common_entry *tt_common_entry; |
1071 | struct tt_global_entry *tt_global_entry; | 1082 | struct batadv_tt_global_entry *tt_global; |
1072 | struct hlist_node *node, *node_tmp; | 1083 | struct hlist_node *node, *node_tmp; |
1073 | struct hlist_head *head; | 1084 | struct hlist_head *head; |
1074 | uint32_t i; | 1085 | uint32_t i; |
@@ -1086,10 +1097,10 @@ static void batadv_tt_global_table_free(struct bat_priv *bat_priv) | |||
1086 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, | 1097 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, |
1087 | head, hash_entry) { | 1098 | head, hash_entry) { |
1088 | hlist_del_rcu(node); | 1099 | hlist_del_rcu(node); |
1089 | tt_global_entry = container_of(tt_common_entry, | 1100 | tt_global = container_of(tt_common_entry, |
1090 | struct tt_global_entry, | 1101 | struct batadv_tt_global_entry, |
1091 | common); | 1102 | common); |
1092 | batadv_tt_global_entry_free_ref(tt_global_entry); | 1103 | batadv_tt_global_entry_free_ref(tt_global); |
1093 | } | 1104 | } |
1094 | spin_unlock_bh(list_lock); | 1105 | spin_unlock_bh(list_lock); |
1095 | } | 1106 | } |
@@ -1099,8 +1110,9 @@ static void batadv_tt_global_table_free(struct bat_priv *bat_priv) | |||
1099 | bat_priv->tt_global_hash = NULL; | 1110 | bat_priv->tt_global_hash = NULL; |
1100 | } | 1111 | } |
1101 | 1112 | ||
1102 | static bool _batadv_is_ap_isolated(struct tt_local_entry *tt_local_entry, | 1113 | static bool |
1103 | struct tt_global_entry *tt_global_entry) | 1114 | _batadv_is_ap_isolated(struct batadv_tt_local_entry *tt_local_entry, |
1115 | struct batadv_tt_global_entry *tt_global_entry) | ||
1104 | { | 1116 | { |
1105 | bool ret = false; | 1117 | bool ret = false; |
1106 | 1118 | ||
@@ -1111,17 +1123,17 @@ static bool _batadv_is_ap_isolated(struct tt_local_entry *tt_local_entry, | |||
1111 | return ret; | 1123 | return ret; |
1112 | } | 1124 | } |
1113 | 1125 | ||
1114 | struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv, | 1126 | struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, |
1115 | const uint8_t *src, | 1127 | const uint8_t *src, |
1116 | const uint8_t *addr) | 1128 | const uint8_t *addr) |
1117 | { | 1129 | { |
1118 | struct tt_local_entry *tt_local_entry = NULL; | 1130 | struct batadv_tt_local_entry *tt_local_entry = NULL; |
1119 | struct tt_global_entry *tt_global_entry = NULL; | 1131 | struct batadv_tt_global_entry *tt_global_entry = NULL; |
1120 | struct orig_node *orig_node = NULL; | 1132 | struct batadv_orig_node *orig_node = NULL; |
1121 | struct neigh_node *router = NULL; | 1133 | struct batadv_neigh_node *router = NULL; |
1122 | struct hlist_head *head; | 1134 | struct hlist_head *head; |
1123 | struct hlist_node *node; | 1135 | struct hlist_node *node; |
1124 | struct tt_orig_list_entry *orig_entry; | 1136 | struct batadv_tt_orig_list_entry *orig_entry; |
1125 | int best_tq; | 1137 | int best_tq; |
1126 | 1138 | ||
1127 | if (src && atomic_read(&bat_priv->ap_isolation)) { | 1139 | if (src && atomic_read(&bat_priv->ap_isolation)) { |
@@ -1170,13 +1182,13 @@ out: | |||
1170 | } | 1182 | } |
1171 | 1183 | ||
1172 | /* Calculates the checksum of the local table of a given orig_node */ | 1184 | /* Calculates the checksum of the local table of a given orig_node */ |
1173 | static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | 1185 | static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv, |
1174 | struct orig_node *orig_node) | 1186 | struct batadv_orig_node *orig_node) |
1175 | { | 1187 | { |
1176 | uint16_t total = 0, total_one; | 1188 | uint16_t total = 0, total_one; |
1177 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; | 1189 | struct batadv_hashtable *hash = bat_priv->tt_global_hash; |
1178 | struct tt_common_entry *tt_common; | 1190 | struct batadv_tt_common_entry *tt_common; |
1179 | struct tt_global_entry *tt_global_entry; | 1191 | struct batadv_tt_global_entry *tt_global; |
1180 | struct hlist_node *node; | 1192 | struct hlist_node *node; |
1181 | struct hlist_head *head; | 1193 | struct hlist_head *head; |
1182 | uint32_t i; | 1194 | uint32_t i; |
@@ -1187,9 +1199,9 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | |||
1187 | 1199 | ||
1188 | rcu_read_lock(); | 1200 | rcu_read_lock(); |
1189 | hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { | 1201 | hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { |
1190 | tt_global_entry = container_of(tt_common, | 1202 | tt_global = container_of(tt_common, |
1191 | struct tt_global_entry, | 1203 | struct batadv_tt_global_entry, |
1192 | common); | 1204 | common); |
1193 | /* Roaming clients are in the global table for | 1205 | /* Roaming clients are in the global table for |
1194 | * consistency only. They don't have to be | 1206 | * consistency only. They don't have to be |
1195 | * taken into account while computing the | 1207 | * taken into account while computing the |
@@ -1201,7 +1213,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | |||
1201 | /* find out if this global entry is announced by this | 1213 | /* find out if this global entry is announced by this |
1202 | * originator | 1214 | * originator |
1203 | */ | 1215 | */ |
1204 | if (!batadv_tt_global_entry_has_orig(tt_global_entry, | 1216 | if (!batadv_tt_global_entry_has_orig(tt_global, |
1205 | orig_node)) | 1217 | orig_node)) |
1206 | continue; | 1218 | continue; |
1207 | 1219 | ||
@@ -1218,11 +1230,11 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | |||
1218 | } | 1230 | } |
1219 | 1231 | ||
1220 | /* Calculates the checksum of the local table */ | 1232 | /* Calculates the checksum of the local table */ |
1221 | static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv) | 1233 | static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv) |
1222 | { | 1234 | { |
1223 | uint16_t total = 0, total_one; | 1235 | uint16_t total = 0, total_one; |
1224 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; | 1236 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; |
1225 | struct tt_common_entry *tt_common; | 1237 | struct batadv_tt_common_entry *tt_common; |
1226 | struct hlist_node *node; | 1238 | struct hlist_node *node; |
1227 | struct hlist_head *head; | 1239 | struct hlist_head *head; |
1228 | uint32_t i; | 1240 | uint32_t i; |
@@ -1250,9 +1262,9 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv) | |||
1250 | return total; | 1262 | return total; |
1251 | } | 1263 | } |
1252 | 1264 | ||
1253 | static void batadv_tt_req_list_free(struct bat_priv *bat_priv) | 1265 | static void batadv_tt_req_list_free(struct batadv_priv *bat_priv) |
1254 | { | 1266 | { |
1255 | struct tt_req_node *node, *safe; | 1267 | struct batadv_tt_req_node *node, *safe; |
1256 | 1268 | ||
1257 | spin_lock_bh(&bat_priv->tt_req_list_lock); | 1269 | spin_lock_bh(&bat_priv->tt_req_list_lock); |
1258 | 1270 | ||
@@ -1264,8 +1276,8 @@ static void batadv_tt_req_list_free(struct bat_priv *bat_priv) | |||
1264 | spin_unlock_bh(&bat_priv->tt_req_list_lock); | 1276 | spin_unlock_bh(&bat_priv->tt_req_list_lock); |
1265 | } | 1277 | } |
1266 | 1278 | ||
1267 | static void batadv_tt_save_orig_buffer(struct bat_priv *bat_priv, | 1279 | static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv, |
1268 | struct orig_node *orig_node, | 1280 | struct batadv_orig_node *orig_node, |
1269 | const unsigned char *tt_buff, | 1281 | const unsigned char *tt_buff, |
1270 | uint8_t tt_num_changes) | 1282 | uint8_t tt_num_changes) |
1271 | { | 1283 | { |
@@ -1287,9 +1299,9 @@ static void batadv_tt_save_orig_buffer(struct bat_priv *bat_priv, | |||
1287 | spin_unlock_bh(&orig_node->tt_buff_lock); | 1299 | spin_unlock_bh(&orig_node->tt_buff_lock); |
1288 | } | 1300 | } |
1289 | 1301 | ||
1290 | static void batadv_tt_req_purge(struct bat_priv *bat_priv) | 1302 | static void batadv_tt_req_purge(struct batadv_priv *bat_priv) |
1291 | { | 1303 | { |
1292 | struct tt_req_node *node, *safe; | 1304 | struct batadv_tt_req_node *node, *safe; |
1293 | 1305 | ||
1294 | spin_lock_bh(&bat_priv->tt_req_list_lock); | 1306 | spin_lock_bh(&bat_priv->tt_req_list_lock); |
1295 | list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) { | 1307 | list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) { |
@@ -1305,10 +1317,11 @@ static void batadv_tt_req_purge(struct bat_priv *bat_priv) | |||
1305 | /* returns the pointer to the new tt_req_node struct if no request | 1317 | /* returns the pointer to the new tt_req_node struct if no request |
1306 | * has already been issued for this orig_node, NULL otherwise | 1318 | * has already been issued for this orig_node, NULL otherwise |
1307 | */ | 1319 | */ |
1308 | static struct tt_req_node *batadv_new_tt_req_node(struct bat_priv *bat_priv, | 1320 | static struct batadv_tt_req_node * |
1309 | struct orig_node *orig_node) | 1321 | batadv_new_tt_req_node(struct batadv_priv *bat_priv, |
1322 | struct batadv_orig_node *orig_node) | ||
1310 | { | 1323 | { |
1311 | struct tt_req_node *tt_req_node_tmp, *tt_req_node = NULL; | 1324 | struct batadv_tt_req_node *tt_req_node_tmp, *tt_req_node = NULL; |
1312 | 1325 | ||
1313 | spin_lock_bh(&bat_priv->tt_req_list_lock); | 1326 | spin_lock_bh(&bat_priv->tt_req_list_lock); |
1314 | list_for_each_entry(tt_req_node_tmp, &bat_priv->tt_req_list, list) { | 1327 | list_for_each_entry(tt_req_node_tmp, &bat_priv->tt_req_list, list) { |
@@ -1335,7 +1348,7 @@ unlock: | |||
1335 | static int batadv_tt_local_valid_entry(const void *entry_ptr, | 1348 | static int batadv_tt_local_valid_entry(const void *entry_ptr, |
1336 | const void *data_ptr) | 1349 | const void *data_ptr) |
1337 | { | 1350 | { |
1338 | const struct tt_common_entry *tt_common_entry = entry_ptr; | 1351 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; |
1339 | 1352 | ||
1340 | if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) | 1353 | if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) |
1341 | return 0; | 1354 | return 0; |
@@ -1345,14 +1358,15 @@ static int batadv_tt_local_valid_entry(const void *entry_ptr, | |||
1345 | static int batadv_tt_global_valid(const void *entry_ptr, | 1358 | static int batadv_tt_global_valid(const void *entry_ptr, |
1346 | const void *data_ptr) | 1359 | const void *data_ptr) |
1347 | { | 1360 | { |
1348 | const struct tt_common_entry *tt_common_entry = entry_ptr; | 1361 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; |
1349 | const struct tt_global_entry *tt_global_entry; | 1362 | const struct batadv_tt_global_entry *tt_global_entry; |
1350 | const struct orig_node *orig_node = data_ptr; | 1363 | const struct batadv_orig_node *orig_node = data_ptr; |
1351 | 1364 | ||
1352 | if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM) | 1365 | if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM) |
1353 | return 0; | 1366 | return 0; |
1354 | 1367 | ||
1355 | tt_global_entry = container_of(tt_common_entry, struct tt_global_entry, | 1368 | tt_global_entry = container_of(tt_common_entry, |
1369 | struct batadv_tt_global_entry, | ||
1356 | common); | 1370 | common); |
1357 | 1371 | ||
1358 | return batadv_tt_global_entry_has_orig(tt_global_entry, orig_node); | 1372 | return batadv_tt_global_entry_has_orig(tt_global_entry, orig_node); |
@@ -1361,11 +1375,11 @@ static int batadv_tt_global_valid(const void *entry_ptr, | |||
1361 | static struct sk_buff * | 1375 | static struct sk_buff * |
1362 | batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, | 1376 | batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, |
1363 | struct batadv_hashtable *hash, | 1377 | struct batadv_hashtable *hash, |
1364 | struct hard_iface *primary_if, | 1378 | struct batadv_hard_iface *primary_if, |
1365 | int (*valid_cb)(const void *, const void *), | 1379 | int (*valid_cb)(const void *, const void *), |
1366 | void *cb_data) | 1380 | void *cb_data) |
1367 | { | 1381 | { |
1368 | struct tt_common_entry *tt_common_entry; | 1382 | struct batadv_tt_common_entry *tt_common_entry; |
1369 | struct batadv_tt_query_packet *tt_response; | 1383 | struct batadv_tt_query_packet *tt_response; |
1370 | struct batadv_tt_change *tt_change; | 1384 | struct batadv_tt_change *tt_change; |
1371 | struct hlist_node *node; | 1385 | struct hlist_node *node; |
@@ -1425,16 +1439,16 @@ out: | |||
1425 | return skb; | 1439 | return skb; |
1426 | } | 1440 | } |
1427 | 1441 | ||
1428 | static int batadv_send_tt_request(struct bat_priv *bat_priv, | 1442 | static int batadv_send_tt_request(struct batadv_priv *bat_priv, |
1429 | struct orig_node *dst_orig_node, | 1443 | struct batadv_orig_node *dst_orig_node, |
1430 | uint8_t ttvn, uint16_t tt_crc, | 1444 | uint8_t ttvn, uint16_t tt_crc, |
1431 | bool full_table) | 1445 | bool full_table) |
1432 | { | 1446 | { |
1433 | struct sk_buff *skb = NULL; | 1447 | struct sk_buff *skb = NULL; |
1434 | struct batadv_tt_query_packet *tt_request; | 1448 | struct batadv_tt_query_packet *tt_request; |
1435 | struct neigh_node *neigh_node = NULL; | 1449 | struct batadv_neigh_node *neigh_node = NULL; |
1436 | struct hard_iface *primary_if; | 1450 | struct batadv_hard_iface *primary_if; |
1437 | struct tt_req_node *tt_req_node = NULL; | 1451 | struct batadv_tt_req_node *tt_req_node = NULL; |
1438 | int ret = 1; | 1452 | int ret = 1; |
1439 | size_t tt_req_len; | 1453 | size_t tt_req_len; |
1440 | 1454 | ||
@@ -1501,12 +1515,13 @@ out: | |||
1501 | } | 1515 | } |
1502 | 1516 | ||
1503 | static bool | 1517 | static bool |
1504 | batadv_send_other_tt_response(struct bat_priv *bat_priv, | 1518 | batadv_send_other_tt_response(struct batadv_priv *bat_priv, |
1505 | struct batadv_tt_query_packet *tt_request) | 1519 | struct batadv_tt_query_packet *tt_request) |
1506 | { | 1520 | { |
1507 | struct orig_node *req_dst_orig_node = NULL, *res_dst_orig_node = NULL; | 1521 | struct batadv_orig_node *req_dst_orig_node = NULL; |
1508 | struct neigh_node *neigh_node = NULL; | 1522 | struct batadv_orig_node *res_dst_orig_node = NULL; |
1509 | struct hard_iface *primary_if = NULL; | 1523 | struct batadv_neigh_node *neigh_node = NULL; |
1524 | struct batadv_hard_iface *primary_if = NULL; | ||
1510 | uint8_t orig_ttvn, req_ttvn, ttvn; | 1525 | uint8_t orig_ttvn, req_ttvn, ttvn; |
1511 | int ret = false; | 1526 | int ret = false; |
1512 | unsigned char *tt_buff; | 1527 | unsigned char *tt_buff; |
@@ -1634,12 +1649,12 @@ out: | |||
1634 | } | 1649 | } |
1635 | 1650 | ||
1636 | static bool | 1651 | static bool |
1637 | batadv_send_my_tt_response(struct bat_priv *bat_priv, | 1652 | batadv_send_my_tt_response(struct batadv_priv *bat_priv, |
1638 | struct batadv_tt_query_packet *tt_request) | 1653 | struct batadv_tt_query_packet *tt_request) |
1639 | { | 1654 | { |
1640 | struct orig_node *orig_node = NULL; | 1655 | struct batadv_orig_node *orig_node = NULL; |
1641 | struct neigh_node *neigh_node = NULL; | 1656 | struct batadv_neigh_node *neigh_node = NULL; |
1642 | struct hard_iface *primary_if = NULL; | 1657 | struct batadv_hard_iface *primary_if = NULL; |
1643 | uint8_t my_ttvn, req_ttvn, ttvn; | 1658 | uint8_t my_ttvn, req_ttvn, ttvn; |
1644 | int ret = false; | 1659 | int ret = false; |
1645 | unsigned char *tt_buff; | 1660 | unsigned char *tt_buff; |
@@ -1754,7 +1769,7 @@ out: | |||
1754 | return true; | 1769 | return true; |
1755 | } | 1770 | } |
1756 | 1771 | ||
1757 | bool batadv_send_tt_response(struct bat_priv *bat_priv, | 1772 | bool batadv_send_tt_response(struct batadv_priv *bat_priv, |
1758 | struct batadv_tt_query_packet *tt_request) | 1773 | struct batadv_tt_query_packet *tt_request) |
1759 | { | 1774 | { |
1760 | if (batadv_is_my_mac(tt_request->dst)) { | 1775 | if (batadv_is_my_mac(tt_request->dst)) { |
@@ -1768,8 +1783,8 @@ bool batadv_send_tt_response(struct bat_priv *bat_priv, | |||
1768 | } | 1783 | } |
1769 | } | 1784 | } |
1770 | 1785 | ||
1771 | static void _batadv_tt_update_changes(struct bat_priv *bat_priv, | 1786 | static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, |
1772 | struct orig_node *orig_node, | 1787 | struct batadv_orig_node *orig_node, |
1773 | struct batadv_tt_change *tt_change, | 1788 | struct batadv_tt_change *tt_change, |
1774 | uint16_t tt_num_changes, uint8_t ttvn) | 1789 | uint16_t tt_num_changes, uint8_t ttvn) |
1775 | { | 1790 | { |
@@ -1799,10 +1814,10 @@ static void _batadv_tt_update_changes(struct bat_priv *bat_priv, | |||
1799 | orig_node->tt_initialised = true; | 1814 | orig_node->tt_initialised = true; |
1800 | } | 1815 | } |
1801 | 1816 | ||
1802 | static void batadv_tt_fill_gtable(struct bat_priv *bat_priv, | 1817 | static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, |
1803 | struct batadv_tt_query_packet *tt_response) | 1818 | struct batadv_tt_query_packet *tt_response) |
1804 | { | 1819 | { |
1805 | struct orig_node *orig_node = NULL; | 1820 | struct batadv_orig_node *orig_node = NULL; |
1806 | 1821 | ||
1807 | orig_node = batadv_orig_hash_find(bat_priv, tt_response->src); | 1822 | orig_node = batadv_orig_hash_find(bat_priv, tt_response->src); |
1808 | if (!orig_node) | 1823 | if (!orig_node) |
@@ -1829,8 +1844,8 @@ out: | |||
1829 | batadv_orig_node_free_ref(orig_node); | 1844 | batadv_orig_node_free_ref(orig_node); |
1830 | } | 1845 | } |
1831 | 1846 | ||
1832 | static void batadv_tt_update_changes(struct bat_priv *bat_priv, | 1847 | static void batadv_tt_update_changes(struct batadv_priv *bat_priv, |
1833 | struct orig_node *orig_node, | 1848 | struct batadv_orig_node *orig_node, |
1834 | uint16_t tt_num_changes, uint8_t ttvn, | 1849 | uint16_t tt_num_changes, uint8_t ttvn, |
1835 | struct batadv_tt_change *tt_change) | 1850 | struct batadv_tt_change *tt_change) |
1836 | { | 1851 | { |
@@ -1842,9 +1857,9 @@ static void batadv_tt_update_changes(struct bat_priv *bat_priv, | |||
1842 | atomic_set(&orig_node->last_ttvn, ttvn); | 1857 | atomic_set(&orig_node->last_ttvn, ttvn); |
1843 | } | 1858 | } |
1844 | 1859 | ||
1845 | bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) | 1860 | bool batadv_is_my_client(struct batadv_priv *bat_priv, const uint8_t *addr) |
1846 | { | 1861 | { |
1847 | struct tt_local_entry *tt_local_entry = NULL; | 1862 | struct batadv_tt_local_entry *tt_local_entry = NULL; |
1848 | bool ret = false; | 1863 | bool ret = false; |
1849 | 1864 | ||
1850 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); | 1865 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); |
@@ -1862,11 +1877,11 @@ out: | |||
1862 | return ret; | 1877 | return ret; |
1863 | } | 1878 | } |
1864 | 1879 | ||
1865 | void batadv_handle_tt_response(struct bat_priv *bat_priv, | 1880 | void batadv_handle_tt_response(struct batadv_priv *bat_priv, |
1866 | struct batadv_tt_query_packet *tt_response) | 1881 | struct batadv_tt_query_packet *tt_response) |
1867 | { | 1882 | { |
1868 | struct tt_req_node *node, *safe; | 1883 | struct batadv_tt_req_node *node, *safe; |
1869 | struct orig_node *orig_node = NULL; | 1884 | struct batadv_orig_node *orig_node = NULL; |
1870 | struct batadv_tt_change *tt_change; | 1885 | struct batadv_tt_change *tt_change; |
1871 | 1886 | ||
1872 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 1887 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
@@ -1913,7 +1928,7 @@ out: | |||
1913 | batadv_orig_node_free_ref(orig_node); | 1928 | batadv_orig_node_free_ref(orig_node); |
1914 | } | 1929 | } |
1915 | 1930 | ||
1916 | int batadv_tt_init(struct bat_priv *bat_priv) | 1931 | int batadv_tt_init(struct batadv_priv *bat_priv) |
1917 | { | 1932 | { |
1918 | int ret; | 1933 | int ret; |
1919 | 1934 | ||
@@ -1930,9 +1945,9 @@ int batadv_tt_init(struct bat_priv *bat_priv) | |||
1930 | return 1; | 1945 | return 1; |
1931 | } | 1946 | } |
1932 | 1947 | ||
1933 | static void batadv_tt_roam_list_free(struct bat_priv *bat_priv) | 1948 | static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv) |
1934 | { | 1949 | { |
1935 | struct tt_roam_node *node, *safe; | 1950 | struct batadv_tt_roam_node *node, *safe; |
1936 | 1951 | ||
1937 | spin_lock_bh(&bat_priv->tt_roam_list_lock); | 1952 | spin_lock_bh(&bat_priv->tt_roam_list_lock); |
1938 | 1953 | ||
@@ -1944,9 +1959,9 @@ static void batadv_tt_roam_list_free(struct bat_priv *bat_priv) | |||
1944 | spin_unlock_bh(&bat_priv->tt_roam_list_lock); | 1959 | spin_unlock_bh(&bat_priv->tt_roam_list_lock); |
1945 | } | 1960 | } |
1946 | 1961 | ||
1947 | static void batadv_tt_roam_purge(struct bat_priv *bat_priv) | 1962 | static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) |
1948 | { | 1963 | { |
1949 | struct tt_roam_node *node, *safe; | 1964 | struct batadv_tt_roam_node *node, *safe; |
1950 | 1965 | ||
1951 | spin_lock_bh(&bat_priv->tt_roam_list_lock); | 1966 | spin_lock_bh(&bat_priv->tt_roam_list_lock); |
1952 | list_for_each_entry_safe(node, safe, &bat_priv->tt_roam_list, list) { | 1967 | list_for_each_entry_safe(node, safe, &bat_priv->tt_roam_list, list) { |
@@ -1966,10 +1981,10 @@ static void batadv_tt_roam_purge(struct bat_priv *bat_priv) | |||
1966 | * | 1981 | * |
1967 | * returns true if the ROAMING_ADV can be sent, false otherwise | 1982 | * returns true if the ROAMING_ADV can be sent, false otherwise |
1968 | */ | 1983 | */ |
1969 | static bool batadv_tt_check_roam_count(struct bat_priv *bat_priv, | 1984 | static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, |
1970 | uint8_t *client) | 1985 | uint8_t *client) |
1971 | { | 1986 | { |
1972 | struct tt_roam_node *tt_roam_node; | 1987 | struct batadv_tt_roam_node *tt_roam_node; |
1973 | bool ret = false; | 1988 | bool ret = false; |
1974 | 1989 | ||
1975 | spin_lock_bh(&bat_priv->tt_roam_list_lock); | 1990 | spin_lock_bh(&bat_priv->tt_roam_list_lock); |
@@ -2010,14 +2025,14 @@ unlock: | |||
2010 | return ret; | 2025 | return ret; |
2011 | } | 2026 | } |
2012 | 2027 | ||
2013 | static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, | 2028 | static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client, |
2014 | struct orig_node *orig_node) | 2029 | struct batadv_orig_node *orig_node) |
2015 | { | 2030 | { |
2016 | struct neigh_node *neigh_node = NULL; | 2031 | struct batadv_neigh_node *neigh_node = NULL; |
2017 | struct sk_buff *skb = NULL; | 2032 | struct sk_buff *skb = NULL; |
2018 | struct batadv_roam_adv_packet *roam_adv_packet; | 2033 | struct batadv_roam_adv_packet *roam_adv_packet; |
2019 | int ret = 1; | 2034 | int ret = 1; |
2020 | struct hard_iface *primary_if; | 2035 | struct batadv_hard_iface *primary_if; |
2021 | size_t len = sizeof(*roam_adv_packet); | 2036 | size_t len = sizeof(*roam_adv_packet); |
2022 | 2037 | ||
2023 | /* before going on we have to check whether the client has | 2038 | /* before going on we have to check whether the client has |
@@ -2068,10 +2083,11 @@ out: | |||
2068 | 2083 | ||
2069 | static void batadv_tt_purge(struct work_struct *work) | 2084 | static void batadv_tt_purge(struct work_struct *work) |
2070 | { | 2085 | { |
2071 | struct delayed_work *delayed_work = | 2086 | struct delayed_work *delayed_work; |
2072 | container_of(work, struct delayed_work, work); | 2087 | struct batadv_priv *bat_priv; |
2073 | struct bat_priv *bat_priv = | 2088 | |
2074 | container_of(delayed_work, struct bat_priv, tt_work); | 2089 | delayed_work = container_of(work, struct delayed_work, work); |
2090 | bat_priv = container_of(delayed_work, struct batadv_priv, tt_work); | ||
2075 | 2091 | ||
2076 | batadv_tt_local_purge(bat_priv); | 2092 | batadv_tt_local_purge(bat_priv); |
2077 | batadv_tt_global_roam_purge(bat_priv); | 2093 | batadv_tt_global_roam_purge(bat_priv); |
@@ -2081,7 +2097,7 @@ static void batadv_tt_purge(struct work_struct *work) | |||
2081 | batadv_tt_start_timer(bat_priv); | 2097 | batadv_tt_start_timer(bat_priv); |
2082 | } | 2098 | } |
2083 | 2099 | ||
2084 | void batadv_tt_free(struct bat_priv *bat_priv) | 2100 | void batadv_tt_free(struct batadv_priv *bat_priv) |
2085 | { | 2101 | { |
2086 | cancel_delayed_work_sync(&bat_priv->tt_work); | 2102 | cancel_delayed_work_sync(&bat_priv->tt_work); |
2087 | 2103 | ||
@@ -2104,7 +2120,7 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash, | |||
2104 | uint16_t changed_num = 0; | 2120 | uint16_t changed_num = 0; |
2105 | struct hlist_head *head; | 2121 | struct hlist_head *head; |
2106 | struct hlist_node *node; | 2122 | struct hlist_node *node; |
2107 | struct tt_common_entry *tt_common_entry; | 2123 | struct batadv_tt_common_entry *tt_common_entry; |
2108 | 2124 | ||
2109 | if (!hash) | 2125 | if (!hash) |
2110 | goto out; | 2126 | goto out; |
@@ -2133,11 +2149,11 @@ out: | |||
2133 | } | 2149 | } |
2134 | 2150 | ||
2135 | /* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */ | 2151 | /* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */ |
2136 | static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv) | 2152 | static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) |
2137 | { | 2153 | { |
2138 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; | 2154 | struct batadv_hashtable *hash = bat_priv->tt_local_hash; |
2139 | struct tt_common_entry *tt_common; | 2155 | struct batadv_tt_common_entry *tt_common; |
2140 | struct tt_local_entry *tt_local_entry; | 2156 | struct batadv_tt_local_entry *tt_local; |
2141 | struct hlist_node *node, *node_tmp; | 2157 | struct hlist_node *node, *node_tmp; |
2142 | struct hlist_head *head; | 2158 | struct hlist_head *head; |
2143 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 2159 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
@@ -2162,17 +2178,17 @@ static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv) | |||
2162 | 2178 | ||
2163 | atomic_dec(&bat_priv->num_local_tt); | 2179 | atomic_dec(&bat_priv->num_local_tt); |
2164 | hlist_del_rcu(node); | 2180 | hlist_del_rcu(node); |
2165 | tt_local_entry = container_of(tt_common, | 2181 | tt_local = container_of(tt_common, |
2166 | struct tt_local_entry, | 2182 | struct batadv_tt_local_entry, |
2167 | common); | 2183 | common); |
2168 | batadv_tt_local_entry_free_ref(tt_local_entry); | 2184 | batadv_tt_local_entry_free_ref(tt_local); |
2169 | } | 2185 | } |
2170 | spin_unlock_bh(list_lock); | 2186 | spin_unlock_bh(list_lock); |
2171 | } | 2187 | } |
2172 | 2188 | ||
2173 | } | 2189 | } |
2174 | 2190 | ||
2175 | static int batadv_tt_commit_changes(struct bat_priv *bat_priv, | 2191 | static int batadv_tt_commit_changes(struct batadv_priv *bat_priv, |
2176 | unsigned char **packet_buff, | 2192 | unsigned char **packet_buff, |
2177 | int *packet_buff_len, int packet_min_len) | 2193 | int *packet_buff_len, int packet_min_len) |
2178 | { | 2194 | { |
@@ -2204,7 +2220,7 @@ static int batadv_tt_commit_changes(struct bat_priv *bat_priv, | |||
2204 | } | 2220 | } |
2205 | 2221 | ||
2206 | /* when calling this function (hard_iface == primary_if) has to be true */ | 2222 | /* when calling this function (hard_iface == primary_if) has to be true */ |
2207 | int batadv_tt_append_diff(struct bat_priv *bat_priv, | 2223 | int batadv_tt_append_diff(struct batadv_priv *bat_priv, |
2208 | unsigned char **packet_buff, int *packet_buff_len, | 2224 | unsigned char **packet_buff, int *packet_buff_len, |
2209 | int packet_min_len) | 2225 | int packet_min_len) |
2210 | { | 2226 | { |
@@ -2226,11 +2242,11 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv, | |||
2226 | return tt_num_changes; | 2242 | return tt_num_changes; |
2227 | } | 2243 | } |
2228 | 2244 | ||
2229 | bool batadv_is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, | 2245 | bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, uint8_t *src, |
2230 | uint8_t *dst) | 2246 | uint8_t *dst) |
2231 | { | 2247 | { |
2232 | struct tt_local_entry *tt_local_entry = NULL; | 2248 | struct batadv_tt_local_entry *tt_local_entry = NULL; |
2233 | struct tt_global_entry *tt_global_entry = NULL; | 2249 | struct batadv_tt_global_entry *tt_global_entry = NULL; |
2234 | bool ret = false; | 2250 | bool ret = false; |
2235 | 2251 | ||
2236 | if (!atomic_read(&bat_priv->ap_isolation)) | 2252 | if (!atomic_read(&bat_priv->ap_isolation)) |
@@ -2257,8 +2273,8 @@ out: | |||
2257 | return ret; | 2273 | return ret; |
2258 | } | 2274 | } |
2259 | 2275 | ||
2260 | void batadv_tt_update_orig(struct bat_priv *bat_priv, | 2276 | void batadv_tt_update_orig(struct batadv_priv *bat_priv, |
2261 | struct orig_node *orig_node, | 2277 | struct batadv_orig_node *orig_node, |
2262 | const unsigned char *tt_buff, uint8_t tt_num_changes, | 2278 | const unsigned char *tt_buff, uint8_t tt_num_changes, |
2263 | uint8_t ttvn, uint16_t tt_crc) | 2279 | uint8_t ttvn, uint16_t tt_crc) |
2264 | { | 2280 | { |
@@ -2333,10 +2349,10 @@ request_table: | |||
2333 | * originator to another one. This entry is kept is still kept for consistency | 2349 | * originator to another one. This entry is kept is still kept for consistency |
2334 | * purposes | 2350 | * purposes |
2335 | */ | 2351 | */ |
2336 | bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv, | 2352 | bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, |
2337 | uint8_t *addr) | 2353 | uint8_t *addr) |
2338 | { | 2354 | { |
2339 | struct tt_global_entry *tt_global_entry; | 2355 | struct batadv_tt_global_entry *tt_global_entry; |
2340 | bool ret = false; | 2356 | bool ret = false; |
2341 | 2357 | ||
2342 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr); | 2358 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr); |