Lines Matching refs:bat_priv
108 static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, in batadv_mcast_mla_tt_retract() argument
114 hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, in batadv_mcast_mla_tt_retract()
121 batadv_tt_local_remove(bat_priv, mcast_entry->addr, in batadv_mcast_mla_tt_retract()
138 static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, in batadv_mcast_mla_tt_add() argument
149 &bat_priv->mcast.mla_list)) in batadv_mcast_mla_tt_add()
152 if (!batadv_tt_local_add(bat_priv->soft_iface, in batadv_mcast_mla_tt_add()
158 hlist_add_head(&mcast_entry->list, &bat_priv->mcast.mla_list); in batadv_mcast_mla_tt_add()
169 static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv) in batadv_mcast_has_bridge() argument
171 struct net_device *upper = bat_priv->soft_iface; in batadv_mcast_has_bridge()
192 static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv) in batadv_mcast_mla_tvlv_update() argument
202 if (batadv_mcast_has_bridge(bat_priv)) { in batadv_mcast_mla_tvlv_update()
203 if (bat_priv->mcast.enabled) { in batadv_mcast_mla_tvlv_update()
204 batadv_tvlv_container_unregister(bat_priv, in batadv_mcast_mla_tvlv_update()
206 bat_priv->mcast.enabled = false; in batadv_mcast_mla_tvlv_update()
212 if (!bat_priv->mcast.enabled || in batadv_mcast_mla_tvlv_update()
213 mcast_data.flags != bat_priv->mcast.flags) { in batadv_mcast_mla_tvlv_update()
214 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_MCAST, 1, in batadv_mcast_mla_tvlv_update()
216 bat_priv->mcast.flags = mcast_data.flags; in batadv_mcast_mla_tvlv_update()
217 bat_priv->mcast.enabled = true; in batadv_mcast_mla_tvlv_update()
230 void batadv_mcast_mla_update(struct batadv_priv *bat_priv) in batadv_mcast_mla_update() argument
232 struct net_device *soft_iface = bat_priv->soft_iface; in batadv_mcast_mla_update()
236 if (!batadv_mcast_mla_tvlv_update(bat_priv)) in batadv_mcast_mla_update()
244 batadv_mcast_mla_tt_retract(bat_priv, &mcast_list); in batadv_mcast_mla_update()
245 batadv_mcast_mla_tt_add(bat_priv, &mcast_list); in batadv_mcast_mla_update()
263 static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check_ipv4() argument
301 static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check_ipv6() argument
340 static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check() argument
346 if (!atomic_read(&bat_priv->multicast_mode)) in batadv_mcast_forw_mode_check()
349 if (atomic_read(&bat_priv->mcast.num_disabled)) in batadv_mcast_forw_mode_check()
354 return batadv_mcast_forw_mode_check_ipv4(bat_priv, skb, in batadv_mcast_forw_mode_check()
357 return batadv_mcast_forw_mode_check_ipv6(bat_priv, skb, in batadv_mcast_forw_mode_check()
373 static int batadv_mcast_forw_want_all_ip_count(struct batadv_priv *bat_priv, in batadv_mcast_forw_want_all_ip_count() argument
378 return atomic_read(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_forw_want_all_ip_count()
380 return atomic_read(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_forw_want_all_ip_count()
396 batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, in batadv_mcast_forw_tt_node_get() argument
399 return batadv_transtable_search(bat_priv, ethhdr->h_source, in batadv_mcast_forw_tt_node_get()
411 batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_ipv4_node_get() argument
417 &bat_priv->mcast.want_all_ipv4_list, in batadv_mcast_forw_ipv4_node_get()
438 batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_ipv6_node_get() argument
444 &bat_priv->mcast.want_all_ipv6_list, in batadv_mcast_forw_ipv6_node_get()
467 batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv, in batadv_mcast_forw_ip_node_get() argument
472 return batadv_mcast_forw_ipv4_node_get(bat_priv); in batadv_mcast_forw_ip_node_get()
474 return batadv_mcast_forw_ipv6_node_get(bat_priv); in batadv_mcast_forw_ip_node_get()
489 batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_unsnoop_node_get() argument
495 &bat_priv->mcast.want_all_unsnoopables_list, in batadv_mcast_forw_unsnoop_node_get()
519 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, in batadv_mcast_forw_mode() argument
526 ret = batadv_mcast_forw_mode_check(bat_priv, skb, &is_unsnoopable); in batadv_mcast_forw_mode()
534 tt_count = batadv_tt_global_hash_count(bat_priv, ethhdr->h_dest, in batadv_mcast_forw_mode()
536 ip_count = batadv_mcast_forw_want_all_ip_count(bat_priv, ethhdr); in batadv_mcast_forw_mode()
538 atomic_read(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_forw_mode()
545 *orig = batadv_mcast_forw_tt_node_get(bat_priv, ethhdr); in batadv_mcast_forw_mode()
547 *orig = batadv_mcast_forw_ip_node_get(bat_priv, ethhdr); in batadv_mcast_forw_mode()
549 *orig = batadv_mcast_forw_unsnoop_node_get(bat_priv); in batadv_mcast_forw_mode()
573 static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv, in batadv_mcast_want_unsnoop_update() argument
578 struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list; in batadv_mcast_want_unsnoop_update()
583 atomic_inc(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
585 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
590 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
594 atomic_dec(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
596 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
601 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
616 static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv, in batadv_mcast_want_ipv4_update() argument
621 struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list; in batadv_mcast_want_ipv4_update()
626 atomic_inc(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
628 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
633 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
637 atomic_dec(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
639 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
644 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
659 static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv, in batadv_mcast_want_ipv6_update() argument
664 struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list; in batadv_mcast_want_ipv6_update()
669 atomic_inc(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
671 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
676 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
680 atomic_dec(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
682 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
687 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
699 static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_mcast_tvlv_ogm_handler_v1() argument
724 atomic_dec(&bat_priv->mcast.num_disabled); in batadv_mcast_tvlv_ogm_handler_v1()
733 atomic_inc(&bat_priv->mcast.num_disabled); in batadv_mcast_tvlv_ogm_handler_v1()
739 batadv_mcast_want_unsnoop_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler_v1()
740 batadv_mcast_want_ipv4_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler_v1()
741 batadv_mcast_want_ipv6_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler_v1()
751 void batadv_mcast_init(struct batadv_priv *bat_priv) in batadv_mcast_init() argument
753 batadv_tvlv_handler_register(bat_priv, batadv_mcast_tvlv_ogm_handler_v1, in batadv_mcast_init()
762 void batadv_mcast_free(struct batadv_priv *bat_priv) in batadv_mcast_free() argument
764 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 1); in batadv_mcast_free()
765 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 1); in batadv_mcast_free()
767 batadv_mcast_mla_tt_retract(bat_priv, NULL); in batadv_mcast_free()
776 struct batadv_priv *bat_priv = orig->bat_priv; in batadv_mcast_purge_orig() local
782 atomic_dec(&bat_priv->mcast.num_disabled); in batadv_mcast_purge_orig()
784 batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()
785 batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()
786 batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()