kernel: backport flow offload fixes
[openwrt/openwrt.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 --- a/net/dsa/switch.c
26 +++ b/net/dsa/switch.c
27 @@ -104,23 +104,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 - struct dsa_switch_tree *dst = ds->dst;
38 int err, i;
39
40 - if (dst->index == info->tree_index && ds->index == info->sw_index &&
41 - ds->ops->port_bridge_leave)
42 - ds->ops->port_bridge_leave(ds, info->port, info->br);
43 -
44 - if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
45 - ds->ops->crosschip_bridge_leave)
46 - ds->ops->crosschip_bridge_leave(ds, info->tree_index,
47 - info->sw_index, info->port,
48 - info->br);
49 -
50 /* If the bridge was vlan_filtering, the bridge core doesn't trigger an
51 * event for changing vlan_filtering setting upon slave ports leaving
52 * it. That is a good thing, because that lets us handle it and also
53 @@ -153,6 +142,30 @@ static int dsa_switch_bridge_leave(struc
54 if (err && err != EOPNOTSUPP)
55 return err;
56 }
57 +
58 + return 0;
59 +}
60 +
61 +static int dsa_switch_bridge_leave(struct dsa_switch *ds,
62 + struct dsa_notifier_bridge_info *info)
63 +{
64 + struct dsa_switch_tree *dst = ds->dst;
65 + int err;
66 +
67 + if (dst->index == info->tree_index && ds->index == info->sw_index &&
68 + ds->ops->port_bridge_leave)
69 + ds->ops->port_bridge_leave(ds, info->port, info->br);
70 +
71 + if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
72 + ds->ops->crosschip_bridge_leave)
73 + ds->ops->crosschip_bridge_leave(ds, info->tree_index,
74 + info->sw_index, info->port,
75 + info->br);
76 +
77 + err = dsa_switch_sync_vlan_filtering(ds, info);
78 + if (err)
79 + return err;
80 +
81 return 0;
82 }
83