bc8014b772f8d626e21f741da3b23838222fa85e
[openwrt/staging/blogic.git] /
1 From 07c6f9805f12f1bb538ef165a092b300350384aa Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Wed, 26 Feb 2020 17:14:21 +0000
4 Subject: [PATCH] net: switchdev: do not propagate bridge updates across
5 bridges
6
7 When configuring a tree of independent bridges, propagating changes
8 from the upper bridge across a bridge master to the lower bridge
9 ports brings surprises.
10
11 For example, a lower bridge may have vlan filtering enabled. It
12 may have a vlan interface attached to the bridge master, which may
13 then be incorporated into another bridge. As soon as the lower
14 bridge vlan interface is attached to the upper bridge, the lower
15 bridge has vlan filtering disabled.
16
17 This occurs because switchdev recursively applies its changes to
18 all lower devices no matter what.
19
20 Reviewed-by: Ido Schimmel <idosch@mellanox.com>
21 Tested-by: Ido Schimmel <idosch@mellanox.com>
22 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
23 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
24 Signed-off-by: David S. Miller <davem@davemloft.net>
25 ---
26 net/switchdev/switchdev.c | 9 +++++++++
27 1 file changed, 9 insertions(+)
28
29 --- a/net/switchdev/switchdev.c
30 +++ b/net/switchdev/switchdev.c
31 @@ -476,6 +476,9 @@ static int __switchdev_handle_port_obj_a
32 * necessary to go through this helper.
33 */
34 netdev_for_each_lower_dev(dev, lower_dev, iter) {
35 + if (netif_is_bridge_master(lower_dev))
36 + continue;
37 +
38 err = __switchdev_handle_port_obj_add(lower_dev, port_obj_info,
39 check_cb, add_cb);
40 if (err && err != -EOPNOTSUPP)
41 @@ -528,6 +531,9 @@ static int __switchdev_handle_port_obj_d
42 * necessary to go through this helper.
43 */
44 netdev_for_each_lower_dev(dev, lower_dev, iter) {
45 + if (netif_is_bridge_master(lower_dev))
46 + continue;
47 +
48 err = __switchdev_handle_port_obj_del(lower_dev, port_obj_info,
49 check_cb, del_cb);
50 if (err && err != -EOPNOTSUPP)
51 @@ -579,6 +585,9 @@ static int __switchdev_handle_port_attr_
52 * necessary to go through this helper.
53 */
54 netdev_for_each_lower_dev(dev, lower_dev, iter) {
55 + if (netif_is_bridge_master(lower_dev))
56 + continue;
57 +
58 err = __switchdev_handle_port_attr_set(lower_dev, port_attr_info,
59 check_cb, set_cb);
60 if (err && err != -EOPNOTSUPP)