summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/b53/b53_priv.h
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2020-04-30 11:49:10 -0700
committerDavid S. Miller <davem@davemloft.net>2020-04-30 17:43:29 -0700
commitcd169d799beeb738fa2d3e891960924cdcaf8414 (patch)
tree3a19a7137124e174efa96796a81c5e55d7335c59 /drivers/net/dsa/b53/b53_priv.h
parente3da4038f4ca1094596a7604c6edac4a6a4f6ee9 (diff)
net: dsa: b53: Bound check ARL searches
ARL searches are done by reading two ARL entries at a time, do not cap the search at 1024 which would only limit us to half of the possible ARL capacity, but use b53_max_arl_entries() instead which does the right multiplication between bins and indexes. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/b53/b53_priv.h')
-rw-r--r--drivers/net/dsa/b53/b53_priv.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index 694e26cdfd4d..e942c60e4365 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -213,6 +213,11 @@ static inline int is58xx(struct b53_device *dev)
#define B53_CPU_PORT_25 5
#define B53_CPU_PORT 8
+static inline unsigned int b53_max_arl_entries(struct b53_device *dev)
+{
+ return dev->num_arl_buckets * dev->num_arl_bins;
+}
+
struct b53_device *b53_switch_alloc(struct device *base,
const struct b53_io_ops *ops,
void *priv);