diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-10-15 11:20:54 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-10-15 11:20:54 -0400 |
commit | df9b42963f2d010ae3163a894ce22cf6b27cd344 (patch) | |
tree | f42f826d9bb975766c1a79986c39e64c9a900908 /net/batman-adv/vis.c | |
parent | 33766368f6532313571534f9112b1796d6651bbe (diff) | |
parent | c3e7724b6bc2f25e46c38dbe68f09d71fafeafb8 (diff) |
Merge remote-tracking branch 'wireless/master' into mac80211
Diffstat (limited to 'net/batman-adv/vis.c')
-rw-r--r-- | net/batman-adv/vis.c | 144 |
1 files changed, 73 insertions, 71 deletions
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 2a2ea0681469..5abd1454fb07 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -41,13 +41,13 @@ static void batadv_free_info(struct kref *ref) | |||
41 | bat_priv = info->bat_priv; | 41 | bat_priv = info->bat_priv; |
42 | 42 | ||
43 | list_del_init(&info->send_list); | 43 | list_del_init(&info->send_list); |
44 | spin_lock_bh(&bat_priv->vis_list_lock); | 44 | spin_lock_bh(&bat_priv->vis.list_lock); |
45 | list_for_each_entry_safe(entry, tmp, &info->recv_list, list) { | 45 | list_for_each_entry_safe(entry, tmp, &info->recv_list, list) { |
46 | list_del(&entry->list); | 46 | list_del(&entry->list); |
47 | kfree(entry); | 47 | kfree(entry); |
48 | } | 48 | } |
49 | 49 | ||
50 | spin_unlock_bh(&bat_priv->vis_list_lock); | 50 | spin_unlock_bh(&bat_priv->vis.list_lock); |
51 | kfree_skb(info->skb_packet); | 51 | kfree_skb(info->skb_packet); |
52 | kfree(info); | 52 | kfree(info); |
53 | } | 53 | } |
@@ -94,7 +94,7 @@ static uint32_t batadv_vis_info_choose(const void *data, uint32_t size) | |||
94 | static struct batadv_vis_info * | 94 | static struct batadv_vis_info * |
95 | batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data) | 95 | batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data) |
96 | { | 96 | { |
97 | struct batadv_hashtable *hash = bat_priv->vis_hash; | 97 | struct batadv_hashtable *hash = bat_priv->vis.hash; |
98 | struct hlist_head *head; | 98 | struct hlist_head *head; |
99 | struct hlist_node *node; | 99 | struct hlist_node *node; |
100 | struct batadv_vis_info *vis_info, *vis_info_tmp = NULL; | 100 | struct batadv_vis_info *vis_info, *vis_info_tmp = NULL; |
@@ -252,7 +252,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | |||
252 | struct hlist_head *head; | 252 | struct hlist_head *head; |
253 | struct net_device *net_dev = (struct net_device *)seq->private; | 253 | struct net_device *net_dev = (struct net_device *)seq->private; |
254 | struct batadv_priv *bat_priv = netdev_priv(net_dev); | 254 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
255 | struct batadv_hashtable *hash = bat_priv->vis_hash; | 255 | struct batadv_hashtable *hash = bat_priv->vis.hash; |
256 | uint32_t i; | 256 | uint32_t i; |
257 | int ret = 0; | 257 | int ret = 0; |
258 | int vis_server = atomic_read(&bat_priv->vis_mode); | 258 | int vis_server = atomic_read(&bat_priv->vis_mode); |
@@ -264,12 +264,12 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | |||
264 | if (vis_server == BATADV_VIS_TYPE_CLIENT_UPDATE) | 264 | if (vis_server == BATADV_VIS_TYPE_CLIENT_UPDATE) |
265 | goto out; | 265 | goto out; |
266 | 266 | ||
267 | spin_lock_bh(&bat_priv->vis_hash_lock); | 267 | spin_lock_bh(&bat_priv->vis.hash_lock); |
268 | for (i = 0; i < hash->size; i++) { | 268 | for (i = 0; i < hash->size; i++) { |
269 | head = &hash->table[i]; | 269 | head = &hash->table[i]; |
270 | batadv_vis_seq_print_text_bucket(seq, head); | 270 | batadv_vis_seq_print_text_bucket(seq, head); |
271 | } | 271 | } |
272 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 272 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
273 | 273 | ||
274 | out: | 274 | out: |
275 | if (primary_if) | 275 | if (primary_if) |
@@ -285,7 +285,7 @@ static void batadv_send_list_add(struct batadv_priv *bat_priv, | |||
285 | { | 285 | { |
286 | if (list_empty(&info->send_list)) { | 286 | if (list_empty(&info->send_list)) { |
287 | kref_get(&info->refcount); | 287 | kref_get(&info->refcount); |
288 | list_add_tail(&info->send_list, &bat_priv->vis_send_list); | 288 | list_add_tail(&info->send_list, &bat_priv->vis.send_list); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
@@ -311,9 +311,9 @@ static void batadv_recv_list_add(struct batadv_priv *bat_priv, | |||
311 | return; | 311 | return; |
312 | 312 | ||
313 | memcpy(entry->mac, mac, ETH_ALEN); | 313 | memcpy(entry->mac, mac, ETH_ALEN); |
314 | spin_lock_bh(&bat_priv->vis_list_lock); | 314 | spin_lock_bh(&bat_priv->vis.list_lock); |
315 | list_add_tail(&entry->list, recv_list); | 315 | list_add_tail(&entry->list, recv_list); |
316 | spin_unlock_bh(&bat_priv->vis_list_lock); | 316 | spin_unlock_bh(&bat_priv->vis.list_lock); |
317 | } | 317 | } |
318 | 318 | ||
319 | /* returns 1 if this mac is in the recv_list */ | 319 | /* returns 1 if this mac is in the recv_list */ |
@@ -323,14 +323,14 @@ static int batadv_recv_list_is_in(struct batadv_priv *bat_priv, | |||
323 | { | 323 | { |
324 | const struct batadv_recvlist_node *entry; | 324 | const struct batadv_recvlist_node *entry; |
325 | 325 | ||
326 | spin_lock_bh(&bat_priv->vis_list_lock); | 326 | spin_lock_bh(&bat_priv->vis.list_lock); |
327 | list_for_each_entry(entry, recv_list, list) { | 327 | list_for_each_entry(entry, recv_list, list) { |
328 | if (batadv_compare_eth(entry->mac, mac)) { | 328 | if (batadv_compare_eth(entry->mac, mac)) { |
329 | spin_unlock_bh(&bat_priv->vis_list_lock); | 329 | spin_unlock_bh(&bat_priv->vis.list_lock); |
330 | return 1; | 330 | return 1; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | spin_unlock_bh(&bat_priv->vis_list_lock); | 333 | spin_unlock_bh(&bat_priv->vis.list_lock); |
334 | return 0; | 334 | return 0; |
335 | } | 335 | } |
336 | 336 | ||
@@ -354,7 +354,7 @@ batadv_add_packet(struct batadv_priv *bat_priv, | |||
354 | 354 | ||
355 | *is_new = 0; | 355 | *is_new = 0; |
356 | /* sanity check */ | 356 | /* sanity check */ |
357 | if (!bat_priv->vis_hash) | 357 | if (!bat_priv->vis.hash) |
358 | return NULL; | 358 | return NULL; |
359 | 359 | ||
360 | /* see if the packet is already in vis_hash */ | 360 | /* see if the packet is already in vis_hash */ |
@@ -385,7 +385,7 @@ batadv_add_packet(struct batadv_priv *bat_priv, | |||
385 | } | 385 | } |
386 | } | 386 | } |
387 | /* remove old entry */ | 387 | /* remove old entry */ |
388 | batadv_hash_remove(bat_priv->vis_hash, batadv_vis_info_cmp, | 388 | batadv_hash_remove(bat_priv->vis.hash, batadv_vis_info_cmp, |
389 | batadv_vis_info_choose, old_info); | 389 | batadv_vis_info_choose, old_info); |
390 | batadv_send_list_del(old_info); | 390 | batadv_send_list_del(old_info); |
391 | kref_put(&old_info->refcount, batadv_free_info); | 391 | kref_put(&old_info->refcount, batadv_free_info); |
@@ -426,7 +426,7 @@ batadv_add_packet(struct batadv_priv *bat_priv, | |||
426 | batadv_recv_list_add(bat_priv, &info->recv_list, packet->sender_orig); | 426 | batadv_recv_list_add(bat_priv, &info->recv_list, packet->sender_orig); |
427 | 427 | ||
428 | /* try to add it */ | 428 | /* try to add it */ |
429 | hash_added = batadv_hash_add(bat_priv->vis_hash, batadv_vis_info_cmp, | 429 | hash_added = batadv_hash_add(bat_priv->vis.hash, batadv_vis_info_cmp, |
430 | batadv_vis_info_choose, info, | 430 | batadv_vis_info_choose, info, |
431 | &info->hash_entry); | 431 | &info->hash_entry); |
432 | if (hash_added != 0) { | 432 | if (hash_added != 0) { |
@@ -449,7 +449,7 @@ void batadv_receive_server_sync_packet(struct batadv_priv *bat_priv, | |||
449 | 449 | ||
450 | make_broadcast = (vis_server == BATADV_VIS_TYPE_SERVER_SYNC); | 450 | make_broadcast = (vis_server == BATADV_VIS_TYPE_SERVER_SYNC); |
451 | 451 | ||
452 | spin_lock_bh(&bat_priv->vis_hash_lock); | 452 | spin_lock_bh(&bat_priv->vis.hash_lock); |
453 | info = batadv_add_packet(bat_priv, vis_packet, vis_info_len, | 453 | info = batadv_add_packet(bat_priv, vis_packet, vis_info_len, |
454 | &is_new, make_broadcast); | 454 | &is_new, make_broadcast); |
455 | if (!info) | 455 | if (!info) |
@@ -461,7 +461,7 @@ void batadv_receive_server_sync_packet(struct batadv_priv *bat_priv, | |||
461 | if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && is_new) | 461 | if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && is_new) |
462 | batadv_send_list_add(bat_priv, info); | 462 | batadv_send_list_add(bat_priv, info); |
463 | end: | 463 | end: |
464 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 464 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
465 | } | 465 | } |
466 | 466 | ||
467 | /* handle an incoming client update packet and schedule forward if needed. */ | 467 | /* handle an incoming client update packet and schedule forward if needed. */ |
@@ -484,7 +484,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv, | |||
484 | batadv_is_my_mac(vis_packet->target_orig)) | 484 | batadv_is_my_mac(vis_packet->target_orig)) |
485 | are_target = 1; | 485 | are_target = 1; |
486 | 486 | ||
487 | spin_lock_bh(&bat_priv->vis_hash_lock); | 487 | spin_lock_bh(&bat_priv->vis.hash_lock); |
488 | info = batadv_add_packet(bat_priv, vis_packet, vis_info_len, | 488 | info = batadv_add_packet(bat_priv, vis_packet, vis_info_len, |
489 | &is_new, are_target); | 489 | &is_new, are_target); |
490 | 490 | ||
@@ -505,7 +505,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv, | |||
505 | } | 505 | } |
506 | 506 | ||
507 | end: | 507 | end: |
508 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 508 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
509 | } | 509 | } |
510 | 510 | ||
511 | /* Walk the originators and find the VIS server with the best tq. Set the packet | 511 | /* Walk the originators and find the VIS server with the best tq. Set the packet |
@@ -574,10 +574,11 @@ static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) | |||
574 | struct hlist_head *head; | 574 | struct hlist_head *head; |
575 | struct batadv_orig_node *orig_node; | 575 | struct batadv_orig_node *orig_node; |
576 | struct batadv_neigh_node *router; | 576 | struct batadv_neigh_node *router; |
577 | struct batadv_vis_info *info = bat_priv->my_vis_info; | 577 | struct batadv_vis_info *info = bat_priv->vis.my_info; |
578 | struct batadv_vis_packet *packet; | 578 | struct batadv_vis_packet *packet; |
579 | struct batadv_vis_info_entry *entry; | 579 | struct batadv_vis_info_entry *entry; |
580 | struct batadv_tt_common_entry *tt_common_entry; | 580 | struct batadv_tt_common_entry *tt_common_entry; |
581 | uint8_t *packet_pos; | ||
581 | int best_tq = -1; | 582 | int best_tq = -1; |
582 | uint32_t i; | 583 | uint32_t i; |
583 | 584 | ||
@@ -618,8 +619,8 @@ static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) | |||
618 | goto next; | 619 | goto next; |
619 | 620 | ||
620 | /* fill one entry into buffer. */ | 621 | /* fill one entry into buffer. */ |
621 | entry = (struct batadv_vis_info_entry *) | 622 | packet_pos = skb_put(info->skb_packet, sizeof(*entry)); |
622 | skb_put(info->skb_packet, sizeof(*entry)); | 623 | entry = (struct batadv_vis_info_entry *)packet_pos; |
623 | memcpy(entry->src, | 624 | memcpy(entry->src, |
624 | router->if_incoming->net_dev->dev_addr, | 625 | router->if_incoming->net_dev->dev_addr, |
625 | ETH_ALEN); | 626 | ETH_ALEN); |
@@ -636,7 +637,7 @@ next: | |||
636 | rcu_read_unlock(); | 637 | rcu_read_unlock(); |
637 | } | 638 | } |
638 | 639 | ||
639 | hash = bat_priv->tt_local_hash; | 640 | hash = bat_priv->tt.local_hash; |
640 | 641 | ||
641 | for (i = 0; i < hash->size; i++) { | 642 | for (i = 0; i < hash->size; i++) { |
642 | head = &hash->table[i]; | 643 | head = &hash->table[i]; |
@@ -644,9 +645,8 @@ next: | |||
644 | rcu_read_lock(); | 645 | rcu_read_lock(); |
645 | hlist_for_each_entry_rcu(tt_common_entry, node, head, | 646 | hlist_for_each_entry_rcu(tt_common_entry, node, head, |
646 | hash_entry) { | 647 | hash_entry) { |
647 | entry = (struct batadv_vis_info_entry *) | 648 | packet_pos = skb_put(info->skb_packet, sizeof(*entry)); |
648 | skb_put(info->skb_packet, | 649 | entry = (struct batadv_vis_info_entry *)packet_pos; |
649 | sizeof(*entry)); | ||
650 | memset(entry->src, 0, ETH_ALEN); | 650 | memset(entry->src, 0, ETH_ALEN); |
651 | memcpy(entry->dest, tt_common_entry->addr, ETH_ALEN); | 651 | memcpy(entry->dest, tt_common_entry->addr, ETH_ALEN); |
652 | entry->quality = 0; /* 0 means TT */ | 652 | entry->quality = 0; /* 0 means TT */ |
@@ -671,7 +671,7 @@ unlock: | |||
671 | static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) | 671 | static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) |
672 | { | 672 | { |
673 | uint32_t i; | 673 | uint32_t i; |
674 | struct batadv_hashtable *hash = bat_priv->vis_hash; | 674 | struct batadv_hashtable *hash = bat_priv->vis.hash; |
675 | struct hlist_node *node, *node_tmp; | 675 | struct hlist_node *node, *node_tmp; |
676 | struct hlist_head *head; | 676 | struct hlist_head *head; |
677 | struct batadv_vis_info *info; | 677 | struct batadv_vis_info *info; |
@@ -682,7 +682,7 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) | |||
682 | hlist_for_each_entry_safe(info, node, node_tmp, | 682 | hlist_for_each_entry_safe(info, node, node_tmp, |
683 | head, hash_entry) { | 683 | head, hash_entry) { |
684 | /* never purge own data. */ | 684 | /* never purge own data. */ |
685 | if (info == bat_priv->my_vis_info) | 685 | if (info == bat_priv->vis.my_info) |
686 | continue; | 686 | continue; |
687 | 687 | ||
688 | if (batadv_has_timed_out(info->first_seen, | 688 | if (batadv_has_timed_out(info->first_seen, |
@@ -814,34 +814,36 @@ out: | |||
814 | /* called from timer; send (and maybe generate) vis packet. */ | 814 | /* called from timer; send (and maybe generate) vis packet. */ |
815 | static void batadv_send_vis_packets(struct work_struct *work) | 815 | static void batadv_send_vis_packets(struct work_struct *work) |
816 | { | 816 | { |
817 | struct delayed_work *delayed_work = | 817 | struct delayed_work *delayed_work; |
818 | container_of(work, struct delayed_work, work); | ||
819 | struct batadv_priv *bat_priv; | 818 | struct batadv_priv *bat_priv; |
819 | struct batadv_priv_vis *priv_vis; | ||
820 | struct batadv_vis_info *info; | 820 | struct batadv_vis_info *info; |
821 | 821 | ||
822 | bat_priv = container_of(delayed_work, struct batadv_priv, vis_work); | 822 | delayed_work = container_of(work, struct delayed_work, work); |
823 | spin_lock_bh(&bat_priv->vis_hash_lock); | 823 | priv_vis = container_of(delayed_work, struct batadv_priv_vis, work); |
824 | bat_priv = container_of(priv_vis, struct batadv_priv, vis); | ||
825 | spin_lock_bh(&bat_priv->vis.hash_lock); | ||
824 | batadv_purge_vis_packets(bat_priv); | 826 | batadv_purge_vis_packets(bat_priv); |
825 | 827 | ||
826 | if (batadv_generate_vis_packet(bat_priv) == 0) { | 828 | if (batadv_generate_vis_packet(bat_priv) == 0) { |
827 | /* schedule if generation was successful */ | 829 | /* schedule if generation was successful */ |
828 | batadv_send_list_add(bat_priv, bat_priv->my_vis_info); | 830 | batadv_send_list_add(bat_priv, bat_priv->vis.my_info); |
829 | } | 831 | } |
830 | 832 | ||
831 | while (!list_empty(&bat_priv->vis_send_list)) { | 833 | while (!list_empty(&bat_priv->vis.send_list)) { |
832 | info = list_first_entry(&bat_priv->vis_send_list, | 834 | info = list_first_entry(&bat_priv->vis.send_list, |
833 | typeof(*info), send_list); | 835 | typeof(*info), send_list); |
834 | 836 | ||
835 | kref_get(&info->refcount); | 837 | kref_get(&info->refcount); |
836 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 838 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
837 | 839 | ||
838 | batadv_send_vis_packet(bat_priv, info); | 840 | batadv_send_vis_packet(bat_priv, info); |
839 | 841 | ||
840 | spin_lock_bh(&bat_priv->vis_hash_lock); | 842 | spin_lock_bh(&bat_priv->vis.hash_lock); |
841 | batadv_send_list_del(info); | 843 | batadv_send_list_del(info); |
842 | kref_put(&info->refcount, batadv_free_info); | 844 | kref_put(&info->refcount, batadv_free_info); |
843 | } | 845 | } |
844 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 846 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
845 | batadv_start_vis_timer(bat_priv); | 847 | batadv_start_vis_timer(bat_priv); |
846 | } | 848 | } |
847 | 849 | ||
@@ -856,37 +858,37 @@ int batadv_vis_init(struct batadv_priv *bat_priv) | |||
856 | unsigned long first_seen; | 858 | unsigned long first_seen; |
857 | struct sk_buff *tmp_skb; | 859 | struct sk_buff *tmp_skb; |
858 | 860 | ||
859 | if (bat_priv->vis_hash) | 861 | if (bat_priv->vis.hash) |
860 | return 0; | 862 | return 0; |
861 | 863 | ||
862 | spin_lock_bh(&bat_priv->vis_hash_lock); | 864 | spin_lock_bh(&bat_priv->vis.hash_lock); |
863 | 865 | ||
864 | bat_priv->vis_hash = batadv_hash_new(256); | 866 | bat_priv->vis.hash = batadv_hash_new(256); |
865 | if (!bat_priv->vis_hash) { | 867 | if (!bat_priv->vis.hash) { |
866 | pr_err("Can't initialize vis_hash\n"); | 868 | pr_err("Can't initialize vis_hash\n"); |
867 | goto err; | 869 | goto err; |
868 | } | 870 | } |
869 | 871 | ||
870 | bat_priv->my_vis_info = kmalloc(BATADV_MAX_VIS_PACKET_SIZE, GFP_ATOMIC); | 872 | bat_priv->vis.my_info = kmalloc(BATADV_MAX_VIS_PACKET_SIZE, GFP_ATOMIC); |
871 | if (!bat_priv->my_vis_info) | 873 | if (!bat_priv->vis.my_info) |
872 | goto err; | 874 | goto err; |
873 | 875 | ||
874 | len = sizeof(*packet) + BATADV_MAX_VIS_PACKET_SIZE + ETH_HLEN; | 876 | len = sizeof(*packet) + BATADV_MAX_VIS_PACKET_SIZE + ETH_HLEN; |
875 | bat_priv->my_vis_info->skb_packet = dev_alloc_skb(len); | 877 | bat_priv->vis.my_info->skb_packet = dev_alloc_skb(len); |
876 | if (!bat_priv->my_vis_info->skb_packet) | 878 | if (!bat_priv->vis.my_info->skb_packet) |
877 | goto free_info; | 879 | goto free_info; |
878 | 880 | ||
879 | skb_reserve(bat_priv->my_vis_info->skb_packet, ETH_HLEN); | 881 | skb_reserve(bat_priv->vis.my_info->skb_packet, ETH_HLEN); |
880 | tmp_skb = bat_priv->my_vis_info->skb_packet; | 882 | tmp_skb = bat_priv->vis.my_info->skb_packet; |
881 | packet = (struct batadv_vis_packet *)skb_put(tmp_skb, sizeof(*packet)); | 883 | packet = (struct batadv_vis_packet *)skb_put(tmp_skb, sizeof(*packet)); |
882 | 884 | ||
883 | /* prefill the vis info */ | 885 | /* prefill the vis info */ |
884 | first_seen = jiffies - msecs_to_jiffies(BATADV_VIS_INTERVAL); | 886 | first_seen = jiffies - msecs_to_jiffies(BATADV_VIS_INTERVAL); |
885 | bat_priv->my_vis_info->first_seen = first_seen; | 887 | bat_priv->vis.my_info->first_seen = first_seen; |
886 | INIT_LIST_HEAD(&bat_priv->my_vis_info->recv_list); | 888 | INIT_LIST_HEAD(&bat_priv->vis.my_info->recv_list); |
887 | INIT_LIST_HEAD(&bat_priv->my_vis_info->send_list); | 889 | INIT_LIST_HEAD(&bat_priv->vis.my_info->send_list); |
888 | kref_init(&bat_priv->my_vis_info->refcount); | 890 | kref_init(&bat_priv->vis.my_info->refcount); |
889 | bat_priv->my_vis_info->bat_priv = bat_priv; | 891 | bat_priv->vis.my_info->bat_priv = bat_priv; |
890 | packet->header.version = BATADV_COMPAT_VERSION; | 892 | packet->header.version = BATADV_COMPAT_VERSION; |
891 | packet->header.packet_type = BATADV_VIS; | 893 | packet->header.packet_type = BATADV_VIS; |
892 | packet->header.ttl = BATADV_TTL; | 894 | packet->header.ttl = BATADV_TTL; |
@@ -894,28 +896,28 @@ int batadv_vis_init(struct batadv_priv *bat_priv) | |||
894 | packet->reserved = 0; | 896 | packet->reserved = 0; |
895 | packet->entries = 0; | 897 | packet->entries = 0; |
896 | 898 | ||
897 | INIT_LIST_HEAD(&bat_priv->vis_send_list); | 899 | INIT_LIST_HEAD(&bat_priv->vis.send_list); |
898 | 900 | ||
899 | hash_added = batadv_hash_add(bat_priv->vis_hash, batadv_vis_info_cmp, | 901 | hash_added = batadv_hash_add(bat_priv->vis.hash, batadv_vis_info_cmp, |
900 | batadv_vis_info_choose, | 902 | batadv_vis_info_choose, |
901 | bat_priv->my_vis_info, | 903 | bat_priv->vis.my_info, |
902 | &bat_priv->my_vis_info->hash_entry); | 904 | &bat_priv->vis.my_info->hash_entry); |
903 | if (hash_added != 0) { | 905 | if (hash_added != 0) { |
904 | pr_err("Can't add own vis packet into hash\n"); | 906 | pr_err("Can't add own vis packet into hash\n"); |
905 | /* not in hash, need to remove it manually. */ | 907 | /* not in hash, need to remove it manually. */ |
906 | kref_put(&bat_priv->my_vis_info->refcount, batadv_free_info); | 908 | kref_put(&bat_priv->vis.my_info->refcount, batadv_free_info); |
907 | goto err; | 909 | goto err; |
908 | } | 910 | } |
909 | 911 | ||
910 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 912 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
911 | batadv_start_vis_timer(bat_priv); | 913 | batadv_start_vis_timer(bat_priv); |
912 | return 0; | 914 | return 0; |
913 | 915 | ||
914 | free_info: | 916 | free_info: |
915 | kfree(bat_priv->my_vis_info); | 917 | kfree(bat_priv->vis.my_info); |
916 | bat_priv->my_vis_info = NULL; | 918 | bat_priv->vis.my_info = NULL; |
917 | err: | 919 | err: |
918 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 920 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
919 | batadv_vis_quit(bat_priv); | 921 | batadv_vis_quit(bat_priv); |
920 | return -ENOMEM; | 922 | return -ENOMEM; |
921 | } | 923 | } |
@@ -933,23 +935,23 @@ static void batadv_free_info_ref(struct hlist_node *node, void *arg) | |||
933 | /* shutdown vis-server */ | 935 | /* shutdown vis-server */ |
934 | void batadv_vis_quit(struct batadv_priv *bat_priv) | 936 | void batadv_vis_quit(struct batadv_priv *bat_priv) |
935 | { | 937 | { |
936 | if (!bat_priv->vis_hash) | 938 | if (!bat_priv->vis.hash) |
937 | return; | 939 | return; |
938 | 940 | ||
939 | cancel_delayed_work_sync(&bat_priv->vis_work); | 941 | cancel_delayed_work_sync(&bat_priv->vis.work); |
940 | 942 | ||
941 | spin_lock_bh(&bat_priv->vis_hash_lock); | 943 | spin_lock_bh(&bat_priv->vis.hash_lock); |
942 | /* properly remove, kill timers ... */ | 944 | /* properly remove, kill timers ... */ |
943 | batadv_hash_delete(bat_priv->vis_hash, batadv_free_info_ref, NULL); | 945 | batadv_hash_delete(bat_priv->vis.hash, batadv_free_info_ref, NULL); |
944 | bat_priv->vis_hash = NULL; | 946 | bat_priv->vis.hash = NULL; |
945 | bat_priv->my_vis_info = NULL; | 947 | bat_priv->vis.my_info = NULL; |
946 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 948 | spin_unlock_bh(&bat_priv->vis.hash_lock); |
947 | } | 949 | } |
948 | 950 | ||
949 | /* schedule packets for (re)transmission */ | 951 | /* schedule packets for (re)transmission */ |
950 | static void batadv_start_vis_timer(struct batadv_priv *bat_priv) | 952 | static void batadv_start_vis_timer(struct batadv_priv *bat_priv) |
951 | { | 953 | { |
952 | INIT_DELAYED_WORK(&bat_priv->vis_work, batadv_send_vis_packets); | 954 | INIT_DELAYED_WORK(&bat_priv->vis.work, batadv_send_vis_packets); |
953 | queue_delayed_work(batadv_event_workqueue, &bat_priv->vis_work, | 955 | queue_delayed_work(batadv_event_workqueue, &bat_priv->vis.work, |
954 | msecs_to_jiffies(BATADV_VIS_INTERVAL)); | 956 | msecs_to_jiffies(BATADV_VIS_INTERVAL)); |
955 | } | 957 | } |