diff options
Diffstat (limited to 'net/batman-adv/bridge_loop_avoidance.c')
| -rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 30f46526cbbd..6a4f728680ae 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
| @@ -144,7 +144,6 @@ static struct batadv_bla_claim | |||
| 144 | { | 144 | { |
| 145 | struct batadv_hashtable *hash = bat_priv->bla.claim_hash; | 145 | struct batadv_hashtable *hash = bat_priv->bla.claim_hash; |
| 146 | struct hlist_head *head; | 146 | struct hlist_head *head; |
| 147 | struct hlist_node *node; | ||
| 148 | struct batadv_bla_claim *claim; | 147 | struct batadv_bla_claim *claim; |
| 149 | struct batadv_bla_claim *claim_tmp = NULL; | 148 | struct batadv_bla_claim *claim_tmp = NULL; |
| 150 | int index; | 149 | int index; |
| @@ -156,7 +155,7 @@ static struct batadv_bla_claim | |||
| 156 | head = &hash->table[index]; | 155 | head = &hash->table[index]; |
| 157 | 156 | ||
| 158 | rcu_read_lock(); | 157 | rcu_read_lock(); |
| 159 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { | 158 | hlist_for_each_entry_rcu(claim, head, hash_entry) { |
| 160 | if (!batadv_compare_claim(&claim->hash_entry, data)) | 159 | if (!batadv_compare_claim(&claim->hash_entry, data)) |
| 161 | continue; | 160 | continue; |
| 162 | 161 | ||
| @@ -185,7 +184,6 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv, | |||
| 185 | { | 184 | { |
| 186 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; | 185 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; |
| 187 | struct hlist_head *head; | 186 | struct hlist_head *head; |
| 188 | struct hlist_node *node; | ||
| 189 | struct batadv_bla_backbone_gw search_entry, *backbone_gw; | 187 | struct batadv_bla_backbone_gw search_entry, *backbone_gw; |
| 190 | struct batadv_bla_backbone_gw *backbone_gw_tmp = NULL; | 188 | struct batadv_bla_backbone_gw *backbone_gw_tmp = NULL; |
| 191 | int index; | 189 | int index; |
| @@ -200,7 +198,7 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv, | |||
| 200 | head = &hash->table[index]; | 198 | head = &hash->table[index]; |
| 201 | 199 | ||
| 202 | rcu_read_lock(); | 200 | rcu_read_lock(); |
| 203 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 201 | hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { |
| 204 | if (!batadv_compare_backbone_gw(&backbone_gw->hash_entry, | 202 | if (!batadv_compare_backbone_gw(&backbone_gw->hash_entry, |
| 205 | &search_entry)) | 203 | &search_entry)) |
| 206 | continue; | 204 | continue; |
| @@ -221,7 +219,7 @@ static void | |||
| 221 | batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw) | 219 | batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw) |
| 222 | { | 220 | { |
| 223 | struct batadv_hashtable *hash; | 221 | struct batadv_hashtable *hash; |
| 224 | struct hlist_node *node, *node_tmp; | 222 | struct hlist_node *node_tmp; |
| 225 | struct hlist_head *head; | 223 | struct hlist_head *head; |
| 226 | struct batadv_bla_claim *claim; | 224 | struct batadv_bla_claim *claim; |
| 227 | int i; | 225 | int i; |
| @@ -236,13 +234,13 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw) | |||
| 236 | list_lock = &hash->list_locks[i]; | 234 | list_lock = &hash->list_locks[i]; |
| 237 | 235 | ||
| 238 | spin_lock_bh(list_lock); | 236 | spin_lock_bh(list_lock); |
| 239 | hlist_for_each_entry_safe(claim, node, node_tmp, | 237 | hlist_for_each_entry_safe(claim, node_tmp, |
| 240 | head, hash_entry) { | 238 | head, hash_entry) { |
| 241 | if (claim->backbone_gw != backbone_gw) | 239 | if (claim->backbone_gw != backbone_gw) |
| 242 | continue; | 240 | continue; |
| 243 | 241 | ||
| 244 | batadv_claim_free_ref(claim); | 242 | batadv_claim_free_ref(claim); |
| 245 | hlist_del_rcu(node); | 243 | hlist_del_rcu(&claim->hash_entry); |
| 246 | } | 244 | } |
| 247 | spin_unlock_bh(list_lock); | 245 | spin_unlock_bh(list_lock); |
| 248 | } | 246 | } |
| @@ -460,7 +458,6 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv, | |||
| 460 | struct batadv_hard_iface *primary_if, | 458 | struct batadv_hard_iface *primary_if, |
| 461 | short vid) | 459 | short vid) |
| 462 | { | 460 | { |
| 463 | struct hlist_node *node; | ||
| 464 | struct hlist_head *head; | 461 | struct hlist_head *head; |
| 465 | struct batadv_hashtable *hash; | 462 | struct batadv_hashtable *hash; |
| 466 | struct batadv_bla_claim *claim; | 463 | struct batadv_bla_claim *claim; |
| @@ -481,7 +478,7 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv, | |||
| 481 | head = &hash->table[i]; | 478 | head = &hash->table[i]; |
| 482 | 479 | ||
| 483 | rcu_read_lock(); | 480 | rcu_read_lock(); |
| 484 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { | 481 | hlist_for_each_entry_rcu(claim, head, hash_entry) { |
| 485 | /* only own claims are interesting */ | 482 | /* only own claims are interesting */ |
| 486 | if (claim->backbone_gw != backbone_gw) | 483 | if (claim->backbone_gw != backbone_gw) |
| 487 | continue; | 484 | continue; |
| @@ -958,7 +955,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | |||
| 958 | static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) | 955 | static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) |
| 959 | { | 956 | { |
| 960 | struct batadv_bla_backbone_gw *backbone_gw; | 957 | struct batadv_bla_backbone_gw *backbone_gw; |
| 961 | struct hlist_node *node, *node_tmp; | 958 | struct hlist_node *node_tmp; |
| 962 | struct hlist_head *head; | 959 | struct hlist_head *head; |
| 963 | struct batadv_hashtable *hash; | 960 | struct batadv_hashtable *hash; |
| 964 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 961 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
| @@ -973,7 +970,7 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) | |||
| 973 | list_lock = &hash->list_locks[i]; | 970 | list_lock = &hash->list_locks[i]; |
| 974 | 971 | ||
| 975 | spin_lock_bh(list_lock); | 972 | spin_lock_bh(list_lock); |
| 976 | hlist_for_each_entry_safe(backbone_gw, node, node_tmp, | 973 | hlist_for_each_entry_safe(backbone_gw, node_tmp, |
| 977 | head, hash_entry) { | 974 | head, hash_entry) { |
| 978 | if (now) | 975 | if (now) |
| 979 | goto purge_now; | 976 | goto purge_now; |
| @@ -992,7 +989,7 @@ purge_now: | |||
| 992 | 989 | ||
| 993 | batadv_bla_del_backbone_claims(backbone_gw); | 990 | batadv_bla_del_backbone_claims(backbone_gw); |
| 994 | 991 | ||
| 995 | hlist_del_rcu(node); | 992 | hlist_del_rcu(&backbone_gw->hash_entry); |
| 996 | batadv_backbone_gw_free_ref(backbone_gw); | 993 | batadv_backbone_gw_free_ref(backbone_gw); |
| 997 | } | 994 | } |
| 998 | spin_unlock_bh(list_lock); | 995 | spin_unlock_bh(list_lock); |
| @@ -1013,7 +1010,6 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, | |||
| 1013 | int now) | 1010 | int now) |
| 1014 | { | 1011 | { |
| 1015 | struct batadv_bla_claim *claim; | 1012 | struct batadv_bla_claim *claim; |
| 1016 | struct hlist_node *node; | ||
| 1017 | struct hlist_head *head; | 1013 | struct hlist_head *head; |
| 1018 | struct batadv_hashtable *hash; | 1014 | struct batadv_hashtable *hash; |
| 1019 | int i; | 1015 | int i; |
| @@ -1026,7 +1022,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, | |||
| 1026 | head = &hash->table[i]; | 1022 | head = &hash->table[i]; |
| 1027 | 1023 | ||
| 1028 | rcu_read_lock(); | 1024 | rcu_read_lock(); |
| 1029 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { | 1025 | hlist_for_each_entry_rcu(claim, head, hash_entry) { |
| 1030 | if (now) | 1026 | if (now) |
| 1031 | goto purge_now; | 1027 | goto purge_now; |
| 1032 | if (!batadv_compare_eth(claim->backbone_gw->orig, | 1028 | if (!batadv_compare_eth(claim->backbone_gw->orig, |
| @@ -1062,7 +1058,6 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | |||
| 1062 | struct batadv_hard_iface *oldif) | 1058 | struct batadv_hard_iface *oldif) |
| 1063 | { | 1059 | { |
| 1064 | struct batadv_bla_backbone_gw *backbone_gw; | 1060 | struct batadv_bla_backbone_gw *backbone_gw; |
| 1065 | struct hlist_node *node; | ||
| 1066 | struct hlist_head *head; | 1061 | struct hlist_head *head; |
| 1067 | struct batadv_hashtable *hash; | 1062 | struct batadv_hashtable *hash; |
| 1068 | __be16 group; | 1063 | __be16 group; |
| @@ -1086,7 +1081,7 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | |||
| 1086 | head = &hash->table[i]; | 1081 | head = &hash->table[i]; |
| 1087 | 1082 | ||
| 1088 | rcu_read_lock(); | 1083 | rcu_read_lock(); |
| 1089 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 1084 | hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { |
| 1090 | /* own orig still holds the old value. */ | 1085 | /* own orig still holds the old value. */ |
| 1091 | if (!batadv_compare_eth(backbone_gw->orig, | 1086 | if (!batadv_compare_eth(backbone_gw->orig, |
| 1092 | oldif->net_dev->dev_addr)) | 1087 | oldif->net_dev->dev_addr)) |
| @@ -1112,7 +1107,6 @@ static void batadv_bla_periodic_work(struct work_struct *work) | |||
| 1112 | struct delayed_work *delayed_work; | 1107 | struct delayed_work *delayed_work; |
| 1113 | struct batadv_priv *bat_priv; | 1108 | struct batadv_priv *bat_priv; |
| 1114 | struct batadv_priv_bla *priv_bla; | 1109 | struct batadv_priv_bla *priv_bla; |
| 1115 | struct hlist_node *node; | ||
| 1116 | struct hlist_head *head; | 1110 | struct hlist_head *head; |
| 1117 | struct batadv_bla_backbone_gw *backbone_gw; | 1111 | struct batadv_bla_backbone_gw *backbone_gw; |
| 1118 | struct batadv_hashtable *hash; | 1112 | struct batadv_hashtable *hash; |
| @@ -1140,7 +1134,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) | |||
| 1140 | head = &hash->table[i]; | 1134 | head = &hash->table[i]; |
| 1141 | 1135 | ||
| 1142 | rcu_read_lock(); | 1136 | rcu_read_lock(); |
| 1143 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 1137 | hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { |
| 1144 | if (!batadv_compare_eth(backbone_gw->orig, | 1138 | if (!batadv_compare_eth(backbone_gw->orig, |
| 1145 | primary_if->net_dev->dev_addr)) | 1139 | primary_if->net_dev->dev_addr)) |
| 1146 | continue; | 1140 | continue; |
| @@ -1322,7 +1316,6 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) | |||
| 1322 | { | 1316 | { |
| 1323 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; | 1317 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; |
| 1324 | struct hlist_head *head; | 1318 | struct hlist_head *head; |
| 1325 | struct hlist_node *node; | ||
| 1326 | struct batadv_bla_backbone_gw *backbone_gw; | 1319 | struct batadv_bla_backbone_gw *backbone_gw; |
| 1327 | int i; | 1320 | int i; |
| 1328 | 1321 | ||
| @@ -1336,7 +1329,7 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) | |||
| 1336 | head = &hash->table[i]; | 1329 | head = &hash->table[i]; |
| 1337 | 1330 | ||
| 1338 | rcu_read_lock(); | 1331 | rcu_read_lock(); |
| 1339 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 1332 | hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { |
| 1340 | if (batadv_compare_eth(backbone_gw->orig, orig)) { | 1333 | if (batadv_compare_eth(backbone_gw->orig, orig)) { |
| 1341 | rcu_read_unlock(); | 1334 | rcu_read_unlock(); |
| 1342 | return 1; | 1335 | return 1; |
| @@ -1607,7 +1600,6 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) | |||
| 1607 | struct batadv_hashtable *hash = bat_priv->bla.claim_hash; | 1600 | struct batadv_hashtable *hash = bat_priv->bla.claim_hash; |
| 1608 | struct batadv_bla_claim *claim; | 1601 | struct batadv_bla_claim *claim; |
| 1609 | struct batadv_hard_iface *primary_if; | 1602 | struct batadv_hard_iface *primary_if; |
| 1610 | struct hlist_node *node; | ||
| 1611 | struct hlist_head *head; | 1603 | struct hlist_head *head; |
| 1612 | uint32_t i; | 1604 | uint32_t i; |
| 1613 | bool is_own; | 1605 | bool is_own; |
| @@ -1628,7 +1620,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) | |||
| 1628 | head = &hash->table[i]; | 1620 | head = &hash->table[i]; |
| 1629 | 1621 | ||
| 1630 | rcu_read_lock(); | 1622 | rcu_read_lock(); |
| 1631 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { | 1623 | hlist_for_each_entry_rcu(claim, head, hash_entry) { |
| 1632 | is_own = batadv_compare_eth(claim->backbone_gw->orig, | 1624 | is_own = batadv_compare_eth(claim->backbone_gw->orig, |
| 1633 | primary_addr); | 1625 | primary_addr); |
| 1634 | seq_printf(seq, " * %pM on % 5d by %pM [%c] (%#.4x)\n", | 1626 | seq_printf(seq, " * %pM on % 5d by %pM [%c] (%#.4x)\n", |
| @@ -1652,7 +1644,6 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) | |||
| 1652 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; | 1644 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; |
| 1653 | struct batadv_bla_backbone_gw *backbone_gw; | 1645 | struct batadv_bla_backbone_gw *backbone_gw; |
| 1654 | struct batadv_hard_iface *primary_if; | 1646 | struct batadv_hard_iface *primary_if; |
| 1655 | struct hlist_node *node; | ||
| 1656 | struct hlist_head *head; | 1647 | struct hlist_head *head; |
| 1657 | int secs, msecs; | 1648 | int secs, msecs; |
| 1658 | uint32_t i; | 1649 | uint32_t i; |
| @@ -1674,7 +1665,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) | |||
| 1674 | head = &hash->table[i]; | 1665 | head = &hash->table[i]; |
| 1675 | 1666 | ||
| 1676 | rcu_read_lock(); | 1667 | rcu_read_lock(); |
| 1677 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 1668 | hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { |
| 1678 | msecs = jiffies_to_msecs(jiffies - | 1669 | msecs = jiffies_to_msecs(jiffies - |
| 1679 | backbone_gw->lasttime); | 1670 | backbone_gw->lasttime); |
| 1680 | secs = msecs / 1000; | 1671 | secs = msecs / 1000; |
