Skip to content

Commit edd2410

Browse files
vladimirolteankuba-moo
authored andcommitted
net: mscc: ocelot: fix dropping of unknown IPv4 multicast on Seville
The current assumption is that the felix DSA driver has flooding knobs per traffic class, while ocelot switchdev has a single flooding knob. This was correct for felix VSC9959 and ocelot VSC7514, but with the introduction of seville VSC9953, we see a switch driven by felix.c which has a single flooding knob. So it is clear that we must do what should have been done from the beginning, which is not to overwrite the configuration done by ocelot.c in felix, but instead to teach the common ocelot library about the differences in our switches, and set up the flooding PGIDs centrally. The effect that the bogus iteration through FELIX_NUM_TC has upon seville is quite dramatic. ANA_FLOODING is located at 0x00b548, and ANA_FLOODING_IPMC is located at 0x00b54c. So the bogus iteration will actually overwrite ANA_FLOODING_IPMC when attempting to write ANA_FLOODING[1]. There is no ANA_FLOODING[1] in sevile, just ANA_FLOODING. And when ANA_FLOODING_IPMC is overwritten with a bogus value, the effect is that ANA_FLOODING_IPMC gets the value of 0x0003CF7D: MC6_DATA = 61, MC6_CTRL = 61, MC4_DATA = 60, MC4_CTRL = 0. Because MC4_CTRL is zero, this means that IPv4 multicast control packets are not flooded, but dropped. An invalid configuration, and this is how the issue was actually spotted. Reported-by: Eldar Gasanov <eldargasanov2@gmail.com> Reported-by: Maxim Kochetkov <fido_max@inbox.ru> Tested-by: Eldar Gasanov <eldargasanov2@gmail.com> Fixes: 84705fc ("net: dsa: felix: introduce support for Seville VSC9953 switch") Fixes: 3c7b51b ("net: dsa: felix: allow flooding for all traffic classes") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201204175416.1445937-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 4de377b commit edd2410

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎drivers/net/dsa/ocelot/felix.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ static int felix_setup(struct dsa_switch *ds)
569569
struct ocelot *ocelot = ds->priv;
570570
struct felix *felix = ocelot_to_felix(ocelot);
571571
int port, err;
572-
int tc;
573572

574573
err = felix_init_structs(felix, ds->num_ports);
575574
if (err)
@@ -608,12 +607,6 @@ static int felix_setup(struct dsa_switch *ds)
608607
ocelot_write_rix(ocelot,
609608
ANA_PGID_PGID_PGID(GENMASK(ocelot->num_phys_ports, 0)),
610609
ANA_PGID_PGID, PGID_UC);
611-
/* Setup the per-traffic class flooding PGIDs */
612-
for (tc = 0; tc < FELIX_NUM_TC; tc++)
613-
ocelot_write_rix(ocelot, ANA_FLOODING_FLD_MULTICAST(PGID_MC) |
614-
ANA_FLOODING_FLD_BROADCAST(PGID_MC) |
615-
ANA_FLOODING_FLD_UNICAST(PGID_UC),
616-
ANA_FLOODING, tc);
617610

618611
ds->mtu_enforcement_ingress = true;
619612
ds->configure_vlan_while_not_filtering = true;

‎drivers/net/dsa/ocelot/felix_vsc9959.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ static int felix_pci_probe(struct pci_dev *pdev,
14291429
pci_set_drvdata(pdev, felix);
14301430
ocelot = &felix->ocelot;
14311431
ocelot->dev = &pdev->dev;
1432+
ocelot->num_flooding_pgids = FELIX_NUM_TC;
14321433
felix->info = &felix_info_vsc9959;
14331434
felix->switch_base = pci_resource_start(pdev,
14341435
felix->info->switch_pci_bar);

‎drivers/net/dsa/ocelot/seville_vsc9953.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,7 @@ static int seville_probe(struct platform_device *pdev)
12101210

12111211
ocelot = &felix->ocelot;
12121212
ocelot->dev = &pdev->dev;
1213+
ocelot->num_flooding_pgids = 1;
12131214
felix->info = &seville_info_vsc9953;
12141215

12151216
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

‎drivers/net/ethernet/mscc/ocelot.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,10 +1489,11 @@ int ocelot_init(struct ocelot *ocelot)
14891489
SYS_FRM_AGING_MAX_AGE(307692), SYS_FRM_AGING);
14901490

14911491
/* Setup flooding PGIDs */
1492-
ocelot_write_rix(ocelot, ANA_FLOODING_FLD_MULTICAST(PGID_MC) |
1493-
ANA_FLOODING_FLD_BROADCAST(PGID_MC) |
1494-
ANA_FLOODING_FLD_UNICAST(PGID_UC),
1495-
ANA_FLOODING, 0);
1492+
for (i = 0; i < ocelot->num_flooding_pgids; i++)
1493+
ocelot_write_rix(ocelot, ANA_FLOODING_FLD_MULTICAST(PGID_MC) |
1494+
ANA_FLOODING_FLD_BROADCAST(PGID_MC) |
1495+
ANA_FLOODING_FLD_UNICAST(PGID_UC),
1496+
ANA_FLOODING, i);
14961497
ocelot_write(ocelot, ANA_FLOODING_IPMC_FLD_MC6_DATA(PGID_MCIPV6) |
14971498
ANA_FLOODING_IPMC_FLD_MC6_CTRL(PGID_MC) |
14981499
ANA_FLOODING_IPMC_FLD_MC4_DATA(PGID_MCIPV4) |

‎drivers/net/ethernet/mscc/ocelot_vsc7514.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
12541254
}
12551255

12561256
ocelot->num_phys_ports = of_get_child_count(ports);
1257+
ocelot->num_flooding_pgids = 1;
12571258

12581259
ocelot->vcap = vsc7514_vcap_props;
12591260
ocelot->inj_prefix = OCELOT_TAG_PREFIX_NONE;

‎include/soc/mscc/ocelot.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ struct ocelot {
618618
/* Keep track of the vlan port masks */
619619
u32 vlan_mask[VLAN_N_VID];
620620

621+
/* Switches like VSC9959 have flooding per traffic class */
622+
int num_flooding_pgids;
623+
621624
/* In tables like ANA:PORT and the ANA:PGID:PGID mask,
622625
* the CPU is located after the physical ports (at the
623626
* num_phys_ports index).

0 commit comments

Comments
 (0)