aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bridge_loop_avoidance.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2012-12-25 04:03:24 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-01-19 08:18:11 -0500
commitbae987747150d8939bf385863f49e2647db15e2a (patch)
tree863f4d9a2cbafc326c5975966316276f2ffb4a68 /net/batman-adv/bridge_loop_avoidance.c
parent28500f07abf120e5609a68d6eb2f78350562381d (diff)
batman-adv: rename batadv_backbone_gw struct to make clear it is used by bla
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/bridge_loop_avoidance.c')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index bb5fbd64dc28..5f9a206ca8a0 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -34,8 +34,9 @@
34static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05}; 34static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05};
35 35
36static void batadv_bla_periodic_work(struct work_struct *work); 36static void batadv_bla_periodic_work(struct work_struct *work);
37static void batadv_bla_send_announce(struct batadv_priv *bat_priv, 37static void
38 struct batadv_backbone_gw *backbone_gw); 38batadv_bla_send_announce(struct batadv_priv *bat_priv,
39 struct batadv_bla_backbone_gw *backbone_gw);
39 40
40/* return the index of the claim */ 41/* return the index of the claim */
41static inline uint32_t batadv_choose_claim(const void *data, uint32_t size) 42static inline uint32_t batadv_choose_claim(const void *data, uint32_t size)
@@ -75,9 +76,9 @@ static inline uint32_t batadv_choose_backbone_gw(const void *data,
75static int batadv_compare_backbone_gw(const struct hlist_node *node, 76static int batadv_compare_backbone_gw(const struct hlist_node *node,
76 const void *data2) 77 const void *data2)
77{ 78{
78 const void *data1 = container_of(node, struct batadv_backbone_gw, 79 const void *data1 = container_of(node, struct batadv_bla_backbone_gw,
79 hash_entry); 80 hash_entry);
80 const struct batadv_backbone_gw *gw1 = data1, *gw2 = data2; 81 const struct batadv_bla_backbone_gw *gw1 = data1, *gw2 = data2;
81 82
82 if (!batadv_compare_eth(gw1->orig, gw2->orig)) 83 if (!batadv_compare_eth(gw1->orig, gw2->orig))
83 return 0; 84 return 0;
@@ -106,7 +107,8 @@ static int batadv_compare_claim(const struct hlist_node *node,
106} 107}
107 108
108/* free a backbone gw */ 109/* free a backbone gw */
109static void batadv_backbone_gw_free_ref(struct batadv_backbone_gw *backbone_gw) 110static void
111batadv_backbone_gw_free_ref(struct batadv_bla_backbone_gw *backbone_gw)
110{ 112{
111 if (atomic_dec_and_test(&backbone_gw->refcount)) 113 if (atomic_dec_and_test(&backbone_gw->refcount))
112 kfree_rcu(backbone_gw, rcu); 114 kfree_rcu(backbone_gw, rcu);
@@ -176,15 +178,15 @@ static struct batadv_claim *batadv_claim_hash_find(struct batadv_priv *bat_priv,
176 * 178 *
177 * Returns claim if found or NULL otherwise. 179 * Returns claim if found or NULL otherwise.
178 */ 180 */
179static struct batadv_backbone_gw * 181static struct batadv_bla_backbone_gw *
180batadv_backbone_hash_find(struct batadv_priv *bat_priv, 182batadv_backbone_hash_find(struct batadv_priv *bat_priv,
181 uint8_t *addr, short vid) 183 uint8_t *addr, short vid)
182{ 184{
183 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; 185 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
184 struct hlist_head *head; 186 struct hlist_head *head;
185 struct hlist_node *node; 187 struct hlist_node *node;
186 struct batadv_backbone_gw search_entry, *backbone_gw; 188 struct batadv_bla_backbone_gw search_entry, *backbone_gw;
187 struct batadv_backbone_gw *backbone_gw_tmp = NULL; 189 struct batadv_bla_backbone_gw *backbone_gw_tmp = NULL;
188 int index; 190 int index;
189 191
190 if (!hash) 192 if (!hash)
@@ -215,7 +217,7 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv,
215 217
216/* delete all claims for a backbone */ 218/* delete all claims for a backbone */
217static void 219static void
218batadv_bla_del_backbone_claims(struct batadv_backbone_gw *backbone_gw) 220batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
219{ 221{
220 struct batadv_hashtable *hash; 222 struct batadv_hashtable *hash;
221 struct hlist_node *node, *node_tmp; 223 struct hlist_node *node, *node_tmp;
@@ -364,11 +366,11 @@ out:
364 * searches for the backbone gw or creates a new one if it could not 366 * searches for the backbone gw or creates a new one if it could not
365 * be found. 367 * be found.
366 */ 368 */
367static struct batadv_backbone_gw * 369static struct batadv_bla_backbone_gw *
368batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig, 370batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
369 short vid, bool own_backbone) 371 short vid, bool own_backbone)
370{ 372{
371 struct batadv_backbone_gw *entry; 373 struct batadv_bla_backbone_gw *entry;
372 struct batadv_orig_node *orig_node; 374 struct batadv_orig_node *orig_node;
373 int hash_added; 375 int hash_added;
374 376
@@ -435,7 +437,7 @@ batadv_bla_update_own_backbone_gw(struct batadv_priv *bat_priv,
435 struct batadv_hard_iface *primary_if, 437 struct batadv_hard_iface *primary_if,
436 short vid) 438 short vid)
437{ 439{
438 struct batadv_backbone_gw *backbone_gw; 440 struct batadv_bla_backbone_gw *backbone_gw;
439 441
440 backbone_gw = batadv_bla_get_backbone_gw(bat_priv, 442 backbone_gw = batadv_bla_get_backbone_gw(bat_priv,
441 primary_if->net_dev->dev_addr, 443 primary_if->net_dev->dev_addr,
@@ -461,7 +463,7 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv,
461 struct hlist_head *head; 463 struct hlist_head *head;
462 struct batadv_hashtable *hash; 464 struct batadv_hashtable *hash;
463 struct batadv_claim *claim; 465 struct batadv_claim *claim;
464 struct batadv_backbone_gw *backbone_gw; 466 struct batadv_bla_backbone_gw *backbone_gw;
465 int i; 467 int i;
466 468
467 batadv_dbg(BATADV_DBG_BLA, bat_priv, 469 batadv_dbg(BATADV_DBG_BLA, bat_priv,
@@ -500,7 +502,7 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv,
500 * After the request, it will repeat all of his own claims and finally 502 * After the request, it will repeat all of his own claims and finally
501 * send an announcement claim with which we can check again. 503 * send an announcement claim with which we can check again.
502 */ 504 */
503static void batadv_bla_send_request(struct batadv_backbone_gw *backbone_gw) 505static void batadv_bla_send_request(struct batadv_bla_backbone_gw *backbone_gw)
504{ 506{
505 /* first, remove all old entries */ 507 /* first, remove all old entries */
506 batadv_bla_del_backbone_claims(backbone_gw); 508 batadv_bla_del_backbone_claims(backbone_gw);
@@ -526,7 +528,7 @@ static void batadv_bla_send_request(struct batadv_backbone_gw *backbone_gw)
526 * places. 528 * places.
527 */ 529 */
528static void batadv_bla_send_announce(struct batadv_priv *bat_priv, 530static void batadv_bla_send_announce(struct batadv_priv *bat_priv,
529 struct batadv_backbone_gw *backbone_gw) 531 struct batadv_bla_backbone_gw *backbone_gw)
530{ 532{
531 uint8_t mac[ETH_ALEN]; 533 uint8_t mac[ETH_ALEN];
532 __be16 crc; 534 __be16 crc;
@@ -548,7 +550,7 @@ static void batadv_bla_send_announce(struct batadv_priv *bat_priv,
548 */ 550 */
549static void batadv_bla_add_claim(struct batadv_priv *bat_priv, 551static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
550 const uint8_t *mac, const short vid, 552 const uint8_t *mac, const short vid,
551 struct batadv_backbone_gw *backbone_gw) 553 struct batadv_bla_backbone_gw *backbone_gw)
552{ 554{
553 struct batadv_claim *claim; 555 struct batadv_claim *claim;
554 struct batadv_claim search_claim; 556 struct batadv_claim search_claim;
@@ -639,7 +641,7 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv,
639 uint8_t *an_addr, uint8_t *backbone_addr, 641 uint8_t *an_addr, uint8_t *backbone_addr,
640 short vid) 642 short vid)
641{ 643{
642 struct batadv_backbone_gw *backbone_gw; 644 struct batadv_bla_backbone_gw *backbone_gw;
643 uint16_t crc; 645 uint16_t crc;
644 646
645 if (memcmp(an_addr, batadv_announce_mac, 4) != 0) 647 if (memcmp(an_addr, batadv_announce_mac, 4) != 0)
@@ -711,7 +713,7 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv,
711 uint8_t *backbone_addr, 713 uint8_t *backbone_addr,
712 uint8_t *claim_addr, short vid) 714 uint8_t *claim_addr, short vid)
713{ 715{
714 struct batadv_backbone_gw *backbone_gw; 716 struct batadv_bla_backbone_gw *backbone_gw;
715 717
716 /* unclaim in any case if it is our own */ 718 /* unclaim in any case if it is our own */
717 if (primary_if && batadv_compare_eth(backbone_addr, 719 if (primary_if && batadv_compare_eth(backbone_addr,
@@ -740,7 +742,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv,
740 uint8_t *backbone_addr, uint8_t *claim_addr, 742 uint8_t *backbone_addr, uint8_t *claim_addr,
741 short vid) 743 short vid)
742{ 744{
743 struct batadv_backbone_gw *backbone_gw; 745 struct batadv_bla_backbone_gw *backbone_gw;
744 746
745 /* register the gateway if not yet available, and add the claim. */ 747 /* register the gateway if not yet available, and add the claim. */
746 748
@@ -954,7 +956,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv,
954 */ 956 */
955static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) 957static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now)
956{ 958{
957 struct batadv_backbone_gw *backbone_gw; 959 struct batadv_bla_backbone_gw *backbone_gw;
958 struct hlist_node *node, *node_tmp; 960 struct hlist_node *node, *node_tmp;
959 struct hlist_head *head; 961 struct hlist_head *head;
960 struct batadv_hashtable *hash; 962 struct batadv_hashtable *hash;
@@ -1058,7 +1060,7 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
1058 struct batadv_hard_iface *primary_if, 1060 struct batadv_hard_iface *primary_if,
1059 struct batadv_hard_iface *oldif) 1061 struct batadv_hard_iface *oldif)
1060{ 1062{
1061 struct batadv_backbone_gw *backbone_gw; 1063 struct batadv_bla_backbone_gw *backbone_gw;
1062 struct hlist_node *node; 1064 struct hlist_node *node;
1063 struct hlist_head *head; 1065 struct hlist_head *head;
1064 struct batadv_hashtable *hash; 1066 struct batadv_hashtable *hash;
@@ -1111,7 +1113,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
1111 struct batadv_priv_bla *priv_bla; 1113 struct batadv_priv_bla *priv_bla;
1112 struct hlist_node *node; 1114 struct hlist_node *node;
1113 struct hlist_head *head; 1115 struct hlist_head *head;
1114 struct batadv_backbone_gw *backbone_gw; 1116 struct batadv_bla_backbone_gw *backbone_gw;
1115 struct batadv_hashtable *hash; 1117 struct batadv_hashtable *hash;
1116 struct batadv_hard_iface *primary_if; 1118 struct batadv_hard_iface *primary_if;
1117 int i; 1119 int i;
@@ -1320,7 +1322,7 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig)
1320 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; 1322 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
1321 struct hlist_head *head; 1323 struct hlist_head *head;
1322 struct hlist_node *node; 1324 struct hlist_node *node;
1323 struct batadv_backbone_gw *backbone_gw; 1325 struct batadv_bla_backbone_gw *backbone_gw;
1324 int i; 1326 int i;
1325 1327
1326 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) 1328 if (!atomic_read(&bat_priv->bridge_loop_avoidance))
@@ -1361,7 +1363,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
1361{ 1363{
1362 struct ethhdr *ethhdr; 1364 struct ethhdr *ethhdr;
1363 struct vlan_ethhdr *vhdr; 1365 struct vlan_ethhdr *vhdr;
1364 struct batadv_backbone_gw *backbone_gw; 1366 struct batadv_bla_backbone_gw *backbone_gw;
1365 short vid = -1; 1367 short vid = -1;
1366 1368
1367 if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance)) 1369 if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance))
@@ -1647,7 +1649,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
1647 struct net_device *net_dev = (struct net_device *)seq->private; 1649 struct net_device *net_dev = (struct net_device *)seq->private;
1648 struct batadv_priv *bat_priv = netdev_priv(net_dev); 1650 struct batadv_priv *bat_priv = netdev_priv(net_dev);
1649 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; 1651 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
1650 struct batadv_backbone_gw *backbone_gw; 1652 struct batadv_bla_backbone_gw *backbone_gw;
1651 struct batadv_hard_iface *primary_if; 1653 struct batadv_hard_iface *primary_if;
1652 struct hlist_node *node; 1654 struct hlist_node *node;
1653 struct hlist_head *head; 1655 struct hlist_head *head;