kernel: bump 5.4 to 5.4.188
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 781-v5.18-1-net-dsa-Move-VLAN-filtering-syncing-out-of-dsa_switc.patch
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 --- a/net/dsa/switch.c
26 +++ b/net/dsa/switch.c
27 @@ -65,19 +65,12 @@ static int dsa_switch_bridge_join(struct
28 return 0;
29 }
30
31 -static int dsa_switch_bridge_leave(struct dsa_switch *ds,
32 - struct dsa_notifier_bridge_info *info)
33 +static int dsa_switch_sync_vlan_filtering(struct dsa_switch *ds,
34 + struct dsa_notifier_bridge_info *info)
35 {
36 bool unset_vlan_filtering = br_vlan_enabled(info->br);
37 int err, i;
38
39 - if (ds->index == info->sw_index && ds->ops->port_bridge_leave)
40 - ds->ops->port_bridge_leave(ds, info->port, info->br);
41 -
42 - if (ds->index != info->sw_index && ds->ops->crosschip_bridge_leave)
43 - ds->ops->crosschip_bridge_leave(ds, info->sw_index, info->port,
44 - info->br);
45 -
46 /* If the bridge was vlan_filtering, the bridge core doesn't trigger an
47 * event for changing vlan_filtering setting upon slave ports leaving
48 * it. That is a good thing, because that lets us handle it and also
49 @@ -103,6 +96,26 @@ static int dsa_switch_bridge_leave(struc
50 if (err && err != EOPNOTSUPP)
51 return err;
52 }
53 +
54 + return 0;
55 +}
56 +
57 +static int dsa_switch_bridge_leave(struct dsa_switch *ds,
58 + struct dsa_notifier_bridge_info *info)
59 +{
60 + int err;
61 +
62 + if (ds->index == info->sw_index && ds->ops->port_bridge_leave)
63 + ds->ops->port_bridge_leave(ds, info->port, info->br);
64 +
65 + if (ds->index != info->sw_index && ds->ops->crosschip_bridge_leave)
66 + ds->ops->crosschip_bridge_leave(ds, info->sw_index, info->port,
67 + info->br);
68 +
69 + err = dsa_switch_sync_vlan_filtering(ds, info);
70 + if (err)
71 + return err;
72 +
73 return 0;
74 }
75