Skip to content

Commit b360d94

Browse files
vladimirolteandavem330
authored andcommitted
net: mscc: ocelot: use separate flooding PGID for broadcast
In preparation of offloading the bridge port flags which have independent settings for unknown multicast and for broadcast, we should also start reserving one destination Port Group ID for the flooding of broadcast packets, to allow configuring it individually. Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6edb9e8 commit b360d94

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ static int felix_setup_tag_8021q(struct dsa_switch *ds, int cpu)
299299
cpu_flood = ANA_PGID_PGID_PGID(BIT(ocelot->num_phys_ports));
300300
ocelot_rmw_rix(ocelot, 0, cpu_flood, ANA_PGID_PGID, PGID_UC);
301301
ocelot_rmw_rix(ocelot, 0, cpu_flood, ANA_PGID_PGID, PGID_MC);
302+
ocelot_rmw_rix(ocelot, 0, cpu_flood, ANA_PGID_PGID, PGID_BC);
302303

303304
felix->dsa_8021q_ctx = kzalloc(sizeof(*felix->dsa_8021q_ctx),
304305
GFP_KERNEL);
@@ -412,6 +413,7 @@ static int felix_setup_tag_npi(struct dsa_switch *ds, int cpu)
412413
cpu_flood = ANA_PGID_PGID_PGID(BIT(ocelot->num_phys_ports));
413414
ocelot_rmw_rix(ocelot, cpu_flood, cpu_flood, ANA_PGID_PGID, PGID_UC);
414415
ocelot_rmw_rix(ocelot, cpu_flood, cpu_flood, ANA_PGID_PGID, PGID_MC);
416+
ocelot_rmw_rix(ocelot, cpu_flood, cpu_flood, ANA_PGID_PGID, PGID_BC);
415417

416418
return 0;
417419
}

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ int ocelot_init(struct ocelot *ocelot)
17161716
/* Setup flooding PGIDs */
17171717
for (i = 0; i < ocelot->num_flooding_pgids; i++)
17181718
ocelot_write_rix(ocelot, ANA_FLOODING_FLD_MULTICAST(PGID_MC) |
1719-
ANA_FLOODING_FLD_BROADCAST(PGID_MC) |
1719+
ANA_FLOODING_FLD_BROADCAST(PGID_BC) |
17201720
ANA_FLOODING_FLD_UNICAST(PGID_UC),
17211721
ANA_FLOODING, i);
17221722
ocelot_write(ocelot, ANA_FLOODING_IPMC_FLD_MC6_DATA(PGID_MCIPV6) |
@@ -1737,15 +1737,18 @@ int ocelot_init(struct ocelot *ocelot)
17371737
ocelot_write_rix(ocelot, 0, ANA_PGID_PGID, PGID_SRC + port);
17381738
}
17391739

1740-
/* Allow broadcast MAC frames. */
17411740
for_each_nonreserved_multicast_dest_pgid(ocelot, i) {
17421741
u32 val = ANA_PGID_PGID_PGID(GENMASK(ocelot->num_phys_ports - 1, 0));
17431742

17441743
ocelot_write_rix(ocelot, val, ANA_PGID_PGID, i);
17451744
}
1746-
ocelot_write_rix(ocelot,
1747-
ANA_PGID_PGID_PGID(GENMASK(ocelot->num_phys_ports, 0)),
1748-
ANA_PGID_PGID, PGID_MC);
1745+
/* Allow broadcast and unknown L2 multicast to the CPU. */
1746+
ocelot_rmw_rix(ocelot, ANA_PGID_PGID_PGID(BIT(ocelot->num_phys_ports)),
1747+
ANA_PGID_PGID_PGID(BIT(ocelot->num_phys_ports)),
1748+
ANA_PGID_PGID, PGID_MC);
1749+
ocelot_rmw_rix(ocelot, ANA_PGID_PGID_PGID(BIT(ocelot->num_phys_ports)),
1750+
ANA_PGID_PGID_PGID(BIT(ocelot->num_phys_ports)),
1751+
ANA_PGID_PGID, PGID_BC);
17491752
ocelot_write_rix(ocelot, 0, ANA_PGID_PGID, PGID_MCIPV4);
17501753
ocelot_write_rix(ocelot, 0, ANA_PGID_PGID, PGID_MCIPV6);
17511754

include/soc/mscc/ocelot.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@
5454
* PGID_CPU: used for whitelisting certain MAC addresses, such as the addresses
5555
* of the switch port net devices, towards the CPU port module.
5656
* PGID_UC: the flooding destinations for unknown unicast traffic.
57-
* PGID_MC: the flooding destinations for broadcast and non-IP multicast
58-
* traffic.
57+
* PGID_MC: the flooding destinations for non-IP multicast traffic.
5958
* PGID_MCIPV4: the flooding destinations for IPv4 multicast traffic.
6059
* PGID_MCIPV6: the flooding destinations for IPv6 multicast traffic.
60+
* PGID_BC: the flooding destinations for broadcast traffic.
6161
*/
62-
#define PGID_CPU 59
63-
#define PGID_UC 60
64-
#define PGID_MC 61
65-
#define PGID_MCIPV4 62
66-
#define PGID_MCIPV6 63
62+
#define PGID_CPU 58
63+
#define PGID_UC 59
64+
#define PGID_MC 60
65+
#define PGID_MCIPV4 61
66+
#define PGID_MCIPV6 62
67+
#define PGID_BC 63
6768

6869
#define for_each_unicast_dest_pgid(ocelot, pgid) \
6970
for ((pgid) = 0; \

0 commit comments

Comments
 (0)