8c2aa32ec8e988b206e8cf345f66b8ab222577be
[openwrt/staging/dedeckeh.git] / target / linux / generic / backport-5.10 / 773-v5.18-1-net-dsa-Move-VLAN-filtering-syncing-out-of-dsa_switc.patch
1 From 7164a8cde4b42f76474088ccaf53f1e463d4e2f6 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.10 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 | 39 ++++++++++++++++++++++++++-------------
23 1 file changed, 26 insertions(+), 13 deletions(-)
24
25 diff --git a/net/dsa/switch.c b/net/dsa/switch.c
26 index a44035872cff..659fd979cc0a 100644
27 --- a/net/dsa/switch.c
28 +++ b/net/dsa/switch.c
29 @@ -104,23 +104,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 - struct dsa_switch_tree *dst = ds->dst;
40 int err, i;
41
42 - if (dst->index == info->tree_index && ds->index == info->sw_index &&
43 - ds->ops->port_bridge_leave)
44 - ds->ops->port_bridge_leave(ds, info->port, info->br);
45 -
46 - if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
47 - ds->ops->crosschip_bridge_leave)
48 - ds->ops->crosschip_bridge_leave(ds, info->tree_index,
49 - info->sw_index, info->port,
50 - info->br);
51 -
52 /* If the bridge was vlan_filtering, the bridge core doesn't trigger an
53 * event for changing vlan_filtering setting upon slave ports leaving
54 * it. That is a good thing, because that lets us handle it and also
55 @@ -153,6 +142,30 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
56 if (err && err != EOPNOTSUPP)
57 return err;
58 }
59 +
60 + return 0;
61 +}
62 +
63 +static int dsa_switch_bridge_leave(struct dsa_switch *ds,
64 + struct dsa_notifier_bridge_info *info)
65 +{
66 + struct dsa_switch_tree *dst = ds->dst;
67 + int err;
68 +
69 + if (dst->index == info->tree_index && ds->index == info->sw_index &&
70 + ds->ops->port_bridge_leave)
71 + ds->ops->port_bridge_leave(ds, info->port, info->br);
72 +
73 + if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
74 + ds->ops->crosschip_bridge_leave)
75 + ds->ops->crosschip_bridge_leave(ds, info->tree_index,
76 + info->sw_index, info->port,
77 + info->br);
78 +
79 + err = dsa_switch_sync_vlan_filtering(ds, info);
80 + if (err)
81 + return err;
82 +
83 return 0;
84 }
85
86 --
87 2.34.1
88