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:25 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-01-19 08:18:11 -0500
commit712bbfe46b3004603762adb506baff99be0f8d8c (patch)
treeaaf6e2e32d96f9135a4509360451aaf57243d5a1 /net/batman-adv/bridge_loop_avoidance.c
parentbae987747150d8939bf385863f49e2647db15e2a (diff)
batman-adv: rename batadv_claim 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.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 5f9a206ca8a0..9971892bcbf8 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -41,7 +41,7 @@ batadv_bla_send_announce(struct batadv_priv *bat_priv,
41/* return the index of the claim */ 41/* return the index of the claim */
42static 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)
43{ 43{
44 struct batadv_claim *claim = (struct batadv_claim *)data; 44 struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
45 uint32_t hash = 0; 45 uint32_t hash = 0;
46 46
47 hash = batadv_hash_bytes(hash, &claim->addr, sizeof(claim->addr)); 47 hash = batadv_hash_bytes(hash, &claim->addr, sizeof(claim->addr));
@@ -58,7 +58,7 @@ static inline uint32_t batadv_choose_claim(const void *data, uint32_t size)
58static inline uint32_t batadv_choose_backbone_gw(const void *data, 58static inline uint32_t batadv_choose_backbone_gw(const void *data,
59 uint32_t size) 59 uint32_t size)
60{ 60{
61 const struct batadv_claim *claim = (struct batadv_claim *)data; 61 const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
62 uint32_t hash = 0; 62 uint32_t hash = 0;
63 63
64 hash = batadv_hash_bytes(hash, &claim->addr, sizeof(claim->addr)); 64 hash = batadv_hash_bytes(hash, &claim->addr, sizeof(claim->addr));
@@ -93,9 +93,9 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node,
93static int batadv_compare_claim(const struct hlist_node *node, 93static int batadv_compare_claim(const struct hlist_node *node,
94 const void *data2) 94 const void *data2)
95{ 95{
96 const void *data1 = container_of(node, struct batadv_claim, 96 const void *data1 = container_of(node, struct batadv_bla_claim,
97 hash_entry); 97 hash_entry);
98 const struct batadv_claim *cl1 = data1, *cl2 = data2; 98 const struct batadv_bla_claim *cl1 = data1, *cl2 = data2;
99 99
100 if (!batadv_compare_eth(cl1->addr, cl2->addr)) 100 if (!batadv_compare_eth(cl1->addr, cl2->addr))
101 return 0; 101 return 0;
@@ -117,16 +117,16 @@ batadv_backbone_gw_free_ref(struct batadv_bla_backbone_gw *backbone_gw)
117/* finally deinitialize the claim */ 117/* finally deinitialize the claim */
118static void batadv_claim_free_rcu(struct rcu_head *rcu) 118static void batadv_claim_free_rcu(struct rcu_head *rcu)
119{ 119{
120 struct batadv_claim *claim; 120 struct batadv_bla_claim *claim;
121 121
122 claim = container_of(rcu, struct batadv_claim, rcu); 122 claim = container_of(rcu, struct batadv_bla_claim, rcu);
123 123
124 batadv_backbone_gw_free_ref(claim->backbone_gw); 124 batadv_backbone_gw_free_ref(claim->backbone_gw);
125 kfree(claim); 125 kfree(claim);
126} 126}
127 127
128/* free a claim, call claim_free_rcu if its the last reference */ 128/* free a claim, call claim_free_rcu if its the last reference */
129static void batadv_claim_free_ref(struct batadv_claim *claim) 129static void batadv_claim_free_ref(struct batadv_bla_claim *claim)
130{ 130{
131 if (atomic_dec_and_test(&claim->refcount)) 131 if (atomic_dec_and_test(&claim->refcount))
132 call_rcu(&claim->rcu, batadv_claim_free_rcu); 132 call_rcu(&claim->rcu, batadv_claim_free_rcu);
@@ -138,14 +138,15 @@ static void batadv_claim_free_ref(struct batadv_claim *claim)
138 * looks for a claim in the hash, and returns it if found 138 * looks for a claim in the hash, and returns it if found
139 * or NULL otherwise. 139 * or NULL otherwise.
140 */ 140 */
141static struct batadv_claim *batadv_claim_hash_find(struct batadv_priv *bat_priv, 141static struct batadv_bla_claim
142 struct batadv_claim *data) 142*batadv_claim_hash_find(struct batadv_priv *bat_priv,
143 struct batadv_bla_claim *data)
143{ 144{
144 struct batadv_hashtable *hash = bat_priv->bla.claim_hash; 145 struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
145 struct hlist_head *head; 146 struct hlist_head *head;
146 struct hlist_node *node; 147 struct hlist_node *node;
147 struct batadv_claim *claim; 148 struct batadv_bla_claim *claim;
148 struct batadv_claim *claim_tmp = NULL; 149 struct batadv_bla_claim *claim_tmp = NULL;
149 int index; 150 int index;
150 151
151 if (!hash) 152 if (!hash)
@@ -222,7 +223,7 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
222 struct batadv_hashtable *hash; 223 struct batadv_hashtable *hash;
223 struct hlist_node *node, *node_tmp; 224 struct hlist_node *node, *node_tmp;
224 struct hlist_head *head; 225 struct hlist_head *head;
225 struct batadv_claim *claim; 226 struct batadv_bla_claim *claim;
226 int i; 227 int i;
227 spinlock_t *list_lock; /* protects write access to the hash lists */ 228 spinlock_t *list_lock; /* protects write access to the hash lists */
228 229
@@ -462,7 +463,7 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv,
462 struct hlist_node *node; 463 struct hlist_node *node;
463 struct hlist_head *head; 464 struct hlist_head *head;
464 struct batadv_hashtable *hash; 465 struct batadv_hashtable *hash;
465 struct batadv_claim *claim; 466 struct batadv_bla_claim *claim;
466 struct batadv_bla_backbone_gw *backbone_gw; 467 struct batadv_bla_backbone_gw *backbone_gw;
467 int i; 468 int i;
468 469
@@ -552,8 +553,8 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
552 const uint8_t *mac, const short vid, 553 const uint8_t *mac, const short vid,
553 struct batadv_bla_backbone_gw *backbone_gw) 554 struct batadv_bla_backbone_gw *backbone_gw)
554{ 555{
555 struct batadv_claim *claim; 556 struct batadv_bla_claim *claim;
556 struct batadv_claim search_claim; 557 struct batadv_bla_claim search_claim;
557 int hash_added; 558 int hash_added;
558 559
559 memcpy(search_claim.addr, mac, ETH_ALEN); 560 memcpy(search_claim.addr, mac, ETH_ALEN);
@@ -615,7 +616,7 @@ claim_free_ref:
615static void batadv_bla_del_claim(struct batadv_priv *bat_priv, 616static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
616 const uint8_t *mac, const short vid) 617 const uint8_t *mac, const short vid)
617{ 618{
618 struct batadv_claim search_claim, *claim; 619 struct batadv_bla_claim search_claim, *claim;
619 620
620 memcpy(search_claim.addr, mac, ETH_ALEN); 621 memcpy(search_claim.addr, mac, ETH_ALEN);
621 search_claim.vid = vid; 622 search_claim.vid = vid;
@@ -1011,7 +1012,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
1011 struct batadv_hard_iface *primary_if, 1012 struct batadv_hard_iface *primary_if,
1012 int now) 1013 int now)
1013{ 1014{
1014 struct batadv_claim *claim; 1015 struct batadv_bla_claim *claim;
1015 struct hlist_node *node; 1016 struct hlist_node *node;
1016 struct hlist_head *head; 1017 struct hlist_head *head;
1017 struct batadv_hashtable *hash; 1018 struct batadv_hashtable *hash;
@@ -1434,7 +1435,7 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid,
1434 bool is_bcast) 1435 bool is_bcast)
1435{ 1436{
1436 struct ethhdr *ethhdr; 1437 struct ethhdr *ethhdr;
1437 struct batadv_claim search_claim, *claim = NULL; 1438 struct batadv_bla_claim search_claim, *claim = NULL;
1438 struct batadv_hard_iface *primary_if; 1439 struct batadv_hard_iface *primary_if;
1439 int ret; 1440 int ret;
1440 1441
@@ -1528,7 +1529,7 @@ out:
1528int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid) 1529int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid)
1529{ 1530{
1530 struct ethhdr *ethhdr; 1531 struct ethhdr *ethhdr;
1531 struct batadv_claim search_claim, *claim = NULL; 1532 struct batadv_bla_claim search_claim, *claim = NULL;
1532 struct batadv_hard_iface *primary_if; 1533 struct batadv_hard_iface *primary_if;
1533 int ret = 0; 1534 int ret = 0;
1534 1535
@@ -1604,7 +1605,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1604 struct net_device *net_dev = (struct net_device *)seq->private; 1605 struct net_device *net_dev = (struct net_device *)seq->private;
1605 struct batadv_priv *bat_priv = netdev_priv(net_dev); 1606 struct batadv_priv *bat_priv = netdev_priv(net_dev);
1606 struct batadv_hashtable *hash = bat_priv->bla.claim_hash; 1607 struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
1607 struct batadv_claim *claim; 1608 struct batadv_bla_claim *claim;
1608 struct batadv_hard_iface *primary_if; 1609 struct batadv_hard_iface *primary_if;
1609 struct hlist_node *node; 1610 struct hlist_node *node;
1610 struct hlist_head *head; 1611 struct hlist_head *head;