Lines Matching refs:bat_priv

79 static void batadv_mcast_start_timer(struct batadv_priv *bat_priv)  in batadv_mcast_start_timer()  argument
81 queue_delayed_work(batadv_event_workqueue, &bat_priv->mcast.work, in batadv_mcast_start_timer()
158 static int batadv_mcast_mla_softif_get(struct batadv_priv *bat_priv, in batadv_mcast_mla_softif_get() argument
162 bool all_ipv4 = bat_priv->mcast.flags & BATADV_MCAST_WANT_ALL_IPV4; in batadv_mcast_mla_softif_get()
163 bool all_ipv6 = bat_priv->mcast.flags & BATADV_MCAST_WANT_ALL_IPV6; in batadv_mcast_mla_softif_get()
253 static int batadv_mcast_mla_bridge_get(struct batadv_priv *bat_priv, in batadv_mcast_mla_bridge_get() argument
258 bool all_ipv4 = bat_priv->mcast.flags & BATADV_MCAST_WANT_ALL_IPV4; in batadv_mcast_mla_bridge_get()
259 bool all_ipv6 = bat_priv->mcast.flags & BATADV_MCAST_WANT_ALL_IPV6; in batadv_mcast_mla_bridge_get()
331 static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, in batadv_mcast_mla_tt_retract() argument
337 WARN_ON(delayed_work_pending(&bat_priv->mcast.work)); in batadv_mcast_mla_tt_retract()
339 hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, in batadv_mcast_mla_tt_retract()
346 batadv_tt_local_remove(bat_priv, mcast_entry->addr, in batadv_mcast_mla_tt_retract()
365 static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, in batadv_mcast_mla_tt_add() argument
371 WARN_ON(delayed_work_pending(&bat_priv->mcast.work)); in batadv_mcast_mla_tt_add()
378 &bat_priv->mcast.mla_list)) in batadv_mcast_mla_tt_add()
381 if (!batadv_tt_local_add(bat_priv->soft_iface, in batadv_mcast_mla_tt_add()
387 hlist_add_head(&mcast_entry->list, &bat_priv->mcast.mla_list); in batadv_mcast_mla_tt_add()
399 static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv) in batadv_mcast_has_bridge() argument
401 struct net_device *upper = bat_priv->soft_iface; in batadv_mcast_has_bridge()
435 batadv_mcast_querier_log(struct batadv_priv *bat_priv, char *str_proto, in batadv_mcast_querier_log() argument
440 batadv_info(bat_priv->soft_iface, "%s Querier appeared\n", in batadv_mcast_querier_log()
443 batadv_info(bat_priv->soft_iface, in batadv_mcast_querier_log()
446 else if (!bat_priv->mcast.bridged && !new_state->exists) in batadv_mcast_querier_log()
447 batadv_info(bat_priv->soft_iface, in batadv_mcast_querier_log()
454 batadv_dbg(BATADV_DBG_MCAST, bat_priv, in batadv_mcast_querier_log()
458 batadv_dbg(BATADV_DBG_MCAST, bat_priv, in batadv_mcast_querier_log()
483 batadv_mcast_bridge_log(struct batadv_priv *bat_priv, bool bridged, in batadv_mcast_bridge_log() argument
487 if (!bat_priv->mcast.bridged && bridged) in batadv_mcast_bridge_log()
488 batadv_dbg(BATADV_DBG_MCAST, bat_priv, in batadv_mcast_bridge_log()
490 else if (bat_priv->mcast.bridged && !bridged) in batadv_mcast_bridge_log()
491 batadv_dbg(BATADV_DBG_MCAST, bat_priv, in batadv_mcast_bridge_log()
495 batadv_mcast_querier_log(bat_priv, "IGMP", in batadv_mcast_bridge_log()
496 &bat_priv->mcast.querier_ipv4, in batadv_mcast_bridge_log()
498 batadv_mcast_querier_log(bat_priv, "MLD", in batadv_mcast_bridge_log()
499 &bat_priv->mcast.querier_ipv6, in batadv_mcast_bridge_log()
512 static void batadv_mcast_flags_log(struct batadv_priv *bat_priv, u8 flags) in batadv_mcast_flags_log() argument
514 u8 old_flags = bat_priv->mcast.flags; in batadv_mcast_flags_log()
522 batadv_dbg(BATADV_DBG_MCAST, bat_priv, in batadv_mcast_flags_log()
524 bat_priv->mcast.enabled ? str_old_flags : "<undefined>", in batadv_mcast_flags_log()
540 static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv) in batadv_mcast_mla_tvlv_update() argument
545 struct net_device *dev = bat_priv->soft_iface; in batadv_mcast_mla_tvlv_update()
551 bridged = batadv_mcast_has_bridge(bat_priv); in batadv_mcast_mla_tvlv_update()
582 batadv_mcast_bridge_log(bat_priv, bridged, &querier4, &querier6); in batadv_mcast_mla_tvlv_update()
584 bat_priv->mcast.querier_ipv4.exists = querier4.exists; in batadv_mcast_mla_tvlv_update()
585 bat_priv->mcast.querier_ipv4.shadowing = querier4.shadowing; in batadv_mcast_mla_tvlv_update()
587 bat_priv->mcast.querier_ipv6.exists = querier6.exists; in batadv_mcast_mla_tvlv_update()
588 bat_priv->mcast.querier_ipv6.shadowing = querier6.shadowing; in batadv_mcast_mla_tvlv_update()
590 bat_priv->mcast.bridged = bridged; in batadv_mcast_mla_tvlv_update()
592 if (!bat_priv->mcast.enabled || in batadv_mcast_mla_tvlv_update()
593 mcast_data.flags != bat_priv->mcast.flags) { in batadv_mcast_mla_tvlv_update()
594 batadv_mcast_flags_log(bat_priv, mcast_data.flags); in batadv_mcast_mla_tvlv_update()
595 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_MCAST, 2, in batadv_mcast_mla_tvlv_update()
597 bat_priv->mcast.flags = mcast_data.flags; in batadv_mcast_mla_tvlv_update()
598 bat_priv->mcast.enabled = true; in batadv_mcast_mla_tvlv_update()
617 static void __batadv_mcast_mla_update(struct batadv_priv *bat_priv) in __batadv_mcast_mla_update() argument
619 struct net_device *soft_iface = bat_priv->soft_iface; in __batadv_mcast_mla_update()
623 if (!batadv_mcast_mla_tvlv_update(bat_priv)) in __batadv_mcast_mla_update()
626 ret = batadv_mcast_mla_softif_get(bat_priv, soft_iface, &mcast_list); in __batadv_mcast_mla_update()
630 ret = batadv_mcast_mla_bridge_get(bat_priv, soft_iface, &mcast_list); in __batadv_mcast_mla_update()
635 batadv_mcast_mla_tt_retract(bat_priv, &mcast_list); in __batadv_mcast_mla_update()
636 batadv_mcast_mla_tt_add(bat_priv, &mcast_list); in __batadv_mcast_mla_update()
655 struct batadv_priv *bat_priv; in batadv_mcast_mla_update() local
659 bat_priv = container_of(priv_mcast, struct batadv_priv, mcast); in batadv_mcast_mla_update()
661 __batadv_mcast_mla_update(bat_priv); in batadv_mcast_mla_update()
662 batadv_mcast_start_timer(bat_priv); in batadv_mcast_mla_update()
703 static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check_ipv4() argument
768 static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check_ipv6() argument
809 static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, in batadv_mcast_forw_mode_check() argument
815 if (!atomic_read(&bat_priv->multicast_mode)) in batadv_mcast_forw_mode_check()
820 return batadv_mcast_forw_mode_check_ipv4(bat_priv, skb, in batadv_mcast_forw_mode_check()
826 return batadv_mcast_forw_mode_check_ipv6(bat_priv, skb, in batadv_mcast_forw_mode_check()
843 static int batadv_mcast_forw_want_all_ip_count(struct batadv_priv *bat_priv, in batadv_mcast_forw_want_all_ip_count() argument
848 return atomic_read(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_forw_want_all_ip_count()
850 return atomic_read(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_forw_want_all_ip_count()
866 batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, in batadv_mcast_forw_tt_node_get() argument
869 return batadv_transtable_search(bat_priv, NULL, ethhdr->h_dest, in batadv_mcast_forw_tt_node_get()
881 batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_ipv4_node_get() argument
887 &bat_priv->mcast.want_all_ipv4_list, in batadv_mcast_forw_ipv4_node_get()
908 batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_ipv6_node_get() argument
914 &bat_priv->mcast.want_all_ipv6_list, in batadv_mcast_forw_ipv6_node_get()
937 batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv, in batadv_mcast_forw_ip_node_get() argument
942 return batadv_mcast_forw_ipv4_node_get(bat_priv); in batadv_mcast_forw_ip_node_get()
944 return batadv_mcast_forw_ipv6_node_get(bat_priv); in batadv_mcast_forw_ip_node_get()
959 batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv) in batadv_mcast_forw_unsnoop_node_get() argument
965 &bat_priv->mcast.want_all_unsnoopables_list, in batadv_mcast_forw_unsnoop_node_get()
989 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, in batadv_mcast_forw_mode() argument
996 ret = batadv_mcast_forw_mode_check(bat_priv, skb, &is_unsnoopable); in batadv_mcast_forw_mode()
1004 tt_count = batadv_tt_global_hash_count(bat_priv, ethhdr->h_dest, in batadv_mcast_forw_mode()
1006 ip_count = batadv_mcast_forw_want_all_ip_count(bat_priv, ethhdr); in batadv_mcast_forw_mode()
1008 atomic_read(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_forw_mode()
1015 *orig = batadv_mcast_forw_tt_node_get(bat_priv, ethhdr); in batadv_mcast_forw_mode()
1017 *orig = batadv_mcast_forw_ip_node_get(bat_priv, ethhdr); in batadv_mcast_forw_mode()
1019 *orig = batadv_mcast_forw_unsnoop_node_get(bat_priv); in batadv_mcast_forw_mode()
1043 static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv, in batadv_mcast_want_unsnoop_update() argument
1048 struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list; in batadv_mcast_want_unsnoop_update()
1055 atomic_inc(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
1057 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1062 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1066 atomic_dec(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
1068 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1073 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1088 static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv, in batadv_mcast_want_ipv4_update() argument
1093 struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list; in batadv_mcast_want_ipv4_update()
1100 atomic_inc(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
1102 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1107 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1111 atomic_dec(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
1113 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1118 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1133 static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv, in batadv_mcast_want_ipv6_update() argument
1138 struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list; in batadv_mcast_want_ipv6_update()
1145 atomic_inc(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
1147 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1152 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1156 atomic_dec(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
1158 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1163 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1175 static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv, in batadv_mcast_tvlv_ogm_handler() argument
1205 batadv_mcast_want_unsnoop_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler()
1206 batadv_mcast_want_ipv4_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler()
1207 batadv_mcast_want_ipv6_update(bat_priv, orig, mcast_flags); in batadv_mcast_tvlv_ogm_handler()
1217 void batadv_mcast_init(struct batadv_priv *bat_priv) in batadv_mcast_init() argument
1219 batadv_tvlv_handler_register(bat_priv, batadv_mcast_tvlv_ogm_handler, in batadv_mcast_init()
1223 INIT_DELAYED_WORK(&bat_priv->mcast.work, batadv_mcast_mla_update); in batadv_mcast_init()
1224 batadv_mcast_start_timer(bat_priv); in batadv_mcast_init()
1237 static void batadv_mcast_flags_print_header(struct batadv_priv *bat_priv, in batadv_mcast_flags_print_header() argument
1240 u8 flags = bat_priv->mcast.flags; in batadv_mcast_flags_print_header()
1242 bool bridged = bat_priv->mcast.bridged; in batadv_mcast_flags_print_header()
1245 querier4 = bat_priv->mcast.querier_ipv4.exists ? '.' : '4'; in batadv_mcast_flags_print_header()
1246 querier6 = bat_priv->mcast.querier_ipv6.exists ? '.' : '6'; in batadv_mcast_flags_print_header()
1247 shadowing4 = bat_priv->mcast.querier_ipv4.shadowing ? '4' : '.'; in batadv_mcast_flags_print_header()
1248 shadowing6 = bat_priv->mcast.querier_ipv6.shadowing ? '6' : '.'; in batadv_mcast_flags_print_header()
1282 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_mcast_flags_seq_print_text() local
1284 struct batadv_hashtable *hash = bat_priv->orig_hash; in batadv_mcast_flags_seq_print_text()
1294 batadv_mcast_flags_print_header(bat_priv, seq); in batadv_mcast_flags_seq_print_text()
1338 struct batadv_priv *bat_priv) in batadv_mcast_mesh_info_put() argument
1340 u32 flags = bat_priv->mcast.flags; in batadv_mcast_mesh_info_put()
1343 if (bat_priv->mcast.bridged) { in batadv_mcast_mesh_info_put()
1346 if (bat_priv->mcast.querier_ipv4.exists) in batadv_mcast_mesh_info_put()
1348 if (bat_priv->mcast.querier_ipv6.exists) in batadv_mcast_mesh_info_put()
1350 if (bat_priv->mcast.querier_ipv4.shadowing) in batadv_mcast_mesh_info_put()
1352 if (bat_priv->mcast.querier_ipv6.shadowing) in batadv_mcast_mesh_info_put()
1459 struct batadv_priv *bat_priv, long *bucket, long *idx) in __batadv_mcast_flags_dump() argument
1461 struct batadv_hashtable *hash = bat_priv->orig_hash; in __batadv_mcast_flags_dump()
1498 struct batadv_priv *bat_priv; in batadv_mcast_netlink_get_primary() local
1512 bat_priv = netdev_priv(soft_iface); in batadv_mcast_netlink_get_primary()
1514 hard_iface = batadv_primary_if_get_selected(bat_priv); in batadv_mcast_netlink_get_primary()
1543 struct batadv_priv *bat_priv; in batadv_mcast_flags_dump() local
1552 bat_priv = netdev_priv(primary_if->soft_iface); in batadv_mcast_flags_dump()
1554 bat_priv, bucket, idx); in batadv_mcast_flags_dump()
1564 void batadv_mcast_free(struct batadv_priv *bat_priv) in batadv_mcast_free() argument
1566 cancel_delayed_work_sync(&bat_priv->mcast.work); in batadv_mcast_free()
1568 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2); in batadv_mcast_free()
1569 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 2); in batadv_mcast_free()
1572 batadv_mcast_mla_tt_retract(bat_priv, NULL); in batadv_mcast_free()
1581 struct batadv_priv *bat_priv = orig->bat_priv; in batadv_mcast_purge_orig() local
1585 batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()
1586 batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()
1587 batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS); in batadv_mcast_purge_orig()