generic: 5.15: replace ramips AR8033 fiber patch with 5.18 patches
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 774-v5.16-07-net-dsa-rtl8366rb-Use-core-filtering-tracking.patch
1 From 5c9b66f3c8a3f72fa2a58e89a57c6d7afd550bf0 Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Wed, 29 Sep 2021 13:23:22 +0200
4 Subject: [PATCH 07/11] net: dsa: rtl8366rb: Use core filtering tracking
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 We added a state variable to track whether a certain port
10 was VLAN filtering or not, but we can just inquire the DSA
11 core about this.
12
13 Cc: Vladimir Oltean <olteanv@gmail.com>
14 Cc: Mauri Sandberg <sandberg@mailfence.com>
15 Cc: DENG Qingfang <dqfext@gmail.com>
16 Cc: Alvin Šipraga <alsi@bang-olufsen.dk>
17 Cc: Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
18 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
20 ---
21 drivers/net/dsa/rtl8366rb.c | 9 ++-------
22 1 file changed, 2 insertions(+), 7 deletions(-)
23
24 --- a/drivers/net/dsa/rtl8366rb.c
25 +++ b/drivers/net/dsa/rtl8366rb.c
26 @@ -337,12 +337,10 @@
27 * struct rtl8366rb - RTL8366RB-specific data
28 * @max_mtu: per-port max MTU setting
29 * @pvid_enabled: if PVID is set for respective port
30 - * @vlan_filtering: if VLAN filtering is enabled for respective port
31 */
32 struct rtl8366rb {
33 unsigned int max_mtu[RTL8366RB_NUM_PORTS];
34 bool pvid_enabled[RTL8366RB_NUM_PORTS];
35 - bool vlan_filtering[RTL8366RB_NUM_PORTS];
36 };
37
38 static struct rtl8366_mib_counter rtl8366rb_mib_counters[] = {
39 @@ -1262,12 +1260,9 @@ static int rtl8366rb_vlan_filtering(stru
40 if (ret)
41 return ret;
42
43 - /* Keep track if filtering is enabled on each port */
44 - rb->vlan_filtering[port] = vlan_filtering;
45 -
46 /* If VLAN filtering is enabled and PVID is also enabled, we must
47 * not drop any untagged or C-tagged frames. If we turn off VLAN
48 - * filtering on a port, we need ti accept any frames.
49 + * filtering on a port, we need to accept any frames.
50 */
51 if (vlan_filtering)
52 ret = rtl8366rb_drop_untagged(smi, port, !rb->pvid_enabled[port]);
53 @@ -1512,7 +1507,7 @@ static int rtl8366rb_set_mc_index(struct
54 * not drop any untagged or C-tagged frames. Make sure to update the
55 * filtering setting.
56 */
57 - if (rb->vlan_filtering[port])
58 + if (dsa_port_is_vlan_filtering(dsa_to_port(smi->ds, port)))
59 ret = rtl8366rb_drop_untagged(smi, port, !pvid_enabled);
60
61 return ret;