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
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.
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>
15 net/dsa/switch.c | 38 +++++++++++++++++++++++++-------------
16 1 file changed, 25 insertions(+), 13 deletions(-)
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);
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)
29 - struct dsa_switch_tree *dst = ds->dst;
30 struct netlink_ext_ack extack = {0};
31 bool change_vlan_filtering = false;
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);
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,
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
55 +static int dsa_switch_bridge_leave(struct dsa_switch *ds,
56 + struct dsa_notifier_bridge_info *info)
58 + struct dsa_switch_tree *dst = ds->dst;
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);
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,
71 + err = dsa_switch_sync_vlan_filtering(ds, info);
75 return dsa_tag_8021q_bridge_leave(ds, info);