e710ed591b8ee151bca0a31f445fbeb3e596ca42
[openwrt/staging/rmilecki.git] /
1 From dee0f71c39afdaa30af7b94af420ca1d5c0f0349 Mon Sep 17 00:00:00 2001
2 From: Tobias Waldekranz <tobias@waldekranz.com>
3 Date: Mon, 24 Jan 2022 22:09:43 +0100
4 Subject: [PATCH 5.4 1/2] net: dsa: Move VLAN filtering syncing out of
5 dsa_switch_bridge_leave
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 commit 381a730182f1d174e1950cd4e63e885b1c302051 upstream.
11
12 Most of dsa_switch_bridge_leave was, in fact, dealing with the syncing
13 of VLAN filtering for switches on which that is a global
14 setting. Separate the two phases to prepare for the cross-chip related
15 bugfix in the following commit.
16
17 Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
18 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
20 Signed-off-by: Marek BehĂșn <kabel@kernel.org>
21 ---
22 net/dsa/switch.c | 31 ++++++++++++++++++++++---------
23 1 file changed, 22 insertions(+), 9 deletions(-)
24
25 diff --git a/net/dsa/switch.c b/net/dsa/switch.c
26 index 6a9607518823..dd71e3301b27 100644
27 --- a/net/dsa/switch.c
28 +++ b/net/dsa/switch.c
29 @@ -65,19 +65,12 @@ static int dsa_switch_bridge_join(struct dsa_switch *ds,
30 return 0;
31 }
32
33 -static int dsa_switch_bridge_leave(struct dsa_switch *ds,
34 - struct dsa_notifier_bridge_info *info)
35 +static int dsa_switch_sync_vlan_filtering(struct dsa_switch *ds,
36 + struct dsa_notifier_bridge_info *info)
37 {
38 bool unset_vlan_filtering = br_vlan_enabled(info->br);
39 int err, i;
40
41 - if (ds->index == info->sw_index && ds->ops->port_bridge_leave)
42 - ds->ops->port_bridge_leave(ds, info->port, info->br);
43 -
44 - if (ds->index != info->sw_index && ds->ops->crosschip_bridge_leave)
45 - ds->ops->crosschip_bridge_leave(ds, info->sw_index, info->port,
46 - info->br);
47 -
48 /* If the bridge was vlan_filtering, the bridge core doesn't trigger an
49 * event for changing vlan_filtering setting upon slave ports leaving
50 * it. That is a good thing, because that lets us handle it and also
51 @@ -103,6 +96,26 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
52 if (err && err != EOPNOTSUPP)
53 return err;
54 }
55 +
56 + return 0;
57 +}
58 +
59 +static int dsa_switch_bridge_leave(struct dsa_switch *ds,
60 + struct dsa_notifier_bridge_info *info)
61 +{
62 + int err;
63 +
64 + if (ds->index == info->sw_index && ds->ops->port_bridge_leave)
65 + ds->ops->port_bridge_leave(ds, info->port, info->br);
66 +
67 + if (ds->index != info->sw_index && ds->ops->crosschip_bridge_leave)
68 + ds->ops->crosschip_bridge_leave(ds, info->sw_index, info->port,
69 + info->br);
70 +
71 + err = dsa_switch_sync_vlan_filtering(ds, info);
72 + if (err)
73 + return err;
74 +
75 return 0;
76 }
77
78 --
79 2.34.1
80