From: Vladimir Oltean <olteanv@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: [PATCH net-next 8/9] net: dsa: sja1105: configure the multicast policers, if present
Date: Mon, 24 May 2021 16:14:20 +0300 [thread overview]
Message-ID: <20210524131421.1030789-9-olteanv@gmail.com> (raw)
In-Reply-To: <20210524131421.1030789-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
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>
---
drivers/net/dsa/sja1105/sja1105_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index 937cbdb89686..6850f03be1f3 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 */
--
2.25.1
next prev parent reply other threads:[~2021-05-24 13:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 13:14 [PATCH net-next 0/9] SJA1105 DSA driver preparation for new switch introduction (SJA1110) Vladimir Oltean
2021-05-24 13:14 ` [PATCH net-next 1/9] net: dsa: sja1105: parameterize the number of ports Vladimir Oltean
2021-05-24 13:14 ` [PATCH net-next 2/9] net: dsa: sja1105: avoid some work for unused ports Vladimir Oltean
2021-05-24 13:14 ` [PATCH net-next 3/9] net: dsa: sja1105: dimension the data structures for a larger port count Vladimir Oltean
2021-05-24 13:14 ` [PATCH net-next 4/9] net: dsa: sja1105: don't assign the host port using dsa_upstream_port() Vladimir Oltean
2021-05-24 13:14 ` [PATCH net-next 5/9] net: dsa: sja1105: skip CGU configuration if it's unnecessary Vladimir Oltean
2021-05-24 13:14 ` [PATCH net-next 6/9] net: dsa: sja1105: dynamically choose the number of static config table entries Vladimir Oltean
2021-05-24 13:14 ` [PATCH net-next 7/9] net: dsa: sja1105: use sja1105_xfer_u32 for the reset procedure Vladimir Oltean
2021-05-24 13:14 ` Vladimir Oltean [this message]
2021-05-24 13:14 ` [PATCH net-next 9/9] net: dsa: sja1105: allow the frame buffer size to be customized Vladimir Oltean
2021-05-24 21:10 ` [PATCH net-next 0/9] SJA1105 DSA driver preparation for new switch introduction (SJA1110) patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210524131421.1030789-9-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).