net: dsa: sja1105: dynamically choose the number of static config table entries
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 24 May 2021 13:14:18 +0000 (16:14 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 May 2021 20:59:03 +0000 (13:59 -0700)
commitfd6f2c257b0bc0c656e88dcc2c6fc7ce180fb2de
tree4e18a423322b3ac34df8e1176f341c2f09b41f60
parentc50376783f23ffd2dd8833c2069e52ba08e82917
net: dsa: sja1105: dynamically choose the number of static config table entries

Due to the fact that the port count is different, some static config
tables have a different number of elements in SJA1105 compared to
SJA1110. Such an example is the L2 Policing table, which has 45 entries
in SJA1105 (one per port x traffic class, and one broadcast policer per
port) and 110 entries in SJA1110 (one per port x traffic class, one
broadcast and one multicast policer per port).

Similarly, the MAC Configuration Table, the L2 Forwarding table, all
have a different number of elements simply because the port count is
different, and although this can be accounted for by looking at
ds->ports, the policing table can't because of the presence of the extra
multicast policers.

The common denominator for the static config initializers for these
tables is that they must set up all the entries within that table.
So the simplest way to account for these differences in a uniform manner
is to look at struct sja1105_table_ops::max_entry_count. For the sake of
uniformity, this patch makes that change also for tables whose number of
elements did not change in SJA1110, like the xMII Mode Parameters, the
L2 Lookup Parameters, General Parameters, AVB Parameters (all of these
are singleton tables with a single entry).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_main.c