]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.19/net-dsa-rtl8366-fix-up-vlan-filtering.patch-7886
fix up the 5.1 queue :(
[thirdparty/kernel/stable-queue.git] / queue-4.19 / net-dsa-rtl8366-fix-up-vlan-filtering.patch-7886
CommitLineData
a15a8890
SL
1From 435b8bc77d6adeb6e65128fbb9bb2bd41cd1de19 Mon Sep 17 00:00:00 2001
2From: Linus Walleij <linus.walleij@linaro.org>
3Date: Fri, 14 Jun 2019 00:25:20 +0200
4Subject: net: dsa: rtl8366: Fix up VLAN filtering
5
6[ Upstream commit 760c80b70bed2cd01630e8595d1bbde910339f31 ]
7
8We get this regression when using RTL8366RB as part of a bridge
9with OpenWrt:
10
11WARNING: CPU: 0 PID: 1347 at net/switchdev/switchdev.c:291
12 switchdev_port_attr_set_now+0x80/0xa4
13lan0: Commit of attribute (id=7) failed.
14(...)
15realtek-smi switch lan0: failed to initialize vlan filtering on this port
16
17This is because it is trying to disable VLAN filtering
18on VLAN0, as we have forgot to add 1 to the port number
19to get the right VLAN in rtl8366_vlan_filtering(): when
20we initialize the VLAN we associate VLAN1 with port 0,
21VLAN2 with port 1 etc, so we need to add 1 to the port
22offset.
23
24Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
25Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
26Signed-off-by: David S. Miller <davem@davemloft.net>
27Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28---
29 drivers/net/dsa/rtl8366.c | 7 ++++---
30 1 file changed, 4 insertions(+), 3 deletions(-)
31
32diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c
33index 6dedd43442cc..35b767baf21f 100644
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_switch *ds, int port, bool vlan_filtering)
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_switch *ds, int port, bool vlan_filtering)
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);
61--
622.20.1
63