Lines Matching +full:3 +full:br
82 static void br_multicast_find_del_pg(struct net_bridge *br,
90 br_sg_port_find(struct net_bridge *br, in br_sg_port_find() argument
93 lockdep_assert_held_once(&br->multicast_lock); in br_sg_port_find()
95 return rhashtable_lookup_fast(&br->sg_port_tbl, sg_p, in br_sg_port_find()
99 static struct net_bridge_mdb_entry *br_mdb_ip_get_rcu(struct net_bridge *br, in br_mdb_ip_get_rcu() argument
102 return rhashtable_lookup(&br->mdb_hash_tbl, dst, br_mdb_rht_params); in br_mdb_ip_get_rcu()
105 struct net_bridge_mdb_entry *br_mdb_ip_get(struct net_bridge *br, in br_mdb_ip_get() argument
110 lockdep_assert_held_once(&br->multicast_lock); in br_mdb_ip_get()
113 ent = rhashtable_lookup(&br->mdb_hash_tbl, dst, br_mdb_rht_params); in br_mdb_ip_get()
119 static struct net_bridge_mdb_entry *br_mdb_ip4_get(struct net_bridge *br, in br_mdb_ip4_get() argument
129 return br_mdb_ip_get(br, &br_dst); in br_mdb_ip4_get()
133 static struct net_bridge_mdb_entry *br_mdb_ip6_get(struct net_bridge *br, in br_mdb_ip6_get() argument
144 return br_mdb_ip_get(br, &br_dst); in br_mdb_ip6_get()
152 struct net_bridge *br = brmctx->br; in br_mdb_entry_skb_get() local
155 if (!br_opt_get(br, BROPT_MULTICAST_ENABLED) || in br_mdb_entry_skb_get()
169 if (brmctx->multicast_igmp_version == 3) { in br_mdb_entry_skb_get()
173 mdb = br_mdb_ip_get_rcu(br, &ip); in br_mdb_entry_skb_get()
186 mdb = br_mdb_ip_get_rcu(br, &ip); in br_mdb_entry_skb_get()
198 return br_mdb_ip_get_rcu(br, &ip); in br_mdb_entry_skb_get()
215 lockdep_assert_held_once(&pg->key.port->br->multicast_lock); in br_multicast_pg_to_port_ctx()
219 !br_opt_get(pg->key.port->br, BROPT_MCAST_VLAN_SNOOPING_ENABLED)) in br_multicast_pg_to_port_ctx()
245 lockdep_assert_held_once(&port->br->multicast_lock); in br_multicast_port_vid_to_port_ctx()
247 if (!br_opt_get(port->br, BROPT_MCAST_VLAN_SNOOPING_ENABLED)) in br_multicast_port_vid_to_port_ctx()
271 if (!netif_running(brmctx->br->dev)) in br_multicast_ctx_should_use()
305 if (br_sg_port_find(brmctx->br, &sg_key)) in __fwd_add_star_excl()
322 struct net_bridge *br = pg->key.port->br; in __fwd_del_star_excl() local
328 src_pg = br_sg_port_find(br, &sg_key); in __fwd_del_star_excl()
333 br_multicast_find_del_pg(br, src_pg); in __fwd_del_star_excl()
347 struct net_bridge *br = pg->key.port->br; in br_multicast_star_g_handle_mode() local
356 mp = br_mdb_ip_get(br, &pg->key.addr); in br_multicast_star_g_handle_mode()
366 for (pg_lst = mlock_dereference(mp->ports, br); in br_multicast_star_g_handle_mode()
368 pg_lst = mlock_dereference(pg_lst->next, br)) { in br_multicast_star_g_handle_mode()
400 sg_mp = br_mdb_ip_get(star_mp->br, &sg->key.addr); in br_multicast_sg_host_state()
409 struct net_bridge *br = star_mp->br; in br_multicast_star_g_host_state() local
419 for (pg = mlock_dereference(star_mp->ports, br); in br_multicast_star_g_host_state()
421 pg = mlock_dereference(pg->next, br)) { in br_multicast_star_g_host_state()
428 sg_mp = br_mdb_ip_get(br, &sg_ip); in br_multicast_star_g_host_state()
449 (p = mlock_dereference(*pp, sgmp->br)) != NULL; in br_multicast_sg_del_exclude_ports()
462 (p = mlock_dereference(*pp, sgmp->br)) != NULL;) { in br_multicast_sg_del_exclude_ports()
474 struct net_bridge *br = star_mp->br; in br_multicast_sg_add_exclude_ports() local
488 for (pg = mlock_dereference(star_mp->ports, br); in br_multicast_sg_add_exclude_ports()
490 pg = mlock_dereference(pg->next, br)) { in br_multicast_sg_add_exclude_ports()
497 if (br_sg_port_find(br, &sg_key)) in br_multicast_sg_add_exclude_ports()
550 star_mp = br_mdb_ip_get(src->br, &src->pg->key.addr); in br_multicast_fwd_src_add()
569 mp = br_mdb_ip_get(src->br, &sg_ip); in br_multicast_fwd_src_remove()
574 (p = mlock_dereference(*pp, src->br)) != NULL; in br_multicast_fwd_src_remove()
606 sg = br_sg_port_find(src->br, &sg_key); in br_multicast_fwd_src_handle()
619 sg_mp = br_mdb_ip_get(src->br, &sg_key.addr); in br_multicast_fwd_src_handle()
622 br_mdb_notify(src->br->dev, sg_mp, sg, RTM_NEWMDB); in br_multicast_fwd_src_handle()
640 struct net_bridge *br = mp->br; in br_multicast_del_mdb_entry() local
642 rhashtable_remove_fast(&br->mdb_hash_tbl, &mp->rhnode, in br_multicast_del_mdb_entry()
645 hlist_add_head(&mp->mcast_gc.gc_node, &br->mcast_gc_list); in br_multicast_del_mdb_entry()
646 queue_work(system_long_wq, &br->mcast_gc_work); in br_multicast_del_mdb_entry()
652 struct net_bridge *br = mp->br; in br_multicast_group_expired() local
654 spin_lock(&br->multicast_lock); in br_multicast_group_expired()
655 if (hlist_unhashed(&mp->mdb_node) || !netif_running(br->dev) || in br_multicast_group_expired()
665 spin_unlock(&br->multicast_lock); in br_multicast_group_expired()
681 struct net_bridge *br = src->pg->key.port->br; in __br_multicast_del_group_src() local
685 hlist_add_head(&src->mcast_gc.gc_node, &br->mcast_gc_list); in __br_multicast_del_group_src()
686 queue_work(system_long_wq, &br->mcast_gc_work); in __br_multicast_del_group_src()
729 lockdep_assert_held_once(&port->br->multicast_lock); in br_multicast_port_ngroups_inc()
766 lockdep_assert_held_once(&port->br->multicast_lock); in br_multicast_port_ngroups_dec()
808 struct net_bridge *br = pg->key.port->br; in br_multicast_del_pg() local
817 br_mdb_notify(br->dev, mp, pg, RTM_DELMDB); in br_multicast_del_pg()
819 rhashtable_remove_fast(&br->sg_port_tbl, &pg->rhnode, in br_multicast_del_pg()
826 hlist_add_head(&pg->mcast_gc.gc_node, &br->mcast_gc_list); in br_multicast_del_pg()
827 queue_work(system_long_wq, &br->mcast_gc_work); in br_multicast_del_pg()
829 if (!mp->ports && !mp->host_joined && netif_running(br->dev)) in br_multicast_del_pg()
833 static void br_multicast_find_del_pg(struct net_bridge *br, in br_multicast_find_del_pg() argument
840 mp = br_mdb_ip_get(br, &pg->key.addr); in br_multicast_find_del_pg()
845 (p = mlock_dereference(*pp, br)) != NULL; in br_multicast_find_del_pg()
861 struct net_bridge *br = pg->key.port->br; in br_multicast_port_group_expired() local
865 spin_lock(&br->multicast_lock); in br_multicast_port_group_expired()
866 if (!netif_running(br->dev) || timer_pending(&pg->timer) || in br_multicast_port_group_expired()
880 br_multicast_find_del_pg(br, pg); in br_multicast_port_group_expired()
882 struct net_bridge_mdb_entry *mp = br_mdb_ip_get(br, &pg->key.addr); in br_multicast_port_group_expired()
889 br_mdb_notify(br->dev, mp, pg, RTM_NEWMDB); in br_multicast_port_group_expired()
892 spin_unlock(&br->multicast_lock); in br_multicast_port_group_expired()
920 if (br_vlan_get_proto(brmctx->br->dev, &vlan_proto) != 0) in __br_multicast_query_handle_vlan()
949 if (brmctx->multicast_igmp_version == 3) { in br_ip4_multicast_alloc_query()
969 pkt_size > brmctx->br->dev->mtu) in br_ip4_multicast_alloc_query()
972 skb = netdev_alloc_skb_ip_align(brmctx->br->dev, pkt_size); in br_ip4_multicast_alloc_query()
982 ether_addr_copy(eth->h_source, brmctx->br->dev->dev_addr); in br_ip4_multicast_alloc_query()
998 iph->saddr = br_opt_get(brmctx->br, BROPT_MULTICAST_QUERY_USE_IFADDR) ? in br_ip4_multicast_alloc_query()
999 inet_select_addr(brmctx->br->dev, 0, RT_SCOPE_LINK) : 0; in br_ip4_multicast_alloc_query()
1004 ((u8 *)&iph[1])[3] = 0; in br_ip4_multicast_alloc_query()
1023 case 3: in br_ip4_multicast_alloc_query()
1119 pkt_size > brmctx->br->dev->mtu) in br_ip6_multicast_alloc_query()
1122 skb = netdev_alloc_skb_ip_align(brmctx->br->dev, pkt_size); in br_ip6_multicast_alloc_query()
1133 ether_addr_copy(eth->h_source, brmctx->br->dev->dev_addr); in br_ip6_multicast_alloc_query()
1146 if (ipv6_dev_get_saddr(dev_net(brmctx->br->dev), brmctx->br->dev, in br_ip6_multicast_alloc_query()
1149 br_opt_toggle(brmctx->br, BROPT_HAS_IPV6_ADDR, false); in br_ip6_multicast_alloc_query()
1153 br_opt_toggle(brmctx->br, BROPT_HAS_IPV6_ADDR, true); in br_ip6_multicast_alloc_query()
1160 hopopt[3] = 2; /* Length of RA Option */ in br_ip6_multicast_alloc_query()
1278 struct net_bridge_mdb_entry *br_multicast_new_group(struct net_bridge *br, in br_multicast_new_group() argument
1284 mp = br_mdb_ip_get(br, group); in br_multicast_new_group()
1288 if (atomic_read(&br->mdb_hash_tbl.nelems) >= br->hash_max) { in br_multicast_new_group()
1289 trace_br_mdb_full(br->dev, group); in br_multicast_new_group()
1290 br_mc_disabled_update(br->dev, false, NULL); in br_multicast_new_group()
1291 br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false); in br_multicast_new_group()
1299 mp->br = br; in br_multicast_new_group()
1303 err = rhashtable_lookup_insert_fast(&br->mdb_hash_tbl, &mp->rhnode, in br_multicast_new_group()
1309 hlist_add_head_rcu(&mp->mdb_node, &br->mdb_list); in br_multicast_new_group()
1319 struct net_bridge *br = src->br; in br_multicast_group_src_expired() local
1321 spin_lock(&br->multicast_lock); in br_multicast_group_src_expired()
1322 if (hlist_unhashed(&src->node) || !netif_running(br->dev) || in br_multicast_group_src_expired()
1331 br_multicast_find_del_pg(br, pg); in br_multicast_group_src_expired()
1337 spin_unlock(&br->multicast_lock); in br_multicast_group_src_expired()
1391 grp_src->br = pg->key.port->br; in br_multicast_new_group_src()
1436 rhashtable_lookup_insert_fast(&port->br->sg_port_tbl, &p->rhnode, in br_multicast_new_port_group()
1468 rhashtable_remove_fast(&port->br->sg_port_tbl, &p->rhnode, in br_multicast_del_port_group()
1482 br_mdb_notify(mp->br->dev, mp, NULL, RTM_NEWMDB); in br_multicast_host_join()
1500 br_mdb_notify(mp->br->dev, mp, NULL, RTM_DELMDB); in br_multicast_host_leave()
1520 mp = br_multicast_new_group(brmctx->br, group); in __br_multicast_add_group()
1530 (p = mlock_dereference(*pp, brmctx->br)) != NULL; in __br_multicast_add_group()
1547 br_mdb_notify(brmctx->br->dev, mp, p, RTM_NEWMDB); in __br_multicast_add_group()
1568 spin_lock(&brmctx->br->multicast_lock); in br_multicast_add_group()
1573 spin_unlock(&brmctx->br->multicast_lock); in br_multicast_add_group()
1653 struct net_bridge *br = pmctx->port->br; in br_multicast_router_expired() local
1656 spin_lock(&br->multicast_lock); in br_multicast_router_expired()
1665 spin_unlock(&br->multicast_lock); in br_multicast_router_expired()
1702 spin_lock(&brmctx->br->multicast_lock); in br_multicast_local_router_expired()
1709 br_mc_router_state_change(brmctx->br, false); in br_multicast_local_router_expired()
1711 spin_unlock(&brmctx->br->multicast_lock); in br_multicast_local_router_expired()
1735 spin_lock(&brmctx->br->multicast_lock); in br_multicast_querier_expired()
1736 if (!netif_running(brmctx->br->dev) || in br_multicast_querier_expired()
1738 !br_opt_get(brmctx->br, BROPT_MULTICAST_ENABLED)) in br_multicast_querier_expired()
1744 spin_unlock(&brmctx->br->multicast_lock); in br_multicast_querier_expired()
1807 br_multicast_count(brmctx->br, pmctx->port, skb, igmp_type, in __br_multicast_send_query()
1819 br_multicast_count(brmctx->br, NULL, skb, igmp_type, in __br_multicast_send_query()
1859 !br_opt_get(brmctx->br, BROPT_MULTICAST_ENABLED) || in br_multicast_send_query()
1902 struct net_bridge *br = pmctx->port->br; in br_multicast_port_query_expired() local
1905 spin_lock(&br->multicast_lock); in br_multicast_port_query_expired()
1916 spin_unlock(&br->multicast_lock); in br_multicast_port_query_expired()
1941 struct net_bridge *br = pg->key.port->br; in br_multicast_port_group_rexmit() local
1946 spin_lock(&br->multicast_lock); in br_multicast_port_group_rexmit()
1947 if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) || in br_multicast_port_group_rexmit()
1948 !br_opt_get(br, BROPT_MULTICAST_ENABLED)) in br_multicast_port_group_rexmit()
1980 spin_unlock(&br->multicast_lock); in br_multicast_port_group_rexmit()
2031 br_opt_get(port->br, in br_multicast_add_port()
2046 struct net_bridge *br = port->br; in br_multicast_del_port() local
2051 spin_lock_bh(&br->multicast_lock); in br_multicast_del_port()
2053 br_multicast_find_del_pg(br, pg); in br_multicast_del_port()
2054 spin_unlock_bh(&br->multicast_lock); in br_multicast_del_port()
2055 flush_work(&br->mcast_gc_work); in br_multicast_del_port()
2071 struct net_bridge *br = pmctx->port->br; in __br_multicast_enable_port_ctx() local
2075 if (!br_opt_get(br, BROPT_MULTICAST_ENABLED) || in __br_multicast_enable_port_ctx()
2076 !netif_running(br->dev)) in __br_multicast_enable_port_ctx()
2110 struct net_bridge *br = port->br; in br_multicast_enable_port() local
2112 spin_lock_bh(&br->multicast_lock); in br_multicast_enable_port()
2114 spin_unlock_bh(&br->multicast_lock); in br_multicast_enable_port()
2127 br_multicast_find_del_pg(pmctx->port->br, pg); in __br_multicast_disable_port_ctx()
2142 spin_lock_bh(&port->br->multicast_lock); in br_multicast_disable_port()
2144 spin_unlock_bh(&port->br->multicast_lock); in br_multicast_disable_port()
2178 if (!netif_running(brmctx->br->dev) || in __grp_src_query_marked_and_rexmit()
2179 !br_opt_get(brmctx->br, BROPT_MULTICAST_ENABLED)) in __grp_src_query_marked_and_rexmit()
2223 if (!netif_running(brmctx->br->dev) || in __grp_send_query_and_rexmit()
2224 !br_opt_get(brmctx->br, BROPT_MULTICAST_ENABLED)) in __grp_send_query_and_rexmit()
2517 br_multicast_find_del_pg(pg->key.port->br, pg); in br_multicast_toin()
2754 br_multicast_find_del_pg(pg->key.port->br, pg); in br_multicast_block()
2769 struct net_bridge *br __maybe_unused = mp->br; in br_multicast_find_port()
2772 for (pg = mlock_dereference(mp->ports, br); in br_multicast_find_port()
2774 pg = mlock_dereference(pg->next, br)) in br_multicast_find_port()
2848 spin_lock(&brmctx->br->multicast_lock); in br_ip4_multicast_igmp3_report()
2852 mdst = br_mdb_ip4_get(brmctx->br, group, vid); in br_ip4_multicast_igmp3_report()
2894 br_mdb_notify(brmctx->br->dev, mdst, pg, RTM_NEWMDB); in br_ip4_multicast_igmp3_report()
2896 spin_unlock(&brmctx->br->multicast_lock); in br_ip4_multicast_igmp3_report()
2986 spin_lock(&brmctx->br->multicast_lock); in br_ip6_multicast_mld2_report()
2990 mdst = br_mdb_ip6_get(brmctx->br, &grec->grec_mca, vid); in br_ip6_multicast_mld2_report()
3036 br_mdb_notify(brmctx->br->dev, mdst, pg, RTM_NEWMDB); in br_ip6_multicast_mld2_report()
3038 spin_unlock(&brmctx->br->multicast_lock); in br_ip6_multicast_mld2_report()
3087 __br_multicast_get_querier_port(struct net_bridge *br, in __br_multicast_get_querier_port() argument
3097 dev = dev_get_by_index_rcu(dev_net(br->dev), port_ifidx); in __br_multicast_get_querier_port()
3101 if (!p || p->br != br) in __br_multicast_get_querier_port()
3130 if (!br_opt_get(brmctx->br, BROPT_MULTICAST_ENABLED) || in br_multicast_dump_querier_state()
3150 p = __br_multicast_get_querier_port(brmctx->br, &querier); in br_multicast_dump_querier_state()
3173 p = __br_multicast_get_querier_port(brmctx->br, &querier); in br_multicast_dump_querier_state()
3277 * and locked by br->multicast_lock and RCU
3301 br_rtr_notify(pmctx->port->br->dev, pmctx, RTM_NEWMDB); in br_multicast_add_router()
3308 * and locked by br->multicast_lock and RCU
3319 * and locked by br->multicast_lock and RCU
3345 br_mc_router_state_change(brmctx->br, true); in br_multicast_mark_router()
3438 spin_lock(&brmctx->br->multicast_lock); in br_ip4_multicast_query()
3454 (brmctx->multicast_igmp_version == 3 && group && in br_ip4_multicast_query()
3474 mp = br_mdb_ip4_get(brmctx->br, group, vid); in br_ip4_multicast_query()
3487 (p = mlock_dereference(*pp, brmctx->br)) != NULL; in br_ip4_multicast_query()
3498 spin_unlock(&brmctx->br->multicast_lock); in br_ip4_multicast_query()
3521 spin_lock(&brmctx->br->multicast_lock); in br_ip6_multicast_query()
3564 mp = br_mdb_ip6_get(brmctx->br, group, vid); in br_ip6_multicast_query()
3576 (p = mlock_dereference(*pp, brmctx->br)) != NULL; in br_ip6_multicast_query()
3587 spin_unlock(&brmctx->br->multicast_lock); in br_ip6_multicast_query()
3605 spin_lock(&brmctx->br->multicast_lock); in br_multicast_leave_group()
3609 mp = br_mdb_ip_get(brmctx->br, group); in br_multicast_leave_group()
3617 (p = mlock_dereference(*pp, brmctx->br)) != NULL; in br_multicast_leave_group()
3643 for (p = mlock_dereference(mp->ports, brmctx->br); in br_multicast_leave_group()
3645 p = mlock_dereference(p->next, brmctx->br)) { in br_multicast_leave_group()
3675 for (p = mlock_dereference(mp->ports, brmctx->br); in br_multicast_leave_group()
3677 p = mlock_dereference(p->next, brmctx->br)) { in br_multicast_leave_group()
3691 spin_unlock(&brmctx->br->multicast_lock); in br_multicast_leave_group()
3744 static void br_multicast_err_count(const struct net_bridge *br, in br_multicast_err_count() argument
3751 if (!br_opt_get(br, BROPT_MULTICAST_STATS_ENABLED)) in br_multicast_err_count()
3757 stats = br->mcast_stats; in br_multicast_err_count()
3789 spin_lock(&brmctx->br->multicast_lock); in br_multicast_pim()
3791 spin_unlock(&brmctx->br->multicast_lock); in br_multicast_pim()
3802 spin_lock(&brmctx->br->multicast_lock); in br_ip4_multicast_mrd_rcv()
3804 spin_unlock(&brmctx->br->multicast_lock); in br_ip4_multicast_mrd_rcv()
3833 br_multicast_err_count(brmctx->br, p, skb->protocol); in br_multicast_ipv4_rcv()
3859 br_multicast_count(brmctx->br, p, skb, BR_INPUT_SKB_CB(skb)->igmp, in br_multicast_ipv4_rcv()
3873 spin_lock(&brmctx->br->multicast_lock); in br_ip6_multicast_mrd_rcv()
3875 spin_unlock(&brmctx->br->multicast_lock); in br_ip6_multicast_mrd_rcv()
3899 br_multicast_err_count(brmctx->br, p, skb->protocol); in br_multicast_ipv6_rcv()
3926 br_multicast_count(brmctx->br, p, skb, BR_INPUT_SKB_CB(skb)->igmp, in br_multicast_ipv6_rcv()
3943 if (!br_opt_get((*brmctx)->br, BROPT_MULTICAST_ENABLED)) in br_multicast_rcv()
3946 if (br_opt_get((*brmctx)->br, BROPT_MCAST_VLAN_SNOOPING_ENABLED) && vlan) { in br_multicast_rcv()
3984 spin_lock(&brmctx->br->multicast_lock); in br_multicast_query_expired()
3993 spin_unlock(&brmctx->br->multicast_lock); in br_multicast_query_expired()
4018 struct net_bridge *br = container_of(work, struct net_bridge, in br_multicast_gc_work() local
4022 spin_lock_bh(&br->multicast_lock); in br_multicast_gc_work()
4023 hlist_move_list(&br->mcast_gc_list, &deleted_head); in br_multicast_gc_work()
4024 spin_unlock_bh(&br->multicast_lock); in br_multicast_gc_work()
4029 void br_multicast_ctx_init(struct net_bridge *br, in br_multicast_ctx_init() argument
4033 brmctx->br = br; in br_multicast_ctx_init()
4047 seqcount_spinlock_init(&brmctx->ip4_querier.seq, &br->multicast_lock); in br_multicast_ctx_init()
4052 seqcount_spinlock_init(&brmctx->ip6_querier.seq, &br->multicast_lock); in br_multicast_ctx_init()
4080 void br_multicast_init(struct net_bridge *br) in br_multicast_init() argument
4082 br->hash_max = BR_MULTICAST_DEFAULT_HASH_MAX; in br_multicast_init()
4084 br_multicast_ctx_init(br, NULL, &br->multicast_ctx); in br_multicast_init()
4086 br_opt_toggle(br, BROPT_MULTICAST_ENABLED, true); in br_multicast_init()
4087 br_opt_toggle(br, BROPT_HAS_IPV6_ADDR, true); in br_multicast_init()
4089 spin_lock_init(&br->multicast_lock); in br_multicast_init()
4090 INIT_HLIST_HEAD(&br->mdb_list); in br_multicast_init()
4091 INIT_HLIST_HEAD(&br->mcast_gc_list); in br_multicast_init()
4092 INIT_WORK(&br->mcast_gc_work, br_multicast_gc_work); in br_multicast_init()
4095 static void br_ip4_multicast_join_snoopers(struct net_bridge *br) in br_ip4_multicast_join_snoopers() argument
4097 struct in_device *in_dev = in_dev_get(br->dev); in br_ip4_multicast_join_snoopers()
4107 static void br_ip6_multicast_join_snoopers(struct net_bridge *br) in br_ip6_multicast_join_snoopers() argument
4112 ipv6_dev_mc_inc(br->dev, &addr); in br_ip6_multicast_join_snoopers()
4115 static inline void br_ip6_multicast_join_snoopers(struct net_bridge *br) in br_ip6_multicast_join_snoopers() argument
4120 void br_multicast_join_snoopers(struct net_bridge *br) in br_multicast_join_snoopers() argument
4122 br_ip4_multicast_join_snoopers(br); in br_multicast_join_snoopers()
4123 br_ip6_multicast_join_snoopers(br); in br_multicast_join_snoopers()
4126 static void br_ip4_multicast_leave_snoopers(struct net_bridge *br) in br_ip4_multicast_leave_snoopers() argument
4128 struct in_device *in_dev = in_dev_get(br->dev); in br_ip4_multicast_leave_snoopers()
4138 static void br_ip6_multicast_leave_snoopers(struct net_bridge *br) in br_ip6_multicast_leave_snoopers() argument
4143 ipv6_dev_mc_dec(br->dev, &addr); in br_ip6_multicast_leave_snoopers()
4146 static inline void br_ip6_multicast_leave_snoopers(struct net_bridge *br) in br_ip6_multicast_leave_snoopers() argument
4151 void br_multicast_leave_snoopers(struct net_bridge *br) in br_multicast_leave_snoopers() argument
4153 br_ip4_multicast_leave_snoopers(br); in br_multicast_leave_snoopers()
4154 br_ip6_multicast_leave_snoopers(br); in br_multicast_leave_snoopers()
4157 static void __br_multicast_open_query(struct net_bridge *br, in __br_multicast_open_query() argument
4162 if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) in __br_multicast_open_query()
4170 __br_multicast_open_query(brmctx->br, &brmctx->ip4_own_query); in __br_multicast_open()
4172 __br_multicast_open_query(brmctx->br, &brmctx->ip6_own_query); in __br_multicast_open()
4176 void br_multicast_open(struct net_bridge *br) in br_multicast_open() argument
4180 if (br_opt_get(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED)) { in br_multicast_open()
4184 vg = br_vlan_group(br); in br_multicast_open()
4196 __br_multicast_open(&br->multicast_ctx); in br_multicast_open()
4216 struct net_bridge *br; in br_multicast_toggle_one_vlan() local
4226 br = vlan->br; in br_multicast_toggle_one_vlan()
4233 spin_lock_bh(&br->multicast_lock); in br_multicast_toggle_one_vlan()
4235 spin_unlock_bh(&br->multicast_lock); in br_multicast_toggle_one_vlan()
4248 br = vlan->port->br; in br_multicast_toggle_one_vlan()
4249 spin_lock_bh(&br->multicast_lock); in br_multicast_toggle_one_vlan()
4255 spin_unlock_bh(&br->multicast_lock); in br_multicast_toggle_one_vlan()
4266 list_for_each_entry(p, &vlan->br->port_list, list) { in br_multicast_toggle_vlan()
4279 int br_multicast_toggle_vlan_snooping(struct net_bridge *br, bool on, in br_multicast_toggle_vlan_snooping() argument
4286 if (br_opt_get(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED) == on) in br_multicast_toggle_vlan_snooping()
4289 if (on && !br_opt_get(br, BROPT_VLAN_ENABLED)) { in br_multicast_toggle_vlan_snooping()
4294 vg = br_vlan_group(br); in br_multicast_toggle_vlan_snooping()
4298 br_opt_toggle(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED, on); in br_multicast_toggle_vlan_snooping()
4302 __br_multicast_stop(&br->multicast_ctx); in br_multicast_toggle_vlan_snooping()
4304 __br_multicast_open(&br->multicast_ctx); in br_multicast_toggle_vlan_snooping()
4305 list_for_each_entry(p, &br->port_list, list) { in br_multicast_toggle_vlan_snooping()
4334 void br_multicast_stop(struct net_bridge *br) in br_multicast_stop() argument
4338 if (br_opt_get(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED)) { in br_multicast_stop()
4342 vg = br_vlan_group(br); in br_multicast_stop()
4354 __br_multicast_stop(&br->multicast_ctx); in br_multicast_stop()
4358 void br_multicast_dev_del(struct net_bridge *br) in br_multicast_dev_del() argument
4364 spin_lock_bh(&br->multicast_lock); in br_multicast_dev_del()
4365 hlist_for_each_entry_safe(mp, tmp, &br->mdb_list, mdb_node) in br_multicast_dev_del()
4367 hlist_move_list(&br->mcast_gc_list, &deleted_head); in br_multicast_dev_del()
4368 spin_unlock_bh(&br->multicast_lock); in br_multicast_dev_del()
4370 br_multicast_ctx_deinit(&br->multicast_ctx); in br_multicast_dev_del()
4372 cancel_work_sync(&br->mcast_gc_work); in br_multicast_dev_del()
4381 spin_lock_bh(&brmctx->br->multicast_lock); in br_multicast_set_router()
4386 br_mc_router_state_change(brmctx->br, val == MDB_RTR_TYPE_PERM); in br_multicast_set_router()
4396 br_mc_router_state_change(brmctx->br, false); in br_multicast_set_router()
4402 spin_unlock_bh(&brmctx->br->multicast_lock); in br_multicast_set_router()
4423 br_rtr_notify(pmctx->port->br->dev, pmctx, RTM_DELMDB); in br_multicast_rport_del_notify()
4440 spin_lock_bh(&brmctx->br->multicast_lock); in br_multicast_set_port_router()
4490 spin_unlock_bh(&brmctx->br->multicast_lock); in br_multicast_set_port_router()
4516 __br_multicast_open_query(brmctx->br, query); in br_multicast_start_querier()
4519 list_for_each_entry_rcu(port, &brmctx->br->port_list, list) { in br_multicast_start_querier()
4558 int br_multicast_toggle(struct net_bridge *br, unsigned long val, in br_multicast_toggle() argument
4565 spin_lock_bh(&br->multicast_lock); in br_multicast_toggle()
4566 if (!!br_opt_get(br, BROPT_MULTICAST_ENABLED) == !!val) in br_multicast_toggle()
4569 err = br_mc_disabled_update(br->dev, val, extack); in br_multicast_toggle()
4575 br_opt_toggle(br, BROPT_MULTICAST_ENABLED, !!val); in br_multicast_toggle()
4576 if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) { in br_multicast_toggle()
4581 if (!netif_running(br->dev)) in br_multicast_toggle()
4584 br_multicast_open(br); in br_multicast_toggle()
4585 list_for_each_entry(port, &br->port_list, list) in br_multicast_toggle()
4591 spin_unlock_bh(&br->multicast_lock); in br_multicast_toggle()
4606 if (br_opt_get(br, BROPT_MULTICAST_ENABLED)) in br_multicast_toggle()
4607 br_multicast_join_snoopers(br); in br_multicast_toggle()
4609 br_multicast_leave_snoopers(br); in br_multicast_toggle()
4617 struct net_bridge *br = netdev_priv(dev); in br_multicast_enabled() local
4619 return !!br_opt_get(br, BROPT_MULTICAST_ENABLED); in br_multicast_enabled()
4625 struct net_bridge *br = netdev_priv(dev); in br_multicast_router() local
4628 spin_lock_bh(&br->multicast_lock); in br_multicast_router()
4629 is_router = br_multicast_is_router(&br->multicast_ctx, NULL); in br_multicast_router()
4630 spin_unlock_bh(&br->multicast_lock); in br_multicast_router()
4641 spin_lock_bh(&brmctx->br->multicast_lock); in br_multicast_set_querier()
4666 spin_unlock_bh(&brmctx->br->multicast_lock); in br_multicast_set_querier()
4674 /* Currently we support only version 2 and 3 */ in br_multicast_set_igmp_version()
4677 case 3: in br_multicast_set_igmp_version()
4683 spin_lock_bh(&brmctx->br->multicast_lock); in br_multicast_set_igmp_version()
4685 spin_unlock_bh(&brmctx->br->multicast_lock); in br_multicast_set_igmp_version()
4703 spin_lock_bh(&brmctx->br->multicast_lock); in br_multicast_set_mld_version()
4705 spin_unlock_bh(&brmctx->br->multicast_lock); in br_multicast_set_mld_version()
4717 br_info(brmctx->br, in br_multicast_set_query_intvl()
4733 br_info(brmctx->br, in br_multicast_set_startup_query_intvl()
4763 struct net_bridge *br; in br_multicast_list_adjacent() local
4774 if (!port || !port->br) in br_multicast_list_adjacent()
4777 br = port->br; in br_multicast_list_adjacent()
4779 list_for_each_entry_rcu(port, &br->port_list, list) { in br_multicast_list_adjacent()
4811 struct net_bridge *br; in br_multicast_has_querier_anywhere() local
4821 if (!port || !port->br) in br_multicast_has_querier_anywhere()
4824 br = port->br; in br_multicast_has_querier_anywhere()
4829 ret = br_multicast_querier_exists(&br->multicast_ctx, ð, NULL); in br_multicast_has_querier_anywhere()
4849 struct net_bridge *br; in br_multicast_has_querier_adjacent() local
4859 if (!port || !port->br) in br_multicast_has_querier_adjacent()
4862 br = port->br; in br_multicast_has_querier_adjacent()
4863 brmctx = &br->multicast_ctx; in br_multicast_has_querier_adjacent()
4912 brmctx = &port->br->multicast_ctx; in br_multicast_has_router_adjacent()
5020 void br_multicast_count(struct net_bridge *br, in br_multicast_count() argument
5027 if (!type || !br_opt_get(br, BROPT_MULTICAST_STATS_ENABLED)) in br_multicast_count()
5033 stats = br->mcast_stats; in br_multicast_count()
5040 int br_multicast_init_stats(struct net_bridge *br) in br_multicast_init_stats() argument
5042 br->mcast_stats = netdev_alloc_pcpu_stats(struct bridge_mcast_stats); in br_multicast_init_stats()
5043 if (!br->mcast_stats) in br_multicast_init_stats()
5049 void br_multicast_uninit_stats(struct net_bridge *br) in br_multicast_uninit_stats() argument
5051 free_percpu(br->mcast_stats); in br_multicast_uninit_stats()
5061 void br_multicast_get_stats(const struct net_bridge *br, in br_multicast_get_stats() argument
5073 stats = br->mcast_stats; in br_multicast_get_stats()
5107 int br_mdb_hash_init(struct net_bridge *br) in br_mdb_hash_init() argument
5111 err = rhashtable_init(&br->sg_port_tbl, &br_sg_port_rht_params); in br_mdb_hash_init()
5115 err = rhashtable_init(&br->mdb_hash_tbl, &br_mdb_rht_params); in br_mdb_hash_init()
5117 rhashtable_destroy(&br->sg_port_tbl); in br_mdb_hash_init()
5124 void br_mdb_hash_fini(struct net_bridge *br) in br_mdb_hash_fini() argument
5126 rhashtable_destroy(&br->sg_port_tbl); in br_mdb_hash_fini()
5127 rhashtable_destroy(&br->mdb_hash_tbl); in br_mdb_hash_fini()