diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-05-12 12:33:53 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-25 02:21:36 -0400 |
commit | 3b300de322014f529b2e0a72a92c414686b85671 (patch) | |
tree | 3129951c227126dfa167544d0bce7204ea9176e1 /net/batman-adv | |
parent | 0ff9b86feb6ee50171dcf5635520c91757b3d5e9 (diff) |
batman-adv: Prefix bridge_loop_avoidance local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 320 |
1 files changed, 168 insertions, 152 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index b7d70845aa4a..0592d2bcb9b5 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -31,14 +31,14 @@ | |||
31 | #include <net/arp.h> | 31 | #include <net/arp.h> |
32 | #include <linux/if_vlan.h> | 32 | #include <linux/if_vlan.h> |
33 | 33 | ||
34 | static const uint8_t announce_mac[4] = {0x43, 0x05, 0x43, 0x05}; | 34 | static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05}; |
35 | 35 | ||
36 | static void bla_periodic_work(struct work_struct *work); | 36 | static void batadv_bla_periodic_work(struct work_struct *work); |
37 | static void bla_send_announce(struct bat_priv *bat_priv, | 37 | static void batadv_bla_send_announce(struct bat_priv *bat_priv, |
38 | struct backbone_gw *backbone_gw); | 38 | struct backbone_gw *backbone_gw); |
39 | 39 | ||
40 | /* return the index of the claim */ | 40 | /* return the index of the claim */ |
41 | static inline uint32_t choose_claim(const void *data, uint32_t size) | 41 | static inline uint32_t batadv_choose_claim(const void *data, uint32_t size) |
42 | { | 42 | { |
43 | const unsigned char *key = data; | 43 | const unsigned char *key = data; |
44 | uint32_t hash = 0; | 44 | uint32_t hash = 0; |
@@ -58,7 +58,8 @@ static inline uint32_t choose_claim(const void *data, uint32_t size) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | /* return the index of the backbone gateway */ | 60 | /* return the index of the backbone gateway */ |
61 | static inline uint32_t choose_backbone_gw(const void *data, uint32_t size) | 61 | static inline uint32_t batadv_choose_backbone_gw(const void *data, |
62 | uint32_t size) | ||
62 | { | 63 | { |
63 | const unsigned char *key = data; | 64 | const unsigned char *key = data; |
64 | uint32_t hash = 0; | 65 | uint32_t hash = 0; |
@@ -79,7 +80,8 @@ static inline uint32_t choose_backbone_gw(const void *data, uint32_t size) | |||
79 | 80 | ||
80 | 81 | ||
81 | /* compares address and vid of two backbone gws */ | 82 | /* compares address and vid of two backbone gws */ |
82 | static int compare_backbone_gw(const struct hlist_node *node, const void *data2) | 83 | static int batadv_compare_backbone_gw(const struct hlist_node *node, |
84 | const void *data2) | ||
83 | { | 85 | { |
84 | const void *data1 = container_of(node, struct backbone_gw, | 86 | const void *data1 = container_of(node, struct backbone_gw, |
85 | hash_entry); | 87 | hash_entry); |
@@ -88,7 +90,8 @@ static int compare_backbone_gw(const struct hlist_node *node, const void *data2) | |||
88 | } | 90 | } |
89 | 91 | ||
90 | /* compares address and vid of two claims */ | 92 | /* compares address and vid of two claims */ |
91 | static int compare_claim(const struct hlist_node *node, const void *data2) | 93 | static int batadv_compare_claim(const struct hlist_node *node, |
94 | const void *data2) | ||
92 | { | 95 | { |
93 | const void *data1 = container_of(node, struct claim, | 96 | const void *data1 = container_of(node, struct claim, |
94 | hash_entry); | 97 | hash_entry); |
@@ -97,28 +100,28 @@ static int compare_claim(const struct hlist_node *node, const void *data2) | |||
97 | } | 100 | } |
98 | 101 | ||
99 | /* free a backbone gw */ | 102 | /* free a backbone gw */ |
100 | static void backbone_gw_free_ref(struct backbone_gw *backbone_gw) | 103 | static void batadv_backbone_gw_free_ref(struct backbone_gw *backbone_gw) |
101 | { | 104 | { |
102 | if (atomic_dec_and_test(&backbone_gw->refcount)) | 105 | if (atomic_dec_and_test(&backbone_gw->refcount)) |
103 | kfree_rcu(backbone_gw, rcu); | 106 | kfree_rcu(backbone_gw, rcu); |
104 | } | 107 | } |
105 | 108 | ||
106 | /* finally deinitialize the claim */ | 109 | /* finally deinitialize the claim */ |
107 | static void claim_free_rcu(struct rcu_head *rcu) | 110 | static void batadv_claim_free_rcu(struct rcu_head *rcu) |
108 | { | 111 | { |
109 | struct claim *claim; | 112 | struct claim *claim; |
110 | 113 | ||
111 | claim = container_of(rcu, struct claim, rcu); | 114 | claim = container_of(rcu, struct claim, rcu); |
112 | 115 | ||
113 | backbone_gw_free_ref(claim->backbone_gw); | 116 | batadv_backbone_gw_free_ref(claim->backbone_gw); |
114 | kfree(claim); | 117 | kfree(claim); |
115 | } | 118 | } |
116 | 119 | ||
117 | /* free a claim, call claim_free_rcu if its the last reference */ | 120 | /* free a claim, call claim_free_rcu if its the last reference */ |
118 | static void claim_free_ref(struct claim *claim) | 121 | static void batadv_claim_free_ref(struct claim *claim) |
119 | { | 122 | { |
120 | if (atomic_dec_and_test(&claim->refcount)) | 123 | if (atomic_dec_and_test(&claim->refcount)) |
121 | call_rcu(&claim->rcu, claim_free_rcu); | 124 | call_rcu(&claim->rcu, batadv_claim_free_rcu); |
122 | } | 125 | } |
123 | 126 | ||
124 | /* @bat_priv: the bat priv with all the soft interface information | 127 | /* @bat_priv: the bat priv with all the soft interface information |
@@ -127,8 +130,8 @@ static void claim_free_ref(struct claim *claim) | |||
127 | * looks for a claim in the hash, and returns it if found | 130 | * looks for a claim in the hash, and returns it if found |
128 | * or NULL otherwise. | 131 | * or NULL otherwise. |
129 | */ | 132 | */ |
130 | static struct claim *claim_hash_find(struct bat_priv *bat_priv, | 133 | static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv, |
131 | struct claim *data) | 134 | struct claim *data) |
132 | { | 135 | { |
133 | struct hashtable_t *hash = bat_priv->claim_hash; | 136 | struct hashtable_t *hash = bat_priv->claim_hash; |
134 | struct hlist_head *head; | 137 | struct hlist_head *head; |
@@ -140,12 +143,12 @@ static struct claim *claim_hash_find(struct bat_priv *bat_priv, | |||
140 | if (!hash) | 143 | if (!hash) |
141 | return NULL; | 144 | return NULL; |
142 | 145 | ||
143 | index = choose_claim(data, hash->size); | 146 | index = batadv_choose_claim(data, hash->size); |
144 | head = &hash->table[index]; | 147 | head = &hash->table[index]; |
145 | 148 | ||
146 | rcu_read_lock(); | 149 | rcu_read_lock(); |
147 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { | 150 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { |
148 | if (!compare_claim(&claim->hash_entry, data)) | 151 | if (!batadv_compare_claim(&claim->hash_entry, data)) |
149 | continue; | 152 | continue; |
150 | 153 | ||
151 | if (!atomic_inc_not_zero(&claim->refcount)) | 154 | if (!atomic_inc_not_zero(&claim->refcount)) |
@@ -166,8 +169,8 @@ static struct claim *claim_hash_find(struct bat_priv *bat_priv, | |||
166 | * looks for a claim in the hash, and returns it if found | 169 | * looks for a claim in the hash, and returns it if found |
167 | * or NULL otherwise. | 170 | * or NULL otherwise. |
168 | */ | 171 | */ |
169 | static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv, | 172 | static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv, |
170 | uint8_t *addr, short vid) | 173 | uint8_t *addr, short vid) |
171 | { | 174 | { |
172 | struct hashtable_t *hash = bat_priv->backbone_hash; | 175 | struct hashtable_t *hash = bat_priv->backbone_hash; |
173 | struct hlist_head *head; | 176 | struct hlist_head *head; |
@@ -182,13 +185,13 @@ static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv, | |||
182 | memcpy(search_entry.orig, addr, ETH_ALEN); | 185 | memcpy(search_entry.orig, addr, ETH_ALEN); |
183 | search_entry.vid = vid; | 186 | search_entry.vid = vid; |
184 | 187 | ||
185 | index = choose_backbone_gw(&search_entry, hash->size); | 188 | index = batadv_choose_backbone_gw(&search_entry, hash->size); |
186 | head = &hash->table[index]; | 189 | head = &hash->table[index]; |
187 | 190 | ||
188 | rcu_read_lock(); | 191 | rcu_read_lock(); |
189 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 192 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { |
190 | if (!compare_backbone_gw(&backbone_gw->hash_entry, | 193 | if (!batadv_compare_backbone_gw(&backbone_gw->hash_entry, |
191 | &search_entry)) | 194 | &search_entry)) |
192 | continue; | 195 | continue; |
193 | 196 | ||
194 | if (!atomic_inc_not_zero(&backbone_gw->refcount)) | 197 | if (!atomic_inc_not_zero(&backbone_gw->refcount)) |
@@ -203,7 +206,7 @@ static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv, | |||
203 | } | 206 | } |
204 | 207 | ||
205 | /* delete all claims for a backbone */ | 208 | /* delete all claims for a backbone */ |
206 | static void bla_del_backbone_claims(struct backbone_gw *backbone_gw) | 209 | static void batadv_bla_del_backbone_claims(struct backbone_gw *backbone_gw) |
207 | { | 210 | { |
208 | struct hashtable_t *hash; | 211 | struct hashtable_t *hash; |
209 | struct hlist_node *node, *node_tmp; | 212 | struct hlist_node *node, *node_tmp; |
@@ -227,7 +230,7 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw) | |||
227 | if (claim->backbone_gw != backbone_gw) | 230 | if (claim->backbone_gw != backbone_gw) |
228 | continue; | 231 | continue; |
229 | 232 | ||
230 | claim_free_ref(claim); | 233 | batadv_claim_free_ref(claim); |
231 | hlist_del_rcu(node); | 234 | hlist_del_rcu(node); |
232 | } | 235 | } |
233 | spin_unlock_bh(list_lock); | 236 | spin_unlock_bh(list_lock); |
@@ -244,8 +247,8 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw) | |||
244 | * | 247 | * |
245 | * sends a claim frame according to the provided info. | 248 | * sends a claim frame according to the provided info. |
246 | */ | 249 | */ |
247 | static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | 250 | static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, |
248 | short vid, int claimtype) | 251 | short vid, int claimtype) |
249 | { | 252 | { |
250 | struct sk_buff *skb; | 253 | struct sk_buff *skb; |
251 | struct ethhdr *ethhdr; | 254 | struct ethhdr *ethhdr; |
@@ -350,14 +353,14 @@ out: | |||
350 | * searches for the backbone gw or creates a new one if it could not | 353 | * searches for the backbone gw or creates a new one if it could not |
351 | * be found. | 354 | * be found. |
352 | */ | 355 | */ |
353 | static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv, | 356 | static struct backbone_gw *batadv_bla_get_backbone_gw(struct bat_priv *bat_priv, |
354 | uint8_t *orig, short vid) | 357 | uint8_t *orig, short vid) |
355 | { | 358 | { |
356 | struct backbone_gw *entry; | 359 | struct backbone_gw *entry; |
357 | struct orig_node *orig_node; | 360 | struct orig_node *orig_node; |
358 | int hash_added; | 361 | int hash_added; |
359 | 362 | ||
360 | entry = backbone_hash_find(bat_priv, orig, vid); | 363 | entry = batadv_backbone_hash_find(bat_priv, orig, vid); |
361 | 364 | ||
362 | if (entry) | 365 | if (entry) |
363 | return entry; | 366 | return entry; |
@@ -381,8 +384,9 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv, | |||
381 | atomic_set(&entry->refcount, 2); | 384 | atomic_set(&entry->refcount, 2); |
382 | 385 | ||
383 | hash_added = batadv_hash_add(bat_priv->backbone_hash, | 386 | hash_added = batadv_hash_add(bat_priv->backbone_hash, |
384 | compare_backbone_gw, choose_backbone_gw, | 387 | batadv_compare_backbone_gw, |
385 | entry, &entry->hash_entry); | 388 | batadv_choose_backbone_gw, entry, |
389 | &entry->hash_entry); | ||
386 | 390 | ||
387 | if (unlikely(hash_added != 0)) { | 391 | if (unlikely(hash_added != 0)) { |
388 | /* hash failed, free the structure */ | 392 | /* hash failed, free the structure */ |
@@ -403,19 +407,20 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv, | |||
403 | /* update or add the own backbone gw to make sure we announce | 407 | /* update or add the own backbone gw to make sure we announce |
404 | * where we receive other backbone gws | 408 | * where we receive other backbone gws |
405 | */ | 409 | */ |
406 | static void bla_update_own_backbone_gw(struct bat_priv *bat_priv, | 410 | static void batadv_bla_update_own_backbone_gw(struct bat_priv *bat_priv, |
407 | struct hard_iface *primary_if, | 411 | struct hard_iface *primary_if, |
408 | short vid) | 412 | short vid) |
409 | { | 413 | { |
410 | struct backbone_gw *backbone_gw; | 414 | struct backbone_gw *backbone_gw; |
411 | 415 | ||
412 | backbone_gw = bla_get_backbone_gw(bat_priv, | 416 | backbone_gw = batadv_bla_get_backbone_gw(bat_priv, |
413 | primary_if->net_dev->dev_addr, vid); | 417 | primary_if->net_dev->dev_addr, |
418 | vid); | ||
414 | if (unlikely(!backbone_gw)) | 419 | if (unlikely(!backbone_gw)) |
415 | return; | 420 | return; |
416 | 421 | ||
417 | backbone_gw->lasttime = jiffies; | 422 | backbone_gw->lasttime = jiffies; |
418 | backbone_gw_free_ref(backbone_gw); | 423 | batadv_backbone_gw_free_ref(backbone_gw); |
419 | } | 424 | } |
420 | 425 | ||
421 | /* @bat_priv: the bat priv with all the soft interface information | 426 | /* @bat_priv: the bat priv with all the soft interface information |
@@ -424,8 +429,8 @@ static void bla_update_own_backbone_gw(struct bat_priv *bat_priv, | |||
424 | * Repeat all of our own claims, and finally send an ANNOUNCE frame | 429 | * Repeat all of our own claims, and finally send an ANNOUNCE frame |
425 | * to allow the requester another check if the CRC is correct now. | 430 | * to allow the requester another check if the CRC is correct now. |
426 | */ | 431 | */ |
427 | static void bla_answer_request(struct bat_priv *bat_priv, | 432 | static void batadv_bla_answer_request(struct bat_priv *bat_priv, |
428 | struct hard_iface *primary_if, short vid) | 433 | struct hard_iface *primary_if, short vid) |
429 | { | 434 | { |
430 | struct hlist_node *node; | 435 | struct hlist_node *node; |
431 | struct hlist_head *head; | 436 | struct hlist_head *head; |
@@ -437,8 +442,9 @@ static void bla_answer_request(struct bat_priv *bat_priv, | |||
437 | batadv_dbg(DBG_BLA, bat_priv, | 442 | batadv_dbg(DBG_BLA, bat_priv, |
438 | "bla_answer_request(): received a claim request, send all of our own claims again\n"); | 443 | "bla_answer_request(): received a claim request, send all of our own claims again\n"); |
439 | 444 | ||
440 | backbone_gw = backbone_hash_find(bat_priv, | 445 | backbone_gw = batadv_backbone_hash_find(bat_priv, |
441 | primary_if->net_dev->dev_addr, vid); | 446 | primary_if->net_dev->dev_addr, |
447 | vid); | ||
442 | if (!backbone_gw) | 448 | if (!backbone_gw) |
443 | return; | 449 | return; |
444 | 450 | ||
@@ -452,15 +458,15 @@ static void bla_answer_request(struct bat_priv *bat_priv, | |||
452 | if (claim->backbone_gw != backbone_gw) | 458 | if (claim->backbone_gw != backbone_gw) |
453 | continue; | 459 | continue; |
454 | 460 | ||
455 | bla_send_claim(bat_priv, claim->addr, claim->vid, | 461 | batadv_bla_send_claim(bat_priv, claim->addr, claim->vid, |
456 | CLAIM_TYPE_ADD); | 462 | CLAIM_TYPE_ADD); |
457 | } | 463 | } |
458 | rcu_read_unlock(); | 464 | rcu_read_unlock(); |
459 | } | 465 | } |
460 | 466 | ||
461 | /* finally, send an announcement frame */ | 467 | /* finally, send an announcement frame */ |
462 | bla_send_announce(bat_priv, backbone_gw); | 468 | batadv_bla_send_announce(bat_priv, backbone_gw); |
463 | backbone_gw_free_ref(backbone_gw); | 469 | batadv_backbone_gw_free_ref(backbone_gw); |
464 | } | 470 | } |
465 | 471 | ||
466 | /* @backbone_gw: the backbone gateway from whom we are out of sync | 472 | /* @backbone_gw: the backbone gateway from whom we are out of sync |
@@ -469,17 +475,17 @@ static void bla_answer_request(struct bat_priv *bat_priv, | |||
469 | * After the request, it will repeat all of his own claims and finally | 475 | * After the request, it will repeat all of his own claims and finally |
470 | * send an announcement claim with which we can check again. | 476 | * send an announcement claim with which we can check again. |
471 | */ | 477 | */ |
472 | static void bla_send_request(struct backbone_gw *backbone_gw) | 478 | static void batadv_bla_send_request(struct backbone_gw *backbone_gw) |
473 | { | 479 | { |
474 | /* first, remove all old entries */ | 480 | /* first, remove all old entries */ |
475 | bla_del_backbone_claims(backbone_gw); | 481 | batadv_bla_del_backbone_claims(backbone_gw); |
476 | 482 | ||
477 | batadv_dbg(DBG_BLA, backbone_gw->bat_priv, "Sending REQUEST to %pM\n", | 483 | batadv_dbg(DBG_BLA, backbone_gw->bat_priv, "Sending REQUEST to %pM\n", |
478 | backbone_gw->orig); | 484 | backbone_gw->orig); |
479 | 485 | ||
480 | /* send request */ | 486 | /* send request */ |
481 | bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, | 487 | batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, |
482 | backbone_gw->vid, CLAIM_TYPE_REQUEST); | 488 | backbone_gw->vid, CLAIM_TYPE_REQUEST); |
483 | 489 | ||
484 | /* no local broadcasts should be sent or received, for now. */ | 490 | /* no local broadcasts should be sent or received, for now. */ |
485 | if (!atomic_read(&backbone_gw->request_sent)) { | 491 | if (!atomic_read(&backbone_gw->request_sent)) { |
@@ -494,17 +500,18 @@ static void bla_send_request(struct backbone_gw *backbone_gw) | |||
494 | * This function sends an announcement. It is called from multiple | 500 | * This function sends an announcement. It is called from multiple |
495 | * places. | 501 | * places. |
496 | */ | 502 | */ |
497 | static void bla_send_announce(struct bat_priv *bat_priv, | 503 | static void batadv_bla_send_announce(struct bat_priv *bat_priv, |
498 | struct backbone_gw *backbone_gw) | 504 | struct backbone_gw *backbone_gw) |
499 | { | 505 | { |
500 | uint8_t mac[ETH_ALEN]; | 506 | uint8_t mac[ETH_ALEN]; |
501 | __be16 crc; | 507 | __be16 crc; |
502 | 508 | ||
503 | memcpy(mac, announce_mac, 4); | 509 | memcpy(mac, batadv_announce_mac, 4); |
504 | crc = htons(backbone_gw->crc); | 510 | crc = htons(backbone_gw->crc); |
505 | memcpy(&mac[4], &crc, 2); | 511 | memcpy(&mac[4], &crc, 2); |
506 | 512 | ||
507 | bla_send_claim(bat_priv, mac, backbone_gw->vid, CLAIM_TYPE_ANNOUNCE); | 513 | batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid, |
514 | CLAIM_TYPE_ANNOUNCE); | ||
508 | 515 | ||
509 | } | 516 | } |
510 | 517 | ||
@@ -515,8 +522,9 @@ static void bla_send_announce(struct bat_priv *bat_priv, | |||
515 | * | 522 | * |
516 | * Adds a claim in the claim hash. | 523 | * Adds a claim in the claim hash. |
517 | */ | 524 | */ |
518 | static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, | 525 | static void batadv_bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, |
519 | const short vid, struct backbone_gw *backbone_gw) | 526 | const short vid, |
527 | struct backbone_gw *backbone_gw) | ||
520 | { | 528 | { |
521 | struct claim *claim; | 529 | struct claim *claim; |
522 | struct claim search_claim; | 530 | struct claim search_claim; |
@@ -524,7 +532,7 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, | |||
524 | 532 | ||
525 | memcpy(search_claim.addr, mac, ETH_ALEN); | 533 | memcpy(search_claim.addr, mac, ETH_ALEN); |
526 | search_claim.vid = vid; | 534 | search_claim.vid = vid; |
527 | claim = claim_hash_find(bat_priv, &search_claim); | 535 | claim = batadv_claim_hash_find(bat_priv, &search_claim); |
528 | 536 | ||
529 | /* create a new claim entry if it does not exist yet. */ | 537 | /* create a new claim entry if it does not exist yet. */ |
530 | if (!claim) { | 538 | if (!claim) { |
@@ -542,8 +550,9 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, | |||
542 | "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", | 550 | "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", |
543 | mac, vid); | 551 | mac, vid); |
544 | hash_added = batadv_hash_add(bat_priv->claim_hash, | 552 | hash_added = batadv_hash_add(bat_priv->claim_hash, |
545 | compare_claim, choose_claim, | 553 | batadv_compare_claim, |
546 | claim, &claim->hash_entry); | 554 | batadv_choose_claim, claim, |
555 | &claim->hash_entry); | ||
547 | 556 | ||
548 | if (unlikely(hash_added != 0)) { | 557 | if (unlikely(hash_added != 0)) { |
549 | /* only local changes happened. */ | 558 | /* only local changes happened. */ |
@@ -562,7 +571,7 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, | |||
562 | 571 | ||
563 | claim->backbone_gw->crc ^= | 572 | claim->backbone_gw->crc ^= |
564 | crc16(0, claim->addr, ETH_ALEN); | 573 | crc16(0, claim->addr, ETH_ALEN); |
565 | backbone_gw_free_ref(claim->backbone_gw); | 574 | batadv_backbone_gw_free_ref(claim->backbone_gw); |
566 | 575 | ||
567 | } | 576 | } |
568 | /* set (new) backbone gw */ | 577 | /* set (new) backbone gw */ |
@@ -573,47 +582,48 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, | |||
573 | backbone_gw->lasttime = jiffies; | 582 | backbone_gw->lasttime = jiffies; |
574 | 583 | ||
575 | claim_free_ref: | 584 | claim_free_ref: |
576 | claim_free_ref(claim); | 585 | batadv_claim_free_ref(claim); |
577 | } | 586 | } |
578 | 587 | ||
579 | /* Delete a claim from the claim hash which has the | 588 | /* Delete a claim from the claim hash which has the |
580 | * given mac address and vid. | 589 | * given mac address and vid. |
581 | */ | 590 | */ |
582 | static void bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac, | 591 | static void batadv_bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac, |
583 | const short vid) | 592 | const short vid) |
584 | { | 593 | { |
585 | struct claim search_claim, *claim; | 594 | struct claim search_claim, *claim; |
586 | 595 | ||
587 | memcpy(search_claim.addr, mac, ETH_ALEN); | 596 | memcpy(search_claim.addr, mac, ETH_ALEN); |
588 | search_claim.vid = vid; | 597 | search_claim.vid = vid; |
589 | claim = claim_hash_find(bat_priv, &search_claim); | 598 | claim = batadv_claim_hash_find(bat_priv, &search_claim); |
590 | if (!claim) | 599 | if (!claim) |
591 | return; | 600 | return; |
592 | 601 | ||
593 | batadv_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac, | 602 | batadv_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac, |
594 | vid); | 603 | vid); |
595 | 604 | ||
596 | batadv_hash_remove(bat_priv->claim_hash, compare_claim, choose_claim, | 605 | batadv_hash_remove(bat_priv->claim_hash, batadv_compare_claim, |
597 | claim); | 606 | batadv_choose_claim, claim); |
598 | claim_free_ref(claim); /* reference from the hash is gone */ | 607 | batadv_claim_free_ref(claim); /* reference from the hash is gone */ |
599 | 608 | ||
600 | claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN); | 609 | claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN); |
601 | 610 | ||
602 | /* don't need the reference from hash_find() anymore */ | 611 | /* don't need the reference from hash_find() anymore */ |
603 | claim_free_ref(claim); | 612 | batadv_claim_free_ref(claim); |
604 | } | 613 | } |
605 | 614 | ||
606 | /* check for ANNOUNCE frame, return 1 if handled */ | 615 | /* check for ANNOUNCE frame, return 1 if handled */ |
607 | static int handle_announce(struct bat_priv *bat_priv, | 616 | static int batadv_handle_announce(struct bat_priv *bat_priv, |
608 | uint8_t *an_addr, uint8_t *backbone_addr, short vid) | 617 | uint8_t *an_addr, uint8_t *backbone_addr, |
618 | short vid) | ||
609 | { | 619 | { |
610 | struct backbone_gw *backbone_gw; | 620 | struct backbone_gw *backbone_gw; |
611 | uint16_t crc; | 621 | uint16_t crc; |
612 | 622 | ||
613 | if (memcmp(an_addr, announce_mac, 4) != 0) | 623 | if (memcmp(an_addr, batadv_announce_mac, 4) != 0) |
614 | return 0; | 624 | return 0; |
615 | 625 | ||
616 | backbone_gw = bla_get_backbone_gw(bat_priv, backbone_addr, vid); | 626 | backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid); |
617 | 627 | ||
618 | if (unlikely(!backbone_gw)) | 628 | if (unlikely(!backbone_gw)) |
619 | return 1; | 629 | return 1; |
@@ -633,7 +643,7 @@ static int handle_announce(struct bat_priv *bat_priv, | |||
633 | backbone_gw->orig, backbone_gw->vid, | 643 | backbone_gw->orig, backbone_gw->vid, |
634 | backbone_gw->crc, crc); | 644 | backbone_gw->crc, crc); |
635 | 645 | ||
636 | bla_send_request(backbone_gw); | 646 | batadv_bla_send_request(backbone_gw); |
637 | } else { | 647 | } else { |
638 | /* if we have sent a request and the crc was OK, | 648 | /* if we have sent a request and the crc was OK, |
639 | * we can allow traffic again. | 649 | * we can allow traffic again. |
@@ -644,15 +654,15 @@ static int handle_announce(struct bat_priv *bat_priv, | |||
644 | } | 654 | } |
645 | } | 655 | } |
646 | 656 | ||
647 | backbone_gw_free_ref(backbone_gw); | 657 | batadv_backbone_gw_free_ref(backbone_gw); |
648 | return 1; | 658 | return 1; |
649 | } | 659 | } |
650 | 660 | ||
651 | /* check for REQUEST frame, return 1 if handled */ | 661 | /* check for REQUEST frame, return 1 if handled */ |
652 | static int handle_request(struct bat_priv *bat_priv, | 662 | static int batadv_handle_request(struct bat_priv *bat_priv, |
653 | struct hard_iface *primary_if, | 663 | struct hard_iface *primary_if, |
654 | uint8_t *backbone_addr, | 664 | uint8_t *backbone_addr, |
655 | struct ethhdr *ethhdr, short vid) | 665 | struct ethhdr *ethhdr, short vid) |
656 | { | 666 | { |
657 | /* check for REQUEST frame */ | 667 | /* check for REQUEST frame */ |
658 | if (!batadv_compare_eth(backbone_addr, ethhdr->h_dest)) | 668 | if (!batadv_compare_eth(backbone_addr, ethhdr->h_dest)) |
@@ -668,24 +678,25 @@ static int handle_request(struct bat_priv *bat_priv, | |||
668 | "handle_request(): REQUEST vid %d (sent by %pM)...\n", | 678 | "handle_request(): REQUEST vid %d (sent by %pM)...\n", |
669 | vid, ethhdr->h_source); | 679 | vid, ethhdr->h_source); |
670 | 680 | ||
671 | bla_answer_request(bat_priv, primary_if, vid); | 681 | batadv_bla_answer_request(bat_priv, primary_if, vid); |
672 | return 1; | 682 | return 1; |
673 | } | 683 | } |
674 | 684 | ||
675 | /* check for UNCLAIM frame, return 1 if handled */ | 685 | /* check for UNCLAIM frame, return 1 if handled */ |
676 | static int handle_unclaim(struct bat_priv *bat_priv, | 686 | static int batadv_handle_unclaim(struct bat_priv *bat_priv, |
677 | struct hard_iface *primary_if, | 687 | struct hard_iface *primary_if, |
678 | uint8_t *backbone_addr, | 688 | uint8_t *backbone_addr, |
679 | uint8_t *claim_addr, short vid) | 689 | uint8_t *claim_addr, short vid) |
680 | { | 690 | { |
681 | struct backbone_gw *backbone_gw; | 691 | struct backbone_gw *backbone_gw; |
682 | 692 | ||
683 | /* unclaim in any case if it is our own */ | 693 | /* unclaim in any case if it is our own */ |
684 | if (primary_if && batadv_compare_eth(backbone_addr, | 694 | if (primary_if && batadv_compare_eth(backbone_addr, |
685 | primary_if->net_dev->dev_addr)) | 695 | primary_if->net_dev->dev_addr)) |
686 | bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_DEL); | 696 | batadv_bla_send_claim(bat_priv, claim_addr, vid, |
697 | CLAIM_TYPE_DEL); | ||
687 | 698 | ||
688 | backbone_gw = backbone_hash_find(bat_priv, backbone_addr, vid); | 699 | backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid); |
689 | 700 | ||
690 | if (!backbone_gw) | 701 | if (!backbone_gw) |
691 | return 1; | 702 | return 1; |
@@ -695,33 +706,35 @@ static int handle_unclaim(struct bat_priv *bat_priv, | |||
695 | "handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n", | 706 | "handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n", |
696 | claim_addr, vid, backbone_gw->orig); | 707 | claim_addr, vid, backbone_gw->orig); |
697 | 708 | ||
698 | bla_del_claim(bat_priv, claim_addr, vid); | 709 | batadv_bla_del_claim(bat_priv, claim_addr, vid); |
699 | backbone_gw_free_ref(backbone_gw); | 710 | batadv_backbone_gw_free_ref(backbone_gw); |
700 | return 1; | 711 | return 1; |
701 | } | 712 | } |
702 | 713 | ||
703 | /* check for CLAIM frame, return 1 if handled */ | 714 | /* check for CLAIM frame, return 1 if handled */ |
704 | static int handle_claim(struct bat_priv *bat_priv, | 715 | static int batadv_handle_claim(struct bat_priv *bat_priv, |
705 | struct hard_iface *primary_if, uint8_t *backbone_addr, | 716 | struct hard_iface *primary_if, |
706 | uint8_t *claim_addr, short vid) | 717 | uint8_t *backbone_addr, uint8_t *claim_addr, |
718 | short vid) | ||
707 | { | 719 | { |
708 | struct backbone_gw *backbone_gw; | 720 | struct backbone_gw *backbone_gw; |
709 | 721 | ||
710 | /* register the gateway if not yet available, and add the claim. */ | 722 | /* register the gateway if not yet available, and add the claim. */ |
711 | 723 | ||
712 | backbone_gw = bla_get_backbone_gw(bat_priv, backbone_addr, vid); | 724 | backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid); |
713 | 725 | ||
714 | if (unlikely(!backbone_gw)) | 726 | if (unlikely(!backbone_gw)) |
715 | return 1; | 727 | return 1; |
716 | 728 | ||
717 | /* this must be a CLAIM frame */ | 729 | /* this must be a CLAIM frame */ |
718 | bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); | 730 | batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); |
719 | if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) | 731 | if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) |
720 | bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_ADD); | 732 | batadv_bla_send_claim(bat_priv, claim_addr, vid, |
733 | CLAIM_TYPE_ADD); | ||
721 | 734 | ||
722 | /* TODO: we could call something like tt_local_del() here. */ | 735 | /* TODO: we could call something like tt_local_del() here. */ |
723 | 736 | ||
724 | backbone_gw_free_ref(backbone_gw); | 737 | batadv_backbone_gw_free_ref(backbone_gw); |
725 | return 1; | 738 | return 1; |
726 | } | 739 | } |
727 | 740 | ||
@@ -739,10 +752,10 @@ static int handle_claim(struct bat_priv *bat_priv, | |||
739 | * 1 - if is a claim packet from another group | 752 | * 1 - if is a claim packet from another group |
740 | * 0 - if it is not a claim packet | 753 | * 0 - if it is not a claim packet |
741 | */ | 754 | */ |
742 | static int check_claim_group(struct bat_priv *bat_priv, | 755 | static int batadv_check_claim_group(struct bat_priv *bat_priv, |
743 | struct hard_iface *primary_if, | 756 | struct hard_iface *primary_if, |
744 | uint8_t *hw_src, uint8_t *hw_dst, | 757 | uint8_t *hw_src, uint8_t *hw_dst, |
745 | struct ethhdr *ethhdr) | 758 | struct ethhdr *ethhdr) |
746 | { | 759 | { |
747 | uint8_t *backbone_addr; | 760 | uint8_t *backbone_addr; |
748 | struct orig_node *orig_node; | 761 | struct orig_node *orig_node; |
@@ -811,9 +824,9 @@ static int check_claim_group(struct bat_priv *bat_priv, | |||
811 | * returns 1 if it was a claim frame, otherwise return 0 to | 824 | * returns 1 if it was a claim frame, otherwise return 0 to |
812 | * tell the callee that it can use the frame on its own. | 825 | * tell the callee that it can use the frame on its own. |
813 | */ | 826 | */ |
814 | static int bla_process_claim(struct bat_priv *bat_priv, | 827 | static int batadv_bla_process_claim(struct bat_priv *bat_priv, |
815 | struct hard_iface *primary_if, | 828 | struct hard_iface *primary_if, |
816 | struct sk_buff *skb) | 829 | struct sk_buff *skb) |
817 | { | 830 | { |
818 | struct ethhdr *ethhdr; | 831 | struct ethhdr *ethhdr; |
819 | struct vlan_ethhdr *vhdr; | 832 | struct vlan_ethhdr *vhdr; |
@@ -866,7 +879,8 @@ static int bla_process_claim(struct bat_priv *bat_priv, | |||
866 | bla_dst = (struct bla_claim_dst *)hw_dst; | 879 | bla_dst = (struct bla_claim_dst *)hw_dst; |
867 | 880 | ||
868 | /* check if it is a claim frame. */ | 881 | /* check if it is a claim frame. */ |
869 | ret = check_claim_group(bat_priv, primary_if, hw_src, hw_dst, ethhdr); | 882 | ret = batadv_check_claim_group(bat_priv, primary_if, hw_src, hw_dst, |
883 | ethhdr); | ||
870 | if (ret == 1) | 884 | if (ret == 1) |
871 | batadv_dbg(DBG_BLA, bat_priv, | 885 | batadv_dbg(DBG_BLA, bat_priv, |
872 | "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", | 886 | "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", |
@@ -876,27 +890,29 @@ static int bla_process_claim(struct bat_priv *bat_priv, | |||
876 | return ret; | 890 | return ret; |
877 | 891 | ||
878 | /* become a backbone gw ourselves on this vlan if not happened yet */ | 892 | /* become a backbone gw ourselves on this vlan if not happened yet */ |
879 | bla_update_own_backbone_gw(bat_priv, primary_if, vid); | 893 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); |
880 | 894 | ||
881 | /* check for the different types of claim frames ... */ | 895 | /* check for the different types of claim frames ... */ |
882 | switch (bla_dst->type) { | 896 | switch (bla_dst->type) { |
883 | case CLAIM_TYPE_ADD: | 897 | case CLAIM_TYPE_ADD: |
884 | if (handle_claim(bat_priv, primary_if, hw_src, | 898 | if (batadv_handle_claim(bat_priv, primary_if, hw_src, |
885 | ethhdr->h_source, vid)) | 899 | ethhdr->h_source, vid)) |
886 | return 1; | 900 | return 1; |
887 | break; | 901 | break; |
888 | case CLAIM_TYPE_DEL: | 902 | case CLAIM_TYPE_DEL: |
889 | if (handle_unclaim(bat_priv, primary_if, | 903 | if (batadv_handle_unclaim(bat_priv, primary_if, |
890 | ethhdr->h_source, hw_src, vid)) | 904 | ethhdr->h_source, hw_src, vid)) |
891 | return 1; | 905 | return 1; |
892 | break; | 906 | break; |
893 | 907 | ||
894 | case CLAIM_TYPE_ANNOUNCE: | 908 | case CLAIM_TYPE_ANNOUNCE: |
895 | if (handle_announce(bat_priv, hw_src, ethhdr->h_source, vid)) | 909 | if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source, |
910 | vid)) | ||
896 | return 1; | 911 | return 1; |
897 | break; | 912 | break; |
898 | case CLAIM_TYPE_REQUEST: | 913 | case CLAIM_TYPE_REQUEST: |
899 | if (handle_request(bat_priv, primary_if, hw_src, ethhdr, vid)) | 914 | if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr, |
915 | vid)) | ||
900 | return 1; | 916 | return 1; |
901 | break; | 917 | break; |
902 | } | 918 | } |
@@ -910,7 +926,7 @@ static int bla_process_claim(struct bat_priv *bat_priv, | |||
910 | /* Check when we last heard from other nodes, and remove them in case of | 926 | /* Check when we last heard from other nodes, and remove them in case of |
911 | * a time out, or clean all backbone gws if now is set. | 927 | * a time out, or clean all backbone gws if now is set. |
912 | */ | 928 | */ |
913 | static void bla_purge_backbone_gw(struct bat_priv *bat_priv, int now) | 929 | static void batadv_bla_purge_backbone_gw(struct bat_priv *bat_priv, int now) |
914 | { | 930 | { |
915 | struct backbone_gw *backbone_gw; | 931 | struct backbone_gw *backbone_gw; |
916 | struct hlist_node *node, *node_tmp; | 932 | struct hlist_node *node, *node_tmp; |
@@ -945,10 +961,10 @@ purge_now: | |||
945 | if (atomic_read(&backbone_gw->request_sent)) | 961 | if (atomic_read(&backbone_gw->request_sent)) |
946 | atomic_dec(&bat_priv->bla_num_requests); | 962 | atomic_dec(&bat_priv->bla_num_requests); |
947 | 963 | ||
948 | bla_del_backbone_claims(backbone_gw); | 964 | batadv_bla_del_backbone_claims(backbone_gw); |
949 | 965 | ||
950 | hlist_del_rcu(node); | 966 | hlist_del_rcu(node); |
951 | backbone_gw_free_ref(backbone_gw); | 967 | batadv_backbone_gw_free_ref(backbone_gw); |
952 | } | 968 | } |
953 | spin_unlock_bh(list_lock); | 969 | spin_unlock_bh(list_lock); |
954 | } | 970 | } |
@@ -961,8 +977,8 @@ purge_now: | |||
961 | * Check when we heard last time from our own claims, and remove them in case of | 977 | * Check when we heard last time from our own claims, and remove them in case of |
962 | * a time out, or clean all claims if now is set | 978 | * a time out, or clean all claims if now is set |
963 | */ | 979 | */ |
964 | static void bla_purge_claims(struct bat_priv *bat_priv, | 980 | static void batadv_bla_purge_claims(struct bat_priv *bat_priv, |
965 | struct hard_iface *primary_if, int now) | 981 | struct hard_iface *primary_if, int now) |
966 | { | 982 | { |
967 | struct claim *claim; | 983 | struct claim *claim; |
968 | struct hlist_node *node; | 984 | struct hlist_node *node; |
@@ -993,9 +1009,9 @@ static void bla_purge_claims(struct bat_priv *bat_priv, | |||
993 | claim->addr, claim->vid); | 1009 | claim->addr, claim->vid); |
994 | 1010 | ||
995 | purge_now: | 1011 | purge_now: |
996 | handle_unclaim(bat_priv, primary_if, | 1012 | batadv_handle_unclaim(bat_priv, primary_if, |
997 | claim->backbone_gw->orig, | 1013 | claim->backbone_gw->orig, |
998 | claim->addr, claim->vid); | 1014 | claim->addr, claim->vid); |
999 | } | 1015 | } |
1000 | rcu_read_unlock(); | 1016 | rcu_read_unlock(); |
1001 | } | 1017 | } |
@@ -1022,8 +1038,8 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv, | |||
1022 | htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN)); | 1038 | htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN)); |
1023 | 1039 | ||
1024 | if (!oldif) { | 1040 | if (!oldif) { |
1025 | bla_purge_claims(bat_priv, NULL, 1); | 1041 | batadv_bla_purge_claims(bat_priv, NULL, 1); |
1026 | bla_purge_backbone_gw(bat_priv, 1); | 1042 | batadv_bla_purge_backbone_gw(bat_priv, 1); |
1027 | return; | 1043 | return; |
1028 | } | 1044 | } |
1029 | 1045 | ||
@@ -1046,7 +1062,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv, | |||
1046 | /* send an announce frame so others will ask for our | 1062 | /* send an announce frame so others will ask for our |
1047 | * claims and update their tables. | 1063 | * claims and update their tables. |
1048 | */ | 1064 | */ |
1049 | bla_send_announce(bat_priv, backbone_gw); | 1065 | batadv_bla_send_announce(bat_priv, backbone_gw); |
1050 | } | 1066 | } |
1051 | rcu_read_unlock(); | 1067 | rcu_read_unlock(); |
1052 | } | 1068 | } |
@@ -1055,9 +1071,9 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv, | |||
1055 | 1071 | ||
1056 | 1072 | ||
1057 | /* (re)start the timer */ | 1073 | /* (re)start the timer */ |
1058 | static void bla_start_timer(struct bat_priv *bat_priv) | 1074 | static void batadv_bla_start_timer(struct bat_priv *bat_priv) |
1059 | { | 1075 | { |
1060 | INIT_DELAYED_WORK(&bat_priv->bla_work, bla_periodic_work); | 1076 | INIT_DELAYED_WORK(&bat_priv->bla_work, batadv_bla_periodic_work); |
1061 | queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work, | 1077 | queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work, |
1062 | msecs_to_jiffies(BLA_PERIOD_LENGTH)); | 1078 | msecs_to_jiffies(BLA_PERIOD_LENGTH)); |
1063 | } | 1079 | } |
@@ -1066,7 +1082,7 @@ static void bla_start_timer(struct bat_priv *bat_priv) | |||
1066 | * * purge structures when they are too old | 1082 | * * purge structures when they are too old |
1067 | * * send announcements | 1083 | * * send announcements |
1068 | */ | 1084 | */ |
1069 | static void bla_periodic_work(struct work_struct *work) | 1085 | static void batadv_bla_periodic_work(struct work_struct *work) |
1070 | { | 1086 | { |
1071 | struct delayed_work *delayed_work = | 1087 | struct delayed_work *delayed_work = |
1072 | container_of(work, struct delayed_work, work); | 1088 | container_of(work, struct delayed_work, work); |
@@ -1083,8 +1099,8 @@ static void bla_periodic_work(struct work_struct *work) | |||
1083 | if (!primary_if) | 1099 | if (!primary_if) |
1084 | goto out; | 1100 | goto out; |
1085 | 1101 | ||
1086 | bla_purge_claims(bat_priv, primary_if, 0); | 1102 | batadv_bla_purge_claims(bat_priv, primary_if, 0); |
1087 | bla_purge_backbone_gw(bat_priv, 0); | 1103 | batadv_bla_purge_backbone_gw(bat_priv, 0); |
1088 | 1104 | ||
1089 | if (!atomic_read(&bat_priv->bridge_loop_avoidance)) | 1105 | if (!atomic_read(&bat_priv->bridge_loop_avoidance)) |
1090 | goto out; | 1106 | goto out; |
@@ -1104,7 +1120,7 @@ static void bla_periodic_work(struct work_struct *work) | |||
1104 | 1120 | ||
1105 | backbone_gw->lasttime = jiffies; | 1121 | backbone_gw->lasttime = jiffies; |
1106 | 1122 | ||
1107 | bla_send_announce(bat_priv, backbone_gw); | 1123 | batadv_bla_send_announce(bat_priv, backbone_gw); |
1108 | } | 1124 | } |
1109 | rcu_read_unlock(); | 1125 | rcu_read_unlock(); |
1110 | } | 1126 | } |
@@ -1112,7 +1128,7 @@ out: | |||
1112 | if (primary_if) | 1128 | if (primary_if) |
1113 | batadv_hardif_free_ref(primary_if); | 1129 | batadv_hardif_free_ref(primary_if); |
1114 | 1130 | ||
1115 | bla_start_timer(bat_priv); | 1131 | batadv_bla_start_timer(bat_priv); |
1116 | } | 1132 | } |
1117 | 1133 | ||
1118 | /* The hash for claim and backbone hash receive the same key because they | 1134 | /* The hash for claim and backbone hash receive the same key because they |
@@ -1120,8 +1136,8 @@ out: | |||
1120 | * them with to different keys to allow nested locking without generating | 1136 | * them with to different keys to allow nested locking without generating |
1121 | * lockdep warnings | 1137 | * lockdep warnings |
1122 | */ | 1138 | */ |
1123 | static struct lock_class_key claim_hash_lock_class_key; | 1139 | static struct lock_class_key batadv_claim_hash_lock_class_key; |
1124 | static struct lock_class_key backbone_hash_lock_class_key; | 1140 | static struct lock_class_key batadv_backbone_hash_lock_class_key; |
1125 | 1141 | ||
1126 | /* initialize all bla structures */ | 1142 | /* initialize all bla structures */ |
1127 | int batadv_bla_init(struct bat_priv *bat_priv) | 1143 | int batadv_bla_init(struct bat_priv *bat_priv) |
@@ -1161,13 +1177,13 @@ int batadv_bla_init(struct bat_priv *bat_priv) | |||
1161 | return -ENOMEM; | 1177 | return -ENOMEM; |
1162 | 1178 | ||
1163 | batadv_hash_set_lock_class(bat_priv->claim_hash, | 1179 | batadv_hash_set_lock_class(bat_priv->claim_hash, |
1164 | &claim_hash_lock_class_key); | 1180 | &batadv_claim_hash_lock_class_key); |
1165 | batadv_hash_set_lock_class(bat_priv->backbone_hash, | 1181 | batadv_hash_set_lock_class(bat_priv->backbone_hash, |
1166 | &backbone_hash_lock_class_key); | 1182 | &batadv_backbone_hash_lock_class_key); |
1167 | 1183 | ||
1168 | batadv_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n"); | 1184 | batadv_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n"); |
1169 | 1185 | ||
1170 | bla_start_timer(bat_priv); | 1186 | batadv_bla_start_timer(bat_priv); |
1171 | return 0; | 1187 | return 0; |
1172 | } | 1188 | } |
1173 | 1189 | ||
@@ -1308,12 +1324,12 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, | |||
1308 | } | 1324 | } |
1309 | 1325 | ||
1310 | /* see if this originator is a backbone gw for this VLAN */ | 1326 | /* see if this originator is a backbone gw for this VLAN */ |
1311 | backbone_gw = backbone_hash_find(orig_node->bat_priv, | 1327 | backbone_gw = batadv_backbone_hash_find(orig_node->bat_priv, |
1312 | orig_node->orig, vid); | 1328 | orig_node->orig, vid); |
1313 | if (!backbone_gw) | 1329 | if (!backbone_gw) |
1314 | return 0; | 1330 | return 0; |
1315 | 1331 | ||
1316 | backbone_gw_free_ref(backbone_gw); | 1332 | batadv_backbone_gw_free_ref(backbone_gw); |
1317 | return 1; | 1333 | return 1; |
1318 | } | 1334 | } |
1319 | 1335 | ||
@@ -1326,12 +1342,12 @@ void batadv_bla_free(struct bat_priv *bat_priv) | |||
1326 | primary_if = batadv_primary_if_get_selected(bat_priv); | 1342 | primary_if = batadv_primary_if_get_selected(bat_priv); |
1327 | 1343 | ||
1328 | if (bat_priv->claim_hash) { | 1344 | if (bat_priv->claim_hash) { |
1329 | bla_purge_claims(bat_priv, primary_if, 1); | 1345 | batadv_bla_purge_claims(bat_priv, primary_if, 1); |
1330 | batadv_hash_destroy(bat_priv->claim_hash); | 1346 | batadv_hash_destroy(bat_priv->claim_hash); |
1331 | bat_priv->claim_hash = NULL; | 1347 | bat_priv->claim_hash = NULL; |
1332 | } | 1348 | } |
1333 | if (bat_priv->backbone_hash) { | 1349 | if (bat_priv->backbone_hash) { |
1334 | bla_purge_backbone_gw(bat_priv, 1); | 1350 | batadv_bla_purge_backbone_gw(bat_priv, 1); |
1335 | batadv_hash_destroy(bat_priv->backbone_hash); | 1351 | batadv_hash_destroy(bat_priv->backbone_hash); |
1336 | bat_priv->backbone_hash = NULL; | 1352 | bat_priv->backbone_hash = NULL; |
1337 | } | 1353 | } |
@@ -1375,15 +1391,15 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1375 | 1391 | ||
1376 | memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); | 1392 | memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); |
1377 | search_claim.vid = vid; | 1393 | search_claim.vid = vid; |
1378 | claim = claim_hash_find(bat_priv, &search_claim); | 1394 | claim = batadv_claim_hash_find(bat_priv, &search_claim); |
1379 | 1395 | ||
1380 | if (!claim) { | 1396 | if (!claim) { |
1381 | /* possible optimization: race for a claim */ | 1397 | /* possible optimization: race for a claim */ |
1382 | /* No claim exists yet, claim it for us! | 1398 | /* No claim exists yet, claim it for us! |
1383 | */ | 1399 | */ |
1384 | handle_claim(bat_priv, primary_if, | 1400 | batadv_handle_claim(bat_priv, primary_if, |
1385 | primary_if->net_dev->dev_addr, | 1401 | primary_if->net_dev->dev_addr, |
1386 | ethhdr->h_source, vid); | 1402 | ethhdr->h_source, vid); |
1387 | goto allow; | 1403 | goto allow; |
1388 | } | 1404 | } |
1389 | 1405 | ||
@@ -1404,13 +1420,13 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1404 | * send a claim and update the claim table | 1420 | * send a claim and update the claim table |
1405 | * immediately. | 1421 | * immediately. |
1406 | */ | 1422 | */ |
1407 | handle_claim(bat_priv, primary_if, | 1423 | batadv_handle_claim(bat_priv, primary_if, |
1408 | primary_if->net_dev->dev_addr, | 1424 | primary_if->net_dev->dev_addr, |
1409 | ethhdr->h_source, vid); | 1425 | ethhdr->h_source, vid); |
1410 | goto allow; | 1426 | goto allow; |
1411 | } | 1427 | } |
1412 | allow: | 1428 | allow: |
1413 | bla_update_own_backbone_gw(bat_priv, primary_if, vid); | 1429 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); |
1414 | ret = 0; | 1430 | ret = 0; |
1415 | goto out; | 1431 | goto out; |
1416 | 1432 | ||
@@ -1422,7 +1438,7 @@ out: | |||
1422 | if (primary_if) | 1438 | if (primary_if) |
1423 | batadv_hardif_free_ref(primary_if); | 1439 | batadv_hardif_free_ref(primary_if); |
1424 | if (claim) | 1440 | if (claim) |
1425 | claim_free_ref(claim); | 1441 | batadv_claim_free_ref(claim); |
1426 | return ret; | 1442 | return ret; |
1427 | } | 1443 | } |
1428 | 1444 | ||
@@ -1455,7 +1471,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1455 | /* in VLAN case, the mac header might not be set. */ | 1471 | /* in VLAN case, the mac header might not be set. */ |
1456 | skb_reset_mac_header(skb); | 1472 | skb_reset_mac_header(skb); |
1457 | 1473 | ||
1458 | if (bla_process_claim(bat_priv, primary_if, skb)) | 1474 | if (batadv_bla_process_claim(bat_priv, primary_if, skb)) |
1459 | goto handled; | 1475 | goto handled; |
1460 | 1476 | ||
1461 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | 1477 | ethhdr = (struct ethhdr *)skb_mac_header(skb); |
@@ -1468,7 +1484,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1468 | memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); | 1484 | memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); |
1469 | search_claim.vid = vid; | 1485 | search_claim.vid = vid; |
1470 | 1486 | ||
1471 | claim = claim_hash_find(bat_priv, &search_claim); | 1487 | claim = batadv_claim_hash_find(bat_priv, &search_claim); |
1472 | 1488 | ||
1473 | /* if no claim exists, allow it. */ | 1489 | /* if no claim exists, allow it. */ |
1474 | if (!claim) | 1490 | if (!claim) |
@@ -1480,9 +1496,9 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1480 | /* if yes, the client has roamed and we have | 1496 | /* if yes, the client has roamed and we have |
1481 | * to unclaim it. | 1497 | * to unclaim it. |
1482 | */ | 1498 | */ |
1483 | handle_unclaim(bat_priv, primary_if, | 1499 | batadv_handle_unclaim(bat_priv, primary_if, |
1484 | primary_if->net_dev->dev_addr, | 1500 | primary_if->net_dev->dev_addr, |
1485 | ethhdr->h_source, vid); | 1501 | ethhdr->h_source, vid); |
1486 | goto allow; | 1502 | goto allow; |
1487 | } | 1503 | } |
1488 | 1504 | ||
@@ -1499,7 +1515,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1499 | goto allow; | 1515 | goto allow; |
1500 | } | 1516 | } |
1501 | allow: | 1517 | allow: |
1502 | bla_update_own_backbone_gw(bat_priv, primary_if, vid); | 1518 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); |
1503 | ret = 0; | 1519 | ret = 0; |
1504 | goto out; | 1520 | goto out; |
1505 | handled: | 1521 | handled: |
@@ -1508,7 +1524,7 @@ out: | |||
1508 | if (primary_if) | 1524 | if (primary_if) |
1509 | batadv_hardif_free_ref(primary_if); | 1525 | batadv_hardif_free_ref(primary_if); |
1510 | if (claim) | 1526 | if (claim) |
1511 | claim_free_ref(claim); | 1527 | batadv_claim_free_ref(claim); |
1512 | return ret; | 1528 | return ret; |
1513 | } | 1529 | } |
1514 | 1530 | ||