diff mbox series

[net-next,09/15] net: mscc: ocelot: limit vlan ingress filtering to actual number of ports

Message ID 20191109130301.13716-10-olteanv@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series Accomodate DSA front-end into Ocelot | expand

Commit Message

Vladimir Oltean Nov. 9, 2019, 1:02 p.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

The VSC7514 switch (Ocelot) is a 10-port device, while VSC9959 (Felix)
is 6-port. Therefore the VLAN filtering mask would be out of bounds when
calling for this new switch. Fix that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andrew Lunn Nov. 10, 2019, 4:25 p.m. UTC | #1
On Sat, Nov 09, 2019 at 03:02:55PM +0200, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> The VSC7514 switch (Ocelot) is a 10-port device, while VSC9959 (Felix)
> is 6-port. Therefore the VLAN filtering mask would be out of bounds when
> calling for this new switch. Fix that.

Hi Vladimir

Is this a real fix? Should it be posted to net?

Thanks
	Andrew
Vladimir Oltean Nov. 10, 2019, 4:29 p.m. UTC | #2
On Sun, 10 Nov 2019 at 18:26, Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Sat, Nov 09, 2019 at 03:02:55PM +0200, Vladimir Oltean wrote:
> > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> > The VSC7514 switch (Ocelot) is a 10-port device, while VSC9959 (Felix)
> > is 6-port. Therefore the VLAN filtering mask would be out of bounds when
> > calling for this new switch. Fix that.
>
> Hi Vladimir
>
> Is this a real fix? Should it be posted to net?
>
> Thanks
>         Andrew

Hi Andrew,

Felix is not supported by the mainline ocelot driver yet, so there's
no bug per se: ocelot->num_phys_ports can only be 10 at the moment.

Thanks,
-Vladimir
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 58ead0652bce..107a07cfaec9 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -389,7 +389,8 @@  static void ocelot_vlan_init(struct ocelot *ocelot)
 	/* Set vlan ingress filter mask to all ports but the CPU port by
 	 * default.
 	 */
-	ocelot_write(ocelot, GENMASK(9, 0), ANA_VLANMASK);
+	ocelot_write(ocelot, GENMASK(ocelot->num_phys_ports - 1, 0),
+		     ANA_VLANMASK);
 
 	for (port = 0; port < ocelot->num_phys_ports; port++) {
 		ocelot_write_gix(ocelot, 0, REW_PORT_VLAN_CFG, port);