]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.54/net-dsa-rtl8366-fix-up-vlan-filtering.patch
Linux 4.19.54
[thirdparty/kernel/stable-queue.git] / releases / 4.19.54 / net-dsa-rtl8366-fix-up-vlan-filtering.patch
1 From foo@baz Wed 19 Jun 2019 02:34:37 PM CEST
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Fri, 14 Jun 2019 00:25:20 +0200
4 Subject: net: dsa: rtl8366: Fix up VLAN filtering
5
6 From: Linus Walleij <linus.walleij@linaro.org>
7
8 [ Upstream commit 760c80b70bed2cd01630e8595d1bbde910339f31 ]
9
10 We get this regression when using RTL8366RB as part of a bridge
11 with OpenWrt:
12
13 WARNING: CPU: 0 PID: 1347 at net/switchdev/switchdev.c:291
14 switchdev_port_attr_set_now+0x80/0xa4
15 lan0: Commit of attribute (id=7) failed.
16 (...)
17 realtek-smi switch lan0: failed to initialize vlan filtering on this port
18
19 This is because it is trying to disable VLAN filtering
20 on VLAN0, as we have forgot to add 1 to the port number
21 to get the right VLAN in rtl8366_vlan_filtering(): when
22 we initialize the VLAN we associate VLAN1 with port 0,
23 VLAN2 with port 1 etc, so we need to add 1 to the port
24 offset.
25
26 Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
27 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
28 Signed-off-by: David S. Miller <davem@davemloft.net>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30 ---
31 drivers/net/dsa/rtl8366.c | 7 ++++---
32 1 file changed, 4 insertions(+), 3 deletions(-)
33
34 --- a/drivers/net/dsa/rtl8366.c
35 +++ b/drivers/net/dsa/rtl8366.c
36 @@ -307,7 +307,8 @@ int rtl8366_vlan_filtering(struct dsa_sw
37 struct rtl8366_vlan_4k vlan4k;
38 int ret;
39
40 - if (!smi->ops->is_vlan_valid(smi, port))
41 + /* Use VLAN nr port + 1 since VLAN0 is not valid */
42 + if (!smi->ops->is_vlan_valid(smi, port + 1))
43 return -EINVAL;
44
45 dev_info(smi->dev, "%s filtering on port %d\n",
46 @@ -318,12 +319,12 @@ int rtl8366_vlan_filtering(struct dsa_sw
47 * The hardware support filter ID (FID) 0..7, I have no clue how to
48 * support this in the driver when the callback only says on/off.
49 */
50 - ret = smi->ops->get_vlan_4k(smi, port, &vlan4k);
51 + ret = smi->ops->get_vlan_4k(smi, port + 1, &vlan4k);
52 if (ret)
53 return ret;
54
55 /* Just set the filter to FID 1 for now then */
56 - ret = rtl8366_set_vlan(smi, port,
57 + ret = rtl8366_set_vlan(smi, port + 1,
58 vlan4k.member,
59 vlan4k.untag,
60 1);