linux-stable/net/dsa
Vladimir Oltean 03cbb87054 net: dsa: fix switchdev objects on bridge master mistakenly being applied on ports
Tobias reports that after the blamed patch, VLAN objects being added to
a bridge device are being added to all slave ports instead (swp2, swp3).

ip link add br0 type bridge vlan_filtering 1
ip link set swp2 master br0
ip link set swp3 master br0
bridge vlan add dev br0 vid 100 self

This is because the fix was too broad: we made dsa_port_offloads_netdev
say "yes, I offload the br0 bridge" for all slave ports, but we didn't
add the checks whether the switchdev object was in fact meant for the
physical port or for the bridge itself. So we are reacting on events in
a way in which we shouldn't.

The reason why the fix was too broad is because the question itself,
"does this DSA port offload this netdev", was too broad in the first
place. The solution is to disambiguate the question and separate it into
two different functions, one to be called for each switchdev attribute /
object that has an orig_dev == net_bridge (dsa_port_offloads_bridge),
and the other for orig_dev == net_bridge_port (*_offloads_bridge_port).

In the case of VLAN objects on the bridge interface, this solves the
problem because we know that VLAN objects are per bridge port and not
per bridge. And when orig_dev is equal to the net_bridge, we offload it
as a bridge, but not as a bridge port; that's how we are able to skip
reacting on those events. Note that this is compatible with future plans
to have explicit offloading of VLAN objects on the bridge interface as a
bridge port (in DSA, this signifies that we should add that VLAN towards
the CPU port).

Fixes: 99b8202b17 ("net: dsa: fix SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING getting ignored")
Reported-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Tobias Waldekranz <tobias@waldekranz.com>
Tested-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-03-08 11:59:00 -08:00
..
Kconfig net: dsa: tag_ocelot_8021q: fix driver dependency 2021-02-26 15:29:53 -08:00
Makefile net: dsa: add a second tagger for Ocelot switches based on tag_8021q 2021-01-29 21:25:27 -08:00
dsa.c net: dsa: allow changing the tag protocol via the "tagging" device attribute 2021-01-29 21:24:39 -08:00
dsa2.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-02-10 13:30:12 -08:00
dsa_priv.h net: dsa: fix switchdev objects on bridge master mistakenly being applied on ports 2021-03-08 11:59:00 -08:00
master.c net: dsa: allow changing the tag protocol via the "tagging" device attribute 2021-01-29 21:24:39 -08:00
port.c net: dsa: add MRP support 2021-02-16 14:47:46 -08:00
slave.c net: dsa: fix switchdev objects on bridge master mistakenly being applied on ports 2021-03-08 11:59:00 -08:00
switch.c net: dsa: add MRP support 2021-02-16 14:47:46 -08:00
tag_8021q.c net: dsa: tag_8021q: add helpers to deduce whether a VLAN ID is RX or TX VLAN 2021-01-29 21:24:30 -08:00
tag_ar9331.c net: dsa: tag_ar9331: let DSA core deal with TX reallocation 2020-11-02 17:41:17 -08:00
tag_brcm.c net: dsa: move the Broadcom tag information in a separate header file 2021-01-07 15:42:07 -08:00
tag_dsa.c net: dsa: tag_dsa: Support reception of packets from LAG devices 2021-01-14 17:11:56 -08:00
tag_gswip.c net: dsa: tag_gswip: let DSA core deal with TX reallocation 2020-11-02 17:41:16 -08:00
tag_hellcreek.c net: dsa: tag_hellcreek: Cleanup includes 2020-11-23 16:57:21 -08:00
tag_ksz.c net: dsa: tag_ksz: don't allocate additional memory for padding/tagging 2020-11-02 17:41:16 -08:00
tag_lan9303.c net: dsa: tag_lan9303: let DSA core deal with TX reallocation 2020-11-02 17:41:16 -08:00
tag_mtk.c net: dsa: tag_mtk: fix 802.1ad VLAN egress 2021-03-01 15:29:43 -08:00
tag_ocelot.c net: dsa: felix: Add support for MRP 2021-02-16 14:47:46 -08:00
tag_ocelot_8021q.c net: dsa: tag_ocelot_8021q: add support for PTP timestamping 2021-02-14 17:31:44 -08:00
tag_qca.c net: dsa: tag_qca: let DSA core deal with TX reallocation 2020-11-02 17:41:16 -08:00
tag_rtl4_a.c net: dsa: tag_rtl4_a: fix egress tags 2021-03-01 13:09:55 -08:00
tag_sja1105.c net: dsa: tag_sja1105: use a custom flow dissector procedure 2020-09-26 14:17:59 -07:00
tag_trailer.c net: dsa: trailer: don't allocate additional memory for padding/tagging 2020-11-02 17:41:16 -08:00
tag_xrs700x.c net: dsa: xrs700x: add HSR offloading support 2021-02-11 13:24:45 -08:00