532db74c83b78352e5391da78d195fc3ed488d1d
[openwrt/staging/pepe2k.git] /
1 From acc105226493e7cfdb6e72d130c36f21e951fc1f Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Sat, 9 Nov 2019 15:02:55 +0200
4 Subject: [PATCH] net: mscc: ocelot: limit vlan ingress filtering to actual
5 number of ports
6
7 The VSC7514 switch (Ocelot) is a 10-port device, while VSC9959 (Felix)
8 is 6-port. Therefore the VLAN filtering mask would be out of bounds when
9 calling for this new switch. Fix that.
10
11 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/ethernet/mscc/ocelot.c | 3 ++-
15 1 file changed, 2 insertions(+), 1 deletion(-)
16
17 --- a/drivers/net/ethernet/mscc/ocelot.c
18 +++ b/drivers/net/ethernet/mscc/ocelot.c
19 @@ -389,7 +389,8 @@ static void ocelot_vlan_init(struct ocel
20 /* Set vlan ingress filter mask to all ports but the CPU port by
21 * default.
22 */
23 - ocelot_write(ocelot, GENMASK(9, 0), ANA_VLANMASK);
24 + ocelot_write(ocelot, GENMASK(ocelot->num_phys_ports - 1, 0),
25 + ANA_VLANMASK);
26
27 for (port = 0; port < ocelot->num_phys_ports; port++) {
28 ocelot_write_gix(ocelot, 0, REW_PORT_VLAN_CFG, port);