44093eab95b36dcaaa6ca8dde75b25cc0d48c329
[openwrt/staging/xback.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 --- a/net/dsa/switch.c
19 +++ b/net/dsa/switch.c
20 @@ -113,25 +113,14 @@ static int dsa_switch_bridge_join(struct
21 return dsa_tag_8021q_bridge_join(ds, info);
22 }
23
24 -static int dsa_switch_bridge_leave(struct dsa_switch *ds,
25 - struct dsa_notifier_bridge_info *info)
26 +static int dsa_switch_sync_vlan_filtering(struct dsa_switch *ds,
27 + struct dsa_notifier_bridge_info *info)
28 {
29 - struct dsa_switch_tree *dst = ds->dst;
30 struct netlink_ext_ack extack = {0};
31 bool change_vlan_filtering = false;
32 bool vlan_filtering;
33 int err, port;
34
35 - if (dst->index == info->tree_index && ds->index == info->sw_index &&
36 - ds->ops->port_bridge_leave)
37 - ds->ops->port_bridge_leave(ds, info->port, info->br);
38 -
39 - if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
40 - ds->ops->crosschip_bridge_leave)
41 - ds->ops->crosschip_bridge_leave(ds, info->tree_index,
42 - info->sw_index, info->port,
43 - info->br);
44 -
45 if (ds->needs_standalone_vlan_filtering && !br_vlan_enabled(info->br)) {
46 change_vlan_filtering = true;
47 vlan_filtering = true;
48 @@ -172,6 +161,29 @@ static int dsa_switch_bridge_leave(struc
49 return err;
50 }
51
52 + return 0;
53 +}
54 +
55 +static int dsa_switch_bridge_leave(struct dsa_switch *ds,
56 + struct dsa_notifier_bridge_info *info)
57 +{
58 + struct dsa_switch_tree *dst = ds->dst;
59 + int err;
60 +
61 + if (dst->index == info->tree_index && ds->index == info->sw_index &&
62 + ds->ops->port_bridge_leave)
63 + ds->ops->port_bridge_leave(ds, info->port, info->br);
64 +
65 + if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
66 + ds->ops->crosschip_bridge_leave)
67 + ds->ops->crosschip_bridge_leave(ds, info->tree_index,
68 + 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 dsa_tag_8021q_bridge_leave(ds, info);
76 }
77