]>
Commit | Line | Data |
---|---|---|
a15a8890 SL |
1 | From 435b8bc77d6adeb6e65128fbb9bb2bd41cd1de19 Mon Sep 17 00:00:00 2001 |
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 | [ Upstream commit 760c80b70bed2cd01630e8595d1bbde910339f31 ] | |
7 | ||
8 | We get this regression when using RTL8366RB as part of a bridge | |
9 | with OpenWrt: | |
10 | ||
11 | WARNING: CPU: 0 PID: 1347 at net/switchdev/switchdev.c:291 | |
12 | switchdev_port_attr_set_now+0x80/0xa4 | |
13 | lan0: Commit of attribute (id=7) failed. | |
14 | (...) | |
15 | realtek-smi switch lan0: failed to initialize vlan filtering on this port | |
16 | ||
17 | This is because it is trying to disable VLAN filtering | |
18 | on VLAN0, as we have forgot to add 1 to the port number | |
19 | to get the right VLAN in rtl8366_vlan_filtering(): when | |
20 | we initialize the VLAN we associate VLAN1 with port 0, | |
21 | VLAN2 with port 1 etc, so we need to add 1 to the port | |
22 | offset. | |
23 | ||
24 | Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") | |
25 | Signed-off-by: Linus Walleij <linus.walleij@linaro.org> | |
26 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
27 | Signed-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 | ||
32 | diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c | |
33 | index 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 | -- | |
62 | 2.20.1 | |
63 |