linux-yocto/net/bridge
Yong Wang c6d16eab12 net: bridge: mcast: re-implement br_multicast_{enable, disable}_port functions
[ Upstream commit 4b30ae9adb ]

When a bridge port STP state is changed from BLOCKING/DISABLED to
FORWARDING, the port's igmp query timer will NOT re-arm itself if the
bridge has been configured as per-VLAN multicast snooping.

Solve this by choosing the correct multicast context(s) to enable/disable
port multicast based on whether per-VLAN multicast snooping is enabled or
not, i.e. using per-{port, VLAN} context in case of per-VLAN multicast
snooping by re-implementing br_multicast_enable_port() and
br_multicast_disable_port() functions.

Before the patch, the IGMP query does not happen in the last step of the
following test sequence, i.e. no growth for tx counter:
 # ip link add name br1 up type bridge vlan_filtering 1 mcast_snooping 1 mcast_vlan_snooping 1 mcast_querier 1 mcast_stats_enabled 1
 # bridge vlan global set vid 1 dev br1 mcast_snooping 1 mcast_querier 1 mcast_query_interval 100 mcast_startup_query_count 0
 # ip link add name swp1 up master br1 type dummy
 # bridge link set dev swp1 state 0
 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]'
1
 # sleep 1
 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]'
1
 # bridge link set dev swp1 state 3
 # sleep 2
 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]'
1

After the patch, the IGMP query happens in the last step of the test:
 # ip link add name br1 up type bridge vlan_filtering 1 mcast_snooping 1 mcast_vlan_snooping 1 mcast_querier 1 mcast_stats_enabled 1
 # bridge vlan global set vid 1 dev br1 mcast_snooping 1 mcast_querier 1 mcast_query_interval 100 mcast_startup_query_count 0
 # ip link add name swp1 up master br1 type dummy
 # bridge link set dev swp1 state 0
 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]'
1
 # sleep 1
 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]'
1
 # bridge link set dev swp1 state 3
 # sleep 2
 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]'
3

Signed-off-by: Yong Wang <yongwang@nvidia.com>
Reviewed-by: Andy Roulin <aroulin@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:07:35 +01:00
..
netfilter netfilter: bridge: Move specific fragmented packet to slow_path instead of dropping it 2025-06-27 11:07:10 +01:00
br_arp_nd_proxy.c neighbour: annotate lockless accesses to n->nud_state 2023-10-10 22:00:42 +02:00
br_cfm_netlink.c bridge: cfm: fix enum typo in br_cc_ccm_tx_parse 2024-02-05 20:12:54 +00:00
br_cfm.c
br_device.c net: bridge: xmit: make sure we have at least eth header len bytes 2024-06-12 11:03:32 +02:00
br_fdb.c net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN 2024-09-12 11:10:22 +02:00
br_forward.c net: bridge: mst: Check vlan state for egress decision 2024-08-03 08:49:09 +02:00
br_if.c net: bridge: keep ports without IFF_UNICAST_FLT in BR_PROMISC mode 2023-07-19 16:22:04 +02:00
br_input.c netfilter: br_netfilter: skip conntrack input hook for promisc packets 2024-04-27 17:07:07 +02:00
br_ioctl.c
br_mdb.c
br_mrp_netlink.c
br_mrp_switchdev.c
br_mrp.c
br_mst.c net: bridge: mcast: update multicast contex when vlan state is changed 2025-06-27 11:07:34 +01:00
br_multicast_eht.c
br_multicast.c net: bridge: mcast: re-implement br_multicast_{enable, disable}_port functions 2025-06-27 11:07:35 +01:00
br_netfilter_hooks.c ipv4: Convert ip_route_input() to dscp_t. 2025-03-07 16:56:44 +01:00
br_netfilter_ipv6.c netfilter: bridge: replace physindev with physinif in nf_bridge_info 2024-01-25 15:27:51 -08:00
br_netlink_tunnel.c
br_netlink.c net-sysfs: convert dev->operstate reads to lockless ones 2024-05-17 11:56:13 +02:00
br_nf_core.c bridge: netfilter: Fix forwarding of fragmented packets 2025-06-04 14:40:19 +02:00
br_private_cfm.h
br_private_mcast_eht.h
br_private_mrp.h
br_private_stp.h
br_private_tunnel.h
br_private.h net: bridge: mcast: update multicast contex when vlan state is changed 2025-06-27 11:07:34 +01:00
br_stp_bpdu.c
br_stp_if.c Revert "bridge: Add extack warning when enabling STP in netns." 2023-09-13 09:42:20 +02:00
br_stp_timer.c
br_stp.c
br_switchdev.c net: bridge: switchdev: Ensure deferred event delivery on unoffload 2024-03-01 13:26:36 +01:00
br_sysfs_br.c
br_sysfs_if.c
br_vlan_options.c
br_vlan_tunnel.c
br_vlan.c net: bridge: switchdev: do not notify new brentries as changed 2025-04-25 10:43:50 +02:00
br.c
Kconfig
Makefile