linux-yocto/net/bridge
Yong Wang 410a033bfa 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:05:32 +01:00
..
netfilter netfilter: bridge: Move specific fragmented packet to slow_path instead of dropping it 2025-06-27 11:05:12 +01:00
br_arp_nd_proxy.c
br_cfm_netlink.c bridge: cfm: fix enum typo in br_cc_ccm_tx_parse 2024-02-23 08:54:45 +01:00
br_cfm.c
br_device.c net: bridge: xmit: make sure we have at least eth header len bytes 2024-11-14 13:13:40 +01:00
br_fdb.c net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN 2024-09-12 11:07:47 +02:00
br_forward.c net: bridge: fix corrupted ethernet header on multicast-to-unicast 2024-05-17 11:50:58 +02:00
br_if.c net: bridge: keep ports without IFF_UNICAST_FLT in BR_PROMISC mode 2023-07-23 13:47:29 +02:00
br_input.c netfilter: br_netfilter: skip conntrack input hook for promisc packets 2024-04-27 17:05:24 +02:00
br_ioctl.c
br_mdb.c
br_mrp_netlink.c
br_mrp_switchdev.c
br_mrp.c
br_multicast_eht.c
br_multicast.c net: bridge: mcast: re-implement br_multicast_{enable, disable}_port functions 2025-06-27 11:05:32 +01:00
br_netfilter_hooks.c netfilter: br_netfilter: fix panic with metadata_dst skb 2024-10-17 15:11:54 +02:00
br_netfilter_ipv6.c
br_netlink_tunnel.c
br_netlink.c bridge/br_netlink.c: no need to return void function 2024-05-02 16:24:45 +02:00
br_nf_core.c bridge: netfilter: Fix forwarding of fragmented packets 2025-06-04 14:38:05 +02:00
br_private_cfm.h
br_private_mcast_eht.h
br_private_mrp.h
br_private_stp.h
br_private_tunnel.h bridge: always declare tunnel functions 2023-05-24 17:36:52 +01:00
br_private.h bridge: netfilter: Fix forwarding of fragmented packets 2025-06-04 14:38:05 +02:00
br_stp_bpdu.c
br_stp_if.c bridge: Add extack warning when enabling STP in netns. 2023-07-27 08:46:59 +02:00
br_stp_timer.c
br_stp.c
br_switchdev.c
br_sysfs_br.c
br_sysfs_if.c
br_vlan_options.c
br_vlan_tunnel.c
br_vlan.c bridge: switchdev: Fix memory leaks when changing VLAN protocol 2022-11-26 09:24:40 +01:00
br.c
Kconfig
Makefile