aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-06-13 18:25:20 -0400
committerDavid S. Miller <davem@davemloft.net>2019-06-15 16:40:30 -0400
commit760c80b70bed2cd01630e8595d1bbde910339f31 (patch)
tree0b211322c79bf6cf3028ebf5109c7e97aaaaffa0
parentef7bfa84725d891bbdb88707ed55b2cbf94942bb (diff)
net: dsa: rtl8366: Fix up VLAN filtering
We get this regression when using RTL8366RB as part of a bridge with OpenWrt: WARNING: CPU: 0 PID: 1347 at net/switchdev/switchdev.c:291 switchdev_port_attr_set_now+0x80/0xa4 lan0: Commit of attribute (id=7) failed. (...) realtek-smi switch lan0: failed to initialize vlan filtering on this port This is because it is trying to disable VLAN filtering on VLAN0, as we have forgot to add 1 to the port number to get the right VLAN in rtl8366_vlan_filtering(): when we initialize the VLAN we associate VLAN1 with port 0, VLAN2 with port 1 etc, so we need to add 1 to the port offset. Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/rtl8366.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c
index fe5d976b0b10..ca3d17e43ed8 100644
--- a/drivers/net/dsa/rtl8366.c
+++ b/drivers/net/dsa/rtl8366.c
@@ -307,7 +307,8 @@ int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)
307 struct rtl8366_vlan_4k vlan4k; 307 struct rtl8366_vlan_4k vlan4k;
308 int ret; 308 int ret;
309 309
310 if (!smi->ops->is_vlan_valid(smi, port)) 310 /* Use VLAN nr port + 1 since VLAN0 is not valid */
311 if (!smi->ops->is_vlan_valid(smi, port + 1))
311 return -EINVAL; 312 return -EINVAL;
312 313
313 dev_info(smi->dev, "%s filtering on port %d\n", 314 dev_info(smi->dev, "%s filtering on port %d\n",
@@ -318,12 +319,12 @@ int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)
318 * The hardware support filter ID (FID) 0..7, I have no clue how to 319 * The hardware support filter ID (FID) 0..7, I have no clue how to
319 * support this in the driver when the callback only says on/off. 320 * support this in the driver when the callback only says on/off.
320 */ 321 */
321 ret = smi->ops->get_vlan_4k(smi, port, &vlan4k); 322 ret = smi->ops->get_vlan_4k(smi, port + 1, &vlan4k);
322 if (ret) 323 if (ret)
323 return ret; 324 return ret;
324 325
325 /* Just set the filter to FID 1 for now then */ 326 /* Just set the filter to FID 1 for now then */
326 ret = rtl8366_set_vlan(smi, port, 327 ret = rtl8366_set_vlan(smi, port + 1,
327 vlan4k.member, 328 vlan4k.member,
328 vlan4k.untag, 329 vlan4k.untag,
329 1); 330 1);