]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: only unset VLAN filtering when last port leaves last VLAN-aware bridge
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 24 Mar 2021 09:56:39 +0000 (11:56 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Mar 2021 23:48:45 +0000 (16:48 -0700)
commitdef4aac71f5aef662ef42d475c41c5bae73323cf
tree822b30f5466cbbeed5479139e081cebc8f10b198
parentb1286a0cfffc86bc57b5e8320f125fb3a923e420
net: dsa: only unset VLAN filtering when last port leaves last VLAN-aware bridge

DSA is aware of switches with global VLAN filtering since the blamed
commit, but it makes a bad decision when multiple bridges are spanning
the same switch:

ip link add br0 type bridge vlan_filtering 1
ip link add br1 type bridge vlan_filtering 1
ip link set swp2 master br0
ip link set swp3 master br0
ip link set swp4 master br1
ip link set swp5 master br1
ip link set swp5 nomaster
ip link set swp4 nomaster
[138665.939930] sja1105 spi0.1: port 3: dsa_core: VLAN filtering is a global setting
[138665.947514] DSA: failed to notify DSA_NOTIFIER_BRIDGE_LEAVE

When all ports leave br1, DSA blindly attempts to disable VLAN filtering
on the switch, ignoring the fact that br0 still exists and is VLAN-aware
too. It fails while doing that.

This patch checks whether any port exists at all and is under a
VLAN-aware bridge.

Fixes: 53bafe0bd42f ("net: dsa: Unset vlan_filtering when ports leave the bridge")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/switch.c