diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-08-16 16:53:50 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-25 12:45:39 +0300 |
commit | e07a74dc0fed1570a4fbf3240cfb06a93b8f904e (patch) | |
tree | 14fb03b9cf2c59e995937ed2ed0bf58f0ed96f29 /tools | |
parent | 3aa635bf2f8f7495135d5cba72aae6fc279df33e (diff) | |
download | linux-e07a74dc0fed1570a4fbf3240cfb06a93b8f904e.tar.xz |
net: mscc: ocelot: make struct ocelot_stat_layout array indexable
[ Upstream commit 9190460084ddd0e9235f55eab0fdd5456b5f2fd5 ]
The ocelot counters are 32-bit and require periodic reading, every 2
seconds, by ocelot_port_update_stats(), so that wraparounds are
detected.
Currently, the counters reported by ocelot_get_stats64() come from the
32-bit hardware counters directly, rather than from the 64-bit
accumulated ocelot->stats, and this is a problem for their integrity.
The strategy is to make ocelot_get_stats64() able to cherry-pick
individual stats from ocelot->stats the way in which it currently reads
them out from SYS_COUNT_* registers. But currently it can't, because
ocelot->stats is an opaque u64 array that's used only to feed data into
ethtool -S.
To solve that problem, we need to make ocelot->stats indexable, and
associate each element with an element of struct ocelot_stat_layout used
by ethtool -S.
This makes ocelot_stat_layout a fat (and possibly sparse) array, so we
need to change the way in which we access it. We no longer need
OCELOT_STAT_END as a sentinel, because we know the array's size
(OCELOT_NUM_STATS). We just need to skip the array elements that were
left unpopulated for the switch revision (ocelot, felix, seville).
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions