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
6 From: Linus Walleij <linus.walleij@linaro.org>
8 [ Upstream commit 760c80b70bed2cd01630e8595d1bbde910339f31 ]
10 We get this regression when using RTL8366RB as part of a bridge
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.
17 realtek-smi switch lan0: failed to initialize vlan filtering on this port
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
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>
31 drivers/net/dsa/rtl8366.c | 7 ++++---
32 1 file changed, 4 insertions(+), 3 deletions(-)
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;
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))
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.
50 - ret = smi->ops->get_vlan_4k(smi, port, &vlan4k);
51 + ret = smi->ops->get_vlan_4k(smi, port + 1, &vlan4k);
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,