diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-07-15 16:26:51 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-08-23 08:20:13 -0400 |
commit | 807736f6e00714fdeb443b31061d1c27fa903296 (patch) | |
tree | a070c2e9316365424e4d08e2fa50e5a28729670d /net/batman-adv/bridge_loop_avoidance.c | |
parent | 624463079e0af455a2d70d2a59b9e2f6b5827aea (diff) |
batman-adv: Split batadv_priv in sub-structures for features
The structure batadv_priv grows everytime a new feature is introduced. It gets
hard to find the parts of the struct that belongs to a specific feature. This
becomes even harder by the fact that not every feature uses a prefix in the
member name.
The variables for bridge loop avoidence, gateway handling, translation table
and visualization server are moved into separate structs that are included in
the bat_priv main struct.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
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.c | 115 |
1 files changed, 60 insertions, 55 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index c9732acd59ff..ad18017da4e7 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -133,7 +133,7 @@ static void batadv_claim_free_ref(struct batadv_claim *claim) | |||
133 | static struct batadv_claim *batadv_claim_hash_find(struct batadv_priv *bat_priv, | 133 | static struct batadv_claim *batadv_claim_hash_find(struct batadv_priv *bat_priv, |
134 | struct batadv_claim *data) | 134 | struct batadv_claim *data) |
135 | { | 135 | { |
136 | struct batadv_hashtable *hash = bat_priv->claim_hash; | 136 | struct batadv_hashtable *hash = bat_priv->bla.claim_hash; |
137 | struct hlist_head *head; | 137 | struct hlist_head *head; |
138 | struct hlist_node *node; | 138 | struct hlist_node *node; |
139 | struct batadv_claim *claim; | 139 | struct batadv_claim *claim; |
@@ -174,7 +174,7 @@ static struct batadv_backbone_gw * | |||
174 | batadv_backbone_hash_find(struct batadv_priv *bat_priv, | 174 | batadv_backbone_hash_find(struct batadv_priv *bat_priv, |
175 | uint8_t *addr, short vid) | 175 | uint8_t *addr, short vid) |
176 | { | 176 | { |
177 | struct batadv_hashtable *hash = bat_priv->backbone_hash; | 177 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; |
178 | struct hlist_head *head; | 178 | struct hlist_head *head; |
179 | struct hlist_node *node; | 179 | struct hlist_node *node; |
180 | struct batadv_backbone_gw search_entry, *backbone_gw; | 180 | struct batadv_backbone_gw search_entry, *backbone_gw; |
@@ -218,7 +218,7 @@ batadv_bla_del_backbone_claims(struct batadv_backbone_gw *backbone_gw) | |||
218 | int i; | 218 | int i; |
219 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 219 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
220 | 220 | ||
221 | hash = backbone_gw->bat_priv->claim_hash; | 221 | hash = backbone_gw->bat_priv->bla.claim_hash; |
222 | if (!hash) | 222 | if (!hash) |
223 | return; | 223 | return; |
224 | 224 | ||
@@ -265,7 +265,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac, | |||
265 | if (!primary_if) | 265 | if (!primary_if) |
266 | return; | 266 | return; |
267 | 267 | ||
268 | memcpy(&local_claim_dest, &bat_priv->claim_dest, | 268 | memcpy(&local_claim_dest, &bat_priv->bla.claim_dest, |
269 | sizeof(local_claim_dest)); | 269 | sizeof(local_claim_dest)); |
270 | local_claim_dest.type = claimtype; | 270 | local_claim_dest.type = claimtype; |
271 | 271 | ||
@@ -391,7 +391,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig, | |||
391 | /* one for the hash, one for returning */ | 391 | /* one for the hash, one for returning */ |
392 | atomic_set(&entry->refcount, 2); | 392 | atomic_set(&entry->refcount, 2); |
393 | 393 | ||
394 | hash_added = batadv_hash_add(bat_priv->backbone_hash, | 394 | hash_added = batadv_hash_add(bat_priv->bla.backbone_hash, |
395 | batadv_compare_backbone_gw, | 395 | batadv_compare_backbone_gw, |
396 | batadv_choose_backbone_gw, entry, | 396 | batadv_choose_backbone_gw, entry, |
397 | &entry->hash_entry); | 397 | &entry->hash_entry); |
@@ -458,7 +458,7 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv, | |||
458 | if (!backbone_gw) | 458 | if (!backbone_gw) |
459 | return; | 459 | return; |
460 | 460 | ||
461 | hash = bat_priv->claim_hash; | 461 | hash = bat_priv->bla.claim_hash; |
462 | for (i = 0; i < hash->size; i++) { | 462 | for (i = 0; i < hash->size; i++) { |
463 | head = &hash->table[i]; | 463 | head = &hash->table[i]; |
464 | 464 | ||
@@ -499,7 +499,7 @@ static void batadv_bla_send_request(struct batadv_backbone_gw *backbone_gw) | |||
499 | 499 | ||
500 | /* no local broadcasts should be sent or received, for now. */ | 500 | /* no local broadcasts should be sent or received, for now. */ |
501 | if (!atomic_read(&backbone_gw->request_sent)) { | 501 | if (!atomic_read(&backbone_gw->request_sent)) { |
502 | atomic_inc(&backbone_gw->bat_priv->bla_num_requests); | 502 | atomic_inc(&backbone_gw->bat_priv->bla.num_requests); |
503 | atomic_set(&backbone_gw->request_sent, 1); | 503 | atomic_set(&backbone_gw->request_sent, 1); |
504 | } | 504 | } |
505 | } | 505 | } |
@@ -559,7 +559,7 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv, | |||
559 | batadv_dbg(BATADV_DBG_BLA, bat_priv, | 559 | batadv_dbg(BATADV_DBG_BLA, bat_priv, |
560 | "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", | 560 | "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", |
561 | mac, vid); | 561 | mac, vid); |
562 | hash_added = batadv_hash_add(bat_priv->claim_hash, | 562 | hash_added = batadv_hash_add(bat_priv->bla.claim_hash, |
563 | batadv_compare_claim, | 563 | batadv_compare_claim, |
564 | batadv_choose_claim, claim, | 564 | batadv_choose_claim, claim, |
565 | &claim->hash_entry); | 565 | &claim->hash_entry); |
@@ -612,7 +612,7 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, | |||
612 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", | 612 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", |
613 | mac, vid); | 613 | mac, vid); |
614 | 614 | ||
615 | batadv_hash_remove(bat_priv->claim_hash, batadv_compare_claim, | 615 | batadv_hash_remove(bat_priv->bla.claim_hash, batadv_compare_claim, |
616 | batadv_choose_claim, claim); | 616 | batadv_choose_claim, claim); |
617 | batadv_claim_free_ref(claim); /* reference from the hash is gone */ | 617 | batadv_claim_free_ref(claim); /* reference from the hash is gone */ |
618 | 618 | ||
@@ -659,7 +659,7 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv, | |||
659 | * we can allow traffic again. | 659 | * we can allow traffic again. |
660 | */ | 660 | */ |
661 | if (atomic_read(&backbone_gw->request_sent)) { | 661 | if (atomic_read(&backbone_gw->request_sent)) { |
662 | atomic_dec(&backbone_gw->bat_priv->bla_num_requests); | 662 | atomic_dec(&backbone_gw->bat_priv->bla.num_requests); |
663 | atomic_set(&backbone_gw->request_sent, 0); | 663 | atomic_set(&backbone_gw->request_sent, 0); |
664 | } | 664 | } |
665 | } | 665 | } |
@@ -774,7 +774,7 @@ static int batadv_check_claim_group(struct batadv_priv *bat_priv, | |||
774 | struct batadv_bla_claim_dst *bla_dst, *bla_dst_own; | 774 | struct batadv_bla_claim_dst *bla_dst, *bla_dst_own; |
775 | 775 | ||
776 | bla_dst = (struct batadv_bla_claim_dst *)hw_dst; | 776 | bla_dst = (struct batadv_bla_claim_dst *)hw_dst; |
777 | bla_dst_own = &bat_priv->claim_dest; | 777 | bla_dst_own = &bat_priv->bla.claim_dest; |
778 | 778 | ||
779 | /* check if it is a claim packet in general */ | 779 | /* check if it is a claim packet in general */ |
780 | if (memcmp(bla_dst->magic, bla_dst_own->magic, | 780 | if (memcmp(bla_dst->magic, bla_dst_own->magic, |
@@ -947,7 +947,7 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) | |||
947 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 947 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
948 | int i; | 948 | int i; |
949 | 949 | ||
950 | hash = bat_priv->backbone_hash; | 950 | hash = bat_priv->bla.backbone_hash; |
951 | if (!hash) | 951 | if (!hash) |
952 | return; | 952 | return; |
953 | 953 | ||
@@ -971,7 +971,7 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) | |||
971 | purge_now: | 971 | purge_now: |
972 | /* don't wait for the pending request anymore */ | 972 | /* don't wait for the pending request anymore */ |
973 | if (atomic_read(&backbone_gw->request_sent)) | 973 | if (atomic_read(&backbone_gw->request_sent)) |
974 | atomic_dec(&bat_priv->bla_num_requests); | 974 | atomic_dec(&bat_priv->bla.num_requests); |
975 | 975 | ||
976 | batadv_bla_del_backbone_claims(backbone_gw); | 976 | batadv_bla_del_backbone_claims(backbone_gw); |
977 | 977 | ||
@@ -1001,7 +1001,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, | |||
1001 | struct batadv_hashtable *hash; | 1001 | struct batadv_hashtable *hash; |
1002 | int i; | 1002 | int i; |
1003 | 1003 | ||
1004 | hash = bat_priv->claim_hash; | 1004 | hash = bat_priv->bla.claim_hash; |
1005 | if (!hash) | 1005 | if (!hash) |
1006 | return; | 1006 | return; |
1007 | 1007 | ||
@@ -1048,11 +1048,12 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | |||
1048 | struct hlist_node *node; | 1048 | struct hlist_node *node; |
1049 | struct hlist_head *head; | 1049 | struct hlist_head *head; |
1050 | struct batadv_hashtable *hash; | 1050 | struct batadv_hashtable *hash; |
1051 | __be16 group; | ||
1051 | int i; | 1052 | int i; |
1052 | 1053 | ||
1053 | /* reset bridge loop avoidance group id */ | 1054 | /* reset bridge loop avoidance group id */ |
1054 | bat_priv->claim_dest.group = | 1055 | group = htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN)); |
1055 | htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN)); | 1056 | bat_priv->bla.claim_dest.group = group; |
1056 | 1057 | ||
1057 | if (!oldif) { | 1058 | if (!oldif) { |
1058 | batadv_bla_purge_claims(bat_priv, NULL, 1); | 1059 | batadv_bla_purge_claims(bat_priv, NULL, 1); |
@@ -1060,7 +1061,7 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | |||
1060 | return; | 1061 | return; |
1061 | } | 1062 | } |
1062 | 1063 | ||
1063 | hash = bat_priv->backbone_hash; | 1064 | hash = bat_priv->bla.backbone_hash; |
1064 | if (!hash) | 1065 | if (!hash) |
1065 | return; | 1066 | return; |
1066 | 1067 | ||
@@ -1090,8 +1091,8 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | |||
1090 | /* (re)start the timer */ | 1091 | /* (re)start the timer */ |
1091 | static void batadv_bla_start_timer(struct batadv_priv *bat_priv) | 1092 | static void batadv_bla_start_timer(struct batadv_priv *bat_priv) |
1092 | { | 1093 | { |
1093 | INIT_DELAYED_WORK(&bat_priv->bla_work, batadv_bla_periodic_work); | 1094 | INIT_DELAYED_WORK(&bat_priv->bla.work, batadv_bla_periodic_work); |
1094 | queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work, | 1095 | queue_delayed_work(batadv_event_workqueue, &bat_priv->bla.work, |
1095 | msecs_to_jiffies(BATADV_BLA_PERIOD_LENGTH)); | 1096 | msecs_to_jiffies(BATADV_BLA_PERIOD_LENGTH)); |
1096 | } | 1097 | } |
1097 | 1098 | ||
@@ -1104,6 +1105,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) | |||
1104 | struct delayed_work *delayed_work = | 1105 | struct delayed_work *delayed_work = |
1105 | container_of(work, struct delayed_work, work); | 1106 | container_of(work, struct delayed_work, work); |
1106 | struct batadv_priv *bat_priv; | 1107 | struct batadv_priv *bat_priv; |
1108 | struct batadv_priv_bla *priv_bla; | ||
1107 | struct hlist_node *node; | 1109 | struct hlist_node *node; |
1108 | struct hlist_head *head; | 1110 | struct hlist_head *head; |
1109 | struct batadv_backbone_gw *backbone_gw; | 1111 | struct batadv_backbone_gw *backbone_gw; |
@@ -1111,7 +1113,8 @@ static void batadv_bla_periodic_work(struct work_struct *work) | |||
1111 | struct batadv_hard_iface *primary_if; | 1113 | struct batadv_hard_iface *primary_if; |
1112 | int i; | 1114 | int i; |
1113 | 1115 | ||
1114 | bat_priv = container_of(delayed_work, struct batadv_priv, bla_work); | 1116 | priv_bla = container_of(delayed_work, struct batadv_priv_bla, work); |
1117 | bat_priv = container_of(priv_bla, struct batadv_priv, bla); | ||
1115 | primary_if = batadv_primary_if_get_selected(bat_priv); | 1118 | primary_if = batadv_primary_if_get_selected(bat_priv); |
1116 | if (!primary_if) | 1119 | if (!primary_if) |
1117 | goto out; | 1120 | goto out; |
@@ -1122,7 +1125,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) | |||
1122 | if (!atomic_read(&bat_priv->bridge_loop_avoidance)) | 1125 | if (!atomic_read(&bat_priv->bridge_loop_avoidance)) |
1123 | goto out; | 1126 | goto out; |
1124 | 1127 | ||
1125 | hash = bat_priv->backbone_hash; | 1128 | hash = bat_priv->bla.backbone_hash; |
1126 | if (!hash) | 1129 | if (!hash) |
1127 | goto out; | 1130 | goto out; |
1128 | 1131 | ||
@@ -1162,40 +1165,41 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | |||
1162 | int i; | 1165 | int i; |
1163 | uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00}; | 1166 | uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00}; |
1164 | struct batadv_hard_iface *primary_if; | 1167 | struct batadv_hard_iface *primary_if; |
1168 | uint16_t crc; | ||
1169 | unsigned long entrytime; | ||
1165 | 1170 | ||
1166 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n"); | 1171 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n"); |
1167 | 1172 | ||
1168 | /* setting claim destination address */ | 1173 | /* setting claim destination address */ |
1169 | memcpy(&bat_priv->claim_dest.magic, claim_dest, 3); | 1174 | memcpy(&bat_priv->bla.claim_dest.magic, claim_dest, 3); |
1170 | bat_priv->claim_dest.type = 0; | 1175 | bat_priv->bla.claim_dest.type = 0; |
1171 | primary_if = batadv_primary_if_get_selected(bat_priv); | 1176 | primary_if = batadv_primary_if_get_selected(bat_priv); |
1172 | if (primary_if) { | 1177 | if (primary_if) { |
1173 | bat_priv->claim_dest.group = | 1178 | crc = crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN); |
1174 | htons(crc16(0, primary_if->net_dev->dev_addr, | 1179 | bat_priv->bla.claim_dest.group = htons(crc); |
1175 | ETH_ALEN)); | ||
1176 | batadv_hardif_free_ref(primary_if); | 1180 | batadv_hardif_free_ref(primary_if); |
1177 | } else { | 1181 | } else { |
1178 | bat_priv->claim_dest.group = 0; /* will be set later */ | 1182 | bat_priv->bla.claim_dest.group = 0; /* will be set later */ |
1179 | } | 1183 | } |
1180 | 1184 | ||
1181 | /* initialize the duplicate list */ | 1185 | /* initialize the duplicate list */ |
1186 | entrytime = jiffies - msecs_to_jiffies(BATADV_DUPLIST_TIMEOUT); | ||
1182 | for (i = 0; i < BATADV_DUPLIST_SIZE; i++) | 1187 | for (i = 0; i < BATADV_DUPLIST_SIZE; i++) |
1183 | bat_priv->bcast_duplist[i].entrytime = | 1188 | bat_priv->bla.bcast_duplist[i].entrytime = entrytime; |
1184 | jiffies - msecs_to_jiffies(BATADV_DUPLIST_TIMEOUT); | 1189 | bat_priv->bla.bcast_duplist_curr = 0; |
1185 | bat_priv->bcast_duplist_curr = 0; | ||
1186 | 1190 | ||
1187 | if (bat_priv->claim_hash) | 1191 | if (bat_priv->bla.claim_hash) |
1188 | return 0; | 1192 | return 0; |
1189 | 1193 | ||
1190 | bat_priv->claim_hash = batadv_hash_new(128); | 1194 | bat_priv->bla.claim_hash = batadv_hash_new(128); |
1191 | bat_priv->backbone_hash = batadv_hash_new(32); | 1195 | bat_priv->bla.backbone_hash = batadv_hash_new(32); |
1192 | 1196 | ||
1193 | if (!bat_priv->claim_hash || !bat_priv->backbone_hash) | 1197 | if (!bat_priv->bla.claim_hash || !bat_priv->bla.backbone_hash) |
1194 | return -ENOMEM; | 1198 | return -ENOMEM; |
1195 | 1199 | ||
1196 | batadv_hash_set_lock_class(bat_priv->claim_hash, | 1200 | batadv_hash_set_lock_class(bat_priv->bla.claim_hash, |
1197 | &batadv_claim_hash_lock_class_key); | 1201 | &batadv_claim_hash_lock_class_key); |
1198 | batadv_hash_set_lock_class(bat_priv->backbone_hash, | 1202 | batadv_hash_set_lock_class(bat_priv->bla.backbone_hash, |
1199 | &batadv_backbone_hash_lock_class_key); | 1203 | &batadv_backbone_hash_lock_class_key); |
1200 | 1204 | ||
1201 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hashes initialized\n"); | 1205 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hashes initialized\n"); |
@@ -1236,8 +1240,9 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |||
1236 | crc = crc16(0, content, length); | 1240 | crc = crc16(0, content, length); |
1237 | 1241 | ||
1238 | for (i = 0; i < BATADV_DUPLIST_SIZE; i++) { | 1242 | for (i = 0; i < BATADV_DUPLIST_SIZE; i++) { |
1239 | curr = (bat_priv->bcast_duplist_curr + i) % BATADV_DUPLIST_SIZE; | 1243 | curr = (bat_priv->bla.bcast_duplist_curr + i); |
1240 | entry = &bat_priv->bcast_duplist[curr]; | 1244 | curr %= BATADV_DUPLIST_SIZE; |
1245 | entry = &bat_priv->bla.bcast_duplist[curr]; | ||
1241 | 1246 | ||
1242 | /* we can stop searching if the entry is too old ; | 1247 | /* we can stop searching if the entry is too old ; |
1243 | * later entries will be even older | 1248 | * later entries will be even older |
@@ -1258,13 +1263,13 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |||
1258 | return 1; | 1263 | return 1; |
1259 | } | 1264 | } |
1260 | /* not found, add a new entry (overwrite the oldest entry) */ | 1265 | /* not found, add a new entry (overwrite the oldest entry) */ |
1261 | curr = (bat_priv->bcast_duplist_curr + BATADV_DUPLIST_SIZE - 1); | 1266 | curr = (bat_priv->bla.bcast_duplist_curr + BATADV_DUPLIST_SIZE - 1); |
1262 | curr %= BATADV_DUPLIST_SIZE; | 1267 | curr %= BATADV_DUPLIST_SIZE; |
1263 | entry = &bat_priv->bcast_duplist[curr]; | 1268 | entry = &bat_priv->bla.bcast_duplist[curr]; |
1264 | entry->crc = crc; | 1269 | entry->crc = crc; |
1265 | entry->entrytime = jiffies; | 1270 | entry->entrytime = jiffies; |
1266 | memcpy(entry->orig, bcast_packet->orig, ETH_ALEN); | 1271 | memcpy(entry->orig, bcast_packet->orig, ETH_ALEN); |
1267 | bat_priv->bcast_duplist_curr = curr; | 1272 | bat_priv->bla.bcast_duplist_curr = curr; |
1268 | 1273 | ||
1269 | /* allow it, its the first occurence. */ | 1274 | /* allow it, its the first occurence. */ |
1270 | return 0; | 1275 | return 0; |
@@ -1281,7 +1286,7 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |||
1281 | */ | 1286 | */ |
1282 | int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) | 1287 | int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) |
1283 | { | 1288 | { |
1284 | struct batadv_hashtable *hash = bat_priv->backbone_hash; | 1289 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; |
1285 | struct hlist_head *head; | 1290 | struct hlist_head *head; |
1286 | struct hlist_node *node; | 1291 | struct hlist_node *node; |
1287 | struct batadv_backbone_gw *backbone_gw; | 1292 | struct batadv_backbone_gw *backbone_gw; |
@@ -1361,18 +1366,18 @@ void batadv_bla_free(struct batadv_priv *bat_priv) | |||
1361 | { | 1366 | { |
1362 | struct batadv_hard_iface *primary_if; | 1367 | struct batadv_hard_iface *primary_if; |
1363 | 1368 | ||
1364 | cancel_delayed_work_sync(&bat_priv->bla_work); | 1369 | cancel_delayed_work_sync(&bat_priv->bla.work); |
1365 | primary_if = batadv_primary_if_get_selected(bat_priv); | 1370 | primary_if = batadv_primary_if_get_selected(bat_priv); |
1366 | 1371 | ||
1367 | if (bat_priv->claim_hash) { | 1372 | if (bat_priv->bla.claim_hash) { |
1368 | batadv_bla_purge_claims(bat_priv, primary_if, 1); | 1373 | batadv_bla_purge_claims(bat_priv, primary_if, 1); |
1369 | batadv_hash_destroy(bat_priv->claim_hash); | 1374 | batadv_hash_destroy(bat_priv->bla.claim_hash); |
1370 | bat_priv->claim_hash = NULL; | 1375 | bat_priv->bla.claim_hash = NULL; |
1371 | } | 1376 | } |
1372 | if (bat_priv->backbone_hash) { | 1377 | if (bat_priv->bla.backbone_hash) { |
1373 | batadv_bla_purge_backbone_gw(bat_priv, 1); | 1378 | batadv_bla_purge_backbone_gw(bat_priv, 1); |
1374 | batadv_hash_destroy(bat_priv->backbone_hash); | 1379 | batadv_hash_destroy(bat_priv->bla.backbone_hash); |
1375 | bat_priv->backbone_hash = NULL; | 1380 | bat_priv->bla.backbone_hash = NULL; |
1376 | } | 1381 | } |
1377 | if (primary_if) | 1382 | if (primary_if) |
1378 | batadv_hardif_free_ref(primary_if); | 1383 | batadv_hardif_free_ref(primary_if); |
@@ -1411,7 +1416,7 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid, | |||
1411 | goto allow; | 1416 | goto allow; |
1412 | 1417 | ||
1413 | 1418 | ||
1414 | if (unlikely(atomic_read(&bat_priv->bla_num_requests))) | 1419 | if (unlikely(atomic_read(&bat_priv->bla.num_requests))) |
1415 | /* don't allow broadcasts while requests are in flight */ | 1420 | /* don't allow broadcasts while requests are in flight */ |
1416 | if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) | 1421 | if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) |
1417 | goto handled; | 1422 | goto handled; |
@@ -1510,7 +1515,7 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1510 | 1515 | ||
1511 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | 1516 | ethhdr = (struct ethhdr *)skb_mac_header(skb); |
1512 | 1517 | ||
1513 | if (unlikely(atomic_read(&bat_priv->bla_num_requests))) | 1518 | if (unlikely(atomic_read(&bat_priv->bla.num_requests))) |
1514 | /* don't allow broadcasts while requests are in flight */ | 1519 | /* don't allow broadcasts while requests are in flight */ |
1515 | if (is_multicast_ether_addr(ethhdr->h_dest)) | 1520 | if (is_multicast_ether_addr(ethhdr->h_dest)) |
1516 | goto handled; | 1521 | goto handled; |
@@ -1566,7 +1571,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) | |||
1566 | { | 1571 | { |
1567 | struct net_device *net_dev = (struct net_device *)seq->private; | 1572 | struct net_device *net_dev = (struct net_device *)seq->private; |
1568 | struct batadv_priv *bat_priv = netdev_priv(net_dev); | 1573 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
1569 | struct batadv_hashtable *hash = bat_priv->claim_hash; | 1574 | struct batadv_hashtable *hash = bat_priv->bla.claim_hash; |
1570 | struct batadv_claim *claim; | 1575 | struct batadv_claim *claim; |
1571 | struct batadv_hard_iface *primary_if; | 1576 | struct batadv_hard_iface *primary_if; |
1572 | struct hlist_node *node; | 1577 | struct hlist_node *node; |
@@ -1595,7 +1600,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) | |||
1595 | seq_printf(seq, | 1600 | seq_printf(seq, |
1596 | "Claims announced for the mesh %s (orig %pM, group id %04x)\n", | 1601 | "Claims announced for the mesh %s (orig %pM, group id %04x)\n", |
1597 | net_dev->name, primary_addr, | 1602 | net_dev->name, primary_addr, |
1598 | ntohs(bat_priv->claim_dest.group)); | 1603 | ntohs(bat_priv->bla.claim_dest.group)); |
1599 | seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n", | 1604 | seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n", |
1600 | "Client", "VID", "Originator", "CRC"); | 1605 | "Client", "VID", "Originator", "CRC"); |
1601 | for (i = 0; i < hash->size; i++) { | 1606 | for (i = 0; i < hash->size; i++) { |
@@ -1623,7 +1628,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) | |||
1623 | { | 1628 | { |
1624 | struct net_device *net_dev = (struct net_device *)seq->private; | 1629 | struct net_device *net_dev = (struct net_device *)seq->private; |
1625 | struct batadv_priv *bat_priv = netdev_priv(net_dev); | 1630 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
1626 | struct batadv_hashtable *hash = bat_priv->backbone_hash; | 1631 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; |
1627 | struct batadv_backbone_gw *backbone_gw; | 1632 | struct batadv_backbone_gw *backbone_gw; |
1628 | struct batadv_hard_iface *primary_if; | 1633 | struct batadv_hard_iface *primary_if; |
1629 | struct hlist_node *node; | 1634 | struct hlist_node *node; |
@@ -1653,7 +1658,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) | |||
1653 | seq_printf(seq, | 1658 | seq_printf(seq, |
1654 | "Backbones announced for the mesh %s (orig %pM, group id %04x)\n", | 1659 | "Backbones announced for the mesh %s (orig %pM, group id %04x)\n", |
1655 | net_dev->name, primary_addr, | 1660 | net_dev->name, primary_addr, |
1656 | ntohs(bat_priv->claim_dest.group)); | 1661 | ntohs(bat_priv->bla.claim_dest.group)); |
1657 | seq_printf(seq, " %-17s %-5s %-9s (%-4s)\n", | 1662 | seq_printf(seq, " %-17s %-5s %-9s (%-4s)\n", |
1658 | "Originator", "VID", "last seen", "CRC"); | 1663 | "Originator", "VID", "last seen", "CRC"); |
1659 | for (i = 0; i < hash->size; i++) { | 1664 | for (i = 0; i < hash->size; i++) { |