c36b9e6a904d2a64aec8248dcf654cc143af4a9a
[openwrt/staging/981213.git] /
1 From 381a730182f1d174e1950cd4e63e885b1c302051 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: net: dsa: Move VLAN filtering syncing out of dsa_switch_bridge_leave
5
6 Most of dsa_switch_bridge_leave was, in fact, dealing with the syncing
7 of VLAN filtering for switches on which that is a global
8 setting. Separate the two phases to prepare for the cross-chip related
9 bugfix in the following commit.
10
11 Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
12 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ---
15 net/dsa/switch.c | 38 +++++++++++++++++++++++++-------------
16 1 file changed, 25 insertions(+), 13 deletions(-)
17
18 diff --git a/net/dsa/switch.c b/net/dsa/switch.c
19 index e3c7d2627a619..9f9b70d6070a3 100644
20 --- a/net/dsa/switch.c
21 +++ b/net/dsa/switch.c
22 @@ -113,25 +113,14 @@ static int dsa_switch_bridge_join(struct dsa_switch *ds,
23 return dsa_tag_8021q_bridge_join(ds, info);
24 }
25
26 -static int dsa_switch_bridge_leave(struct dsa_switch *ds,
27 - struct dsa_notifier_bridge_info *info)
28 +static int dsa_switch_sync_vlan_filtering(struct dsa_switch *ds,
29 + struct dsa_notifier_bridge_info *info)
30 {
31 - struct dsa_switch_tree *dst = ds->dst;
32 struct netlink_ext_ack extack = {0};
33 bool change_vlan_filtering = false;
34 bool vlan_filtering;
35 int err, port;
36
37 - if (dst->index == info->tree_index && ds->index == info->sw_index &&
38 - ds->ops->port_bridge_leave)
39 - ds->ops->port_bridge_leave(ds, info->port, info->br);
40 -
41 - if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
42 - ds->ops->crosschip_bridge_leave)
43 - ds->ops->crosschip_bridge_leave(ds, info->tree_index,
44 - info->sw_index, info->port,
45 - info->br);
46 -
47 if (ds->needs_standalone_vlan_filtering && !br_vlan_enabled(info->br)) {
48 change_vlan_filtering = true;
49 vlan_filtering = true;
50 @@ -172,6 +161,29 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
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 + struct dsa_switch_tree *dst = ds->dst;
61 + int err;
62 +
63 + if (dst->index == info->tree_index && ds->index == info->sw_index &&
64 + ds->ops->port_bridge_leave)
65 + ds->ops->port_bridge_leave(ds, info->port, info->br);
66 +
67 + if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
68 + ds->ops->crosschip_bridge_leave)
69 + ds->ops->crosschip_bridge_leave(ds, info->tree_index,
70 + info->sw_index, info->port,
71 + info->br);
72 +
73 + err = dsa_switch_sync_vlan_filtering(ds, info);
74 + if (err)
75 + return err;
76 +
77 return dsa_tag_8021q_bridge_leave(ds, info);
78 }
79
80 --
81 cgit