kernel: 5.15: update Aquantia PHY driver to v6.1 code
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 774-v5.16-02-net-dsa-rtl8366-Drop-custom-VLAN-set-up.patch
1 From 96cf10a8e7297065459473c081a6fb6432a22312 Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Sun, 26 Sep 2021 00:59:25 +0200
4 Subject: [PATCH 02/11] net: dsa: rtl8366: Drop custom VLAN set-up
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This hacky default VLAN setup was done in order to direct
10 packets to the right ports and provide port isolation, both
11 which we now support properly using custom tags and proper
12 bridge port isolation.
13
14 We can drop the custom VLAN code and leave all VLAN handling
15 alone, as users expect things to be. We can also drop
16 ds->configure_vlan_while_not_filtering = false; and let
17 the core deal with any VLANs it wants.
18
19 Cc: Mauri Sandberg <sandberg@mailfence.com>
20 Cc: DENG Qingfang <dqfext@gmail.com>
21 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
22 Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
23 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
24 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
25 Signed-off-by: David S. Miller <davem@davemloft.net>
26 ---
27 drivers/net/dsa/realtek-smi-core.h | 1 -
28 drivers/net/dsa/rtl8366.c | 48 ------------------------------
29 drivers/net/dsa/rtl8366rb.c | 4 +--
30 3 files changed, 1 insertion(+), 52 deletions(-)
31
32 --- a/drivers/net/dsa/realtek-smi-core.h
33 +++ b/drivers/net/dsa/realtek-smi-core.h
34 @@ -129,7 +129,6 @@ int rtl8366_set_pvid(struct realtek_smi
35 int rtl8366_enable_vlan4k(struct realtek_smi *smi, bool enable);
36 int rtl8366_enable_vlan(struct realtek_smi *smi, bool enable);
37 int rtl8366_reset_vlan(struct realtek_smi *smi);
38 -int rtl8366_init_vlan(struct realtek_smi *smi);
39 int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
40 struct netlink_ext_ack *extack);
41 int rtl8366_vlan_add(struct dsa_switch *ds, int port,
42 --- a/drivers/net/dsa/rtl8366.c
43 +++ b/drivers/net/dsa/rtl8366.c
44 @@ -292,54 +292,6 @@ int rtl8366_reset_vlan(struct realtek_sm
45 }
46 EXPORT_SYMBOL_GPL(rtl8366_reset_vlan);
47
48 -int rtl8366_init_vlan(struct realtek_smi *smi)
49 -{
50 - int port;
51 - int ret;
52 -
53 - ret = rtl8366_reset_vlan(smi);
54 - if (ret)
55 - return ret;
56 -
57 - /* Loop over the available ports, for each port, associate
58 - * it with the VLAN (port+1)
59 - */
60 - for (port = 0; port < smi->num_ports; port++) {
61 - u32 mask;
62 -
63 - if (port == smi->cpu_port)
64 - /* For the CPU port, make all ports members of this
65 - * VLAN.
66 - */
67 - mask = GENMASK((int)smi->num_ports - 1, 0);
68 - else
69 - /* For all other ports, enable itself plus the
70 - * CPU port.
71 - */
72 - mask = BIT(port) | BIT(smi->cpu_port);
73 -
74 - /* For each port, set the port as member of VLAN (port+1)
75 - * and untagged, except for the CPU port: the CPU port (5) is
76 - * member of VLAN 6 and so are ALL the other ports as well.
77 - * Use filter 0 (no filter).
78 - */
79 - dev_info(smi->dev, "VLAN%d port mask for port %d, %08x\n",
80 - (port + 1), port, mask);
81 - ret = rtl8366_set_vlan(smi, (port + 1), mask, mask, 0);
82 - if (ret)
83 - return ret;
84 -
85 - dev_info(smi->dev, "VLAN%d port %d, PVID set to %d\n",
86 - (port + 1), port, (port + 1));
87 - ret = rtl8366_set_pvid(smi, port, (port + 1));
88 - if (ret)
89 - return ret;
90 - }
91 -
92 - return rtl8366_enable_vlan(smi, true);
93 -}
94 -EXPORT_SYMBOL_GPL(rtl8366_init_vlan);
95 -
96 int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
97 struct netlink_ext_ack *extack)
98 {
99 --- a/drivers/net/dsa/rtl8366rb.c
100 +++ b/drivers/net/dsa/rtl8366rb.c
101 @@ -985,7 +985,7 @@ static int rtl8366rb_setup(struct dsa_sw
102 return ret;
103 }
104
105 - ret = rtl8366_init_vlan(smi);
106 + ret = rtl8366_reset_vlan(smi);
107 if (ret)
108 return ret;
109
110 @@ -999,8 +999,6 @@ static int rtl8366rb_setup(struct dsa_sw
111 return -ENODEV;
112 }
113
114 - ds->configure_vlan_while_not_filtering = false;
115 -
116 return 0;
117 }
118