summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/sja1105/sja1105_main.c
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2021-05-24 15:14:20 +0200
committerDavid S. Miller <davem@davemloft.net>2021-05-24 22:59:03 +0200
commit38fbe91f2287c696f290d9115901aa435f7166a8 (patch)
tree31e80bff6be0a7cc395f98e150a57b56ae2cfa37 /drivers/net/dsa/sja1105/sja1105_main.c
parentnet: dsa: sja1105: use sja1105_xfer_u32 for the reset procedure (diff)
downloadlinux-38fbe91f2287c696f290d9115901aa435f7166a8.tar.xz
linux-38fbe91f2287c696f290d9115901aa435f7166a8.zip
net: dsa: sja1105: configure the multicast policers, if present
The SJA1110 policer array is similar in layout with SJA1105, except it contains one multicast policer per port at the end. Detect the presence of multicast policers based on the maximum number of supported L2 Policing Table entries, and make those policers have a shared index equal to the port's default policer. Letting the user configure these policers is not supported at the moment. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/dsa/sja1105/sja1105_main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index cd9359722e5f..c391ab00e003 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -719,12 +719,16 @@ static int sja1105_init_l2_policing(struct sja1105_private *priv)
/* Setup shared indices for the matchall policers */
for (port = 0; port < ds->num_ports; port++) {
+ int mcast = (ds->num_ports * (SJA1105_NUM_TC + 1)) + port;
int bcast = (ds->num_ports * SJA1105_NUM_TC) + port;
for (tc = 0; tc < SJA1105_NUM_TC; tc++)
policing[port * SJA1105_NUM_TC + tc].sharindx = port;
policing[bcast].sharindx = port;
+ /* Only SJA1110 has multicast policers */
+ if (mcast <= table->ops->max_entry_count)
+ policing[mcast].sharindx = port;
}
/* Setup the matchall policer parameters */