Lines Matching refs:bat_priv
112 static void batadv_mcast_mla_list_free(struct batadv_priv *bat_priv, in batadv_mcast_mla_list_free() argument
118 lockdep_assert_held(&bat_priv->tt.commit_lock); in batadv_mcast_mla_list_free()
136 static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, in batadv_mcast_mla_tt_retract() argument
142 lockdep_assert_held(&bat_priv->tt.commit_lock); in batadv_mcast_mla_tt_retract()
144 hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, in batadv_mcast_mla_tt_retract()
151 batadv_tt_local_remove(bat_priv, mcast_entry->addr, in batadv_mcast_mla_tt_retract()
168 static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, in batadv_mcast_mla_tt_add() argument
174 lockdep_assert_held(&bat_priv->tt.commit_lock); in batadv_mcast_mla_tt_add()
181 &bat_priv->mcast.mla_list)) in batadv_mcast_mla_tt_add()
184 if (!batadv_tt_local_add(bat_priv->soft_iface, in batadv_mcast_mla_tt_add()
190 hlist_add_head(&mcast_entry->list, &bat_priv->mcast.mla_list); in batadv_mcast_mla_tt_add()
201 static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv) in batadv_mcast_has_bridge() argument
203 struct net_device *upper = bat_priv->soft_iface; in batadv_mcast_has_bridge()
224 static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv) in batadv_mcast_mla_tvlv_update() argument
234 if (batadv_mcast_has_bridge(bat_priv)) { in batadv_mcast_mla_tvlv_update()
235 if (bat_priv->mcast.enabled) { in batadv_mcast_mla_tvlv_update()
236 batadv_tvlv_container_unregister(bat_priv, in batadv_mcast_mla_tvlv_update()
238 bat_priv->mcast.enabled = false; in batadv_mcast_mla_tvlv_update()
244 if (!bat_priv->mcast.enabled || in batadv_mcast_mla_tvlv_update()
245 mcast_data.flags != bat_priv->mcast.flags) { in batadv_mcast_mla_tvlv_update()
246 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_MCAST, 1, in batadv_mcast_mla_tvlv_update()
248 bat_priv->mcast.flags = mcast_data.flags; in batadv_mcast_mla_tvlv_update()
249 bat_priv->mcast.enabled = true; in batadv_mcast_mla_tvlv_update()
262 void batadv_mcast_mla_update(struct batadv_priv *bat_priv) in batadv_mcast_mla_update() argument
264 struct net_device *soft_iface = bat_priv->soft_iface; in batadv_mcast_mla_update()
268 if (!batadv_mcast_mla_tvlv_update(bat_priv)) in batadv_mcast_mla_update()
276 batadv_mcast_mla_tt_retract(bat_priv, &mcast_list); in batadv_mcast_mla_update()
277 batadv_mcast_mla_tt_add(bat_priv, &mcast_list); in batadv_mcast_mla_update()
280 batadv_mcast_mla_list_free(bat_priv, &mcast_list); in batadv_mcast_mla_update()
295 static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check_ipv4() argument
333 static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check_ipv6() argument
372 static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check() argument
378 if (!atomic_read(&bat_priv->multicast_mode)) in batadv_mcast_forw_mode_check()
381 if (atomic_read(&bat_priv->mcast.num_disabled)) in batadv_mcast_forw_mode_check()
386 return batadv_mcast_forw_mode_check_ipv4(bat_priv, skb, in batadv_mcast_forw_mode_check()
389 return batadv_mcast_forw_mode_check_ipv6(bat_priv, skb, in batadv_mcast_forw_mode_check()
405 static int batadv_mcast_forw_want_all_ip_count(struct batadv_priv *bat_priv, in batadv_mcast_forw_want_all_ip_count() argument
410 return atomic_read(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_forw_want_all_ip_count()
412 return atomic_read(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_forw_want_all_ip_count()
428 batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, in batadv_mcast_forw_tt_node_get() argument
431 return batadv_transtable_search(bat_priv, ethhdr->h_source, in batadv_mcast_forw_tt_node_get()
443 batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_ipv4_node_get() argument
449 &bat_priv->mcast.want_all_ipv4_list, in batadv_mcast_forw_ipv4_node_get()
470 batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_ipv6_node_get() argument
476 &bat_priv->mcast.want_all_ipv6_list, in batadv_mcast_forw_ipv6_node_get()
499 batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv, in batadv_mcast_forw_ip_node_get() argument
504 return batadv_mcast_forw_ipv4_node_get(bat_priv); in batadv_mcast_forw_ip_node_get()
506 return batadv_mcast_forw_ipv6_node_get(bat_priv); in batadv_mcast_forw_ip_node_get()
521 batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_unsnoop_node_get() argument
527 &bat_priv->mcast.want_all_unsnoopables_list, in batadv_mcast_forw_unsnoop_node_get()
551 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, in batadv_mcast_forw_mode() argument
558 ret = batadv_mcast_forw_mode_check(bat_priv, skb, &is_unsnoopable); in batadv_mcast_forw_mode()
566 tt_count = batadv_tt_global_hash_count(bat_priv, ethhdr->h_dest, in batadv_mcast_forw_mode()
568 ip_count = batadv_mcast_forw_want_all_ip_count(bat_priv, ethhdr); in batadv_mcast_forw_mode()
570 atomic_read(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_forw_mode()
577 *orig = batadv_mcast_forw_tt_node_get(bat_priv, ethhdr); in batadv_mcast_forw_mode()
579 *orig = batadv_mcast_forw_ip_node_get(bat_priv, ethhdr); in batadv_mcast_forw_mode()
581 *orig = batadv_mcast_forw_unsnoop_node_get(bat_priv); in batadv_mcast_forw_mode()
605 static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv, in batadv_mcast_want_unsnoop_update() argument
610 struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list; in batadv_mcast_want_unsnoop_update()
617 atomic_inc(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
619 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
624 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
628 atomic_dec(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
630 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
635 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
650 static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv, in batadv_mcast_want_ipv4_update() argument
655 struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list; in batadv_mcast_want_ipv4_update()
662 atomic_inc(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
664 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
669 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
673 atomic_dec(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
675 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
680 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
695 static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv, in batadv_mcast_want_ipv6_update() argument
700 struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list; in batadv_mcast_want_ipv6_update()
707 atomic_inc(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
709 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
714 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
718 atomic_dec(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
720 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
725 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
737 static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_mcast_tvlv_ogm_handler_v1() argument
762 atomic_dec(&bat_priv->mcast.num_disabled); in batadv_mcast_tvlv_ogm_handler_v1()
771 atomic_inc(&bat_priv->mcast.num_disabled); in batadv_mcast_tvlv_ogm_handler_v1()
777 batadv_mcast_want_unsnoop_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler_v1()
778 batadv_mcast_want_ipv4_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler_v1()
779 batadv_mcast_want_ipv6_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler_v1()
789 void batadv_mcast_init(struct batadv_priv *bat_priv) in batadv_mcast_init() argument
791 batadv_tvlv_handler_register(bat_priv, batadv_mcast_tvlv_ogm_handler_v1, in batadv_mcast_init()
800 void batadv_mcast_free(struct batadv_priv *bat_priv) in batadv_mcast_free() argument
802 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 1); in batadv_mcast_free()
803 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 1); in batadv_mcast_free()
805 batadv_mcast_mla_tt_retract(bat_priv, NULL); in batadv_mcast_free()
814 struct batadv_priv *bat_priv = orig->bat_priv; in batadv_mcast_purge_orig() local
820 atomic_dec(&bat_priv->mcast.num_disabled); in batadv_mcast_purge_orig()
822 batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()
823 batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()
824 batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()