diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-08-16 16:53:52 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-25 12:45:39 +0300 |
commit | e124bab08a51d80badd94fef78a8284fbe49799c (patch) | |
tree | dbc2cf2872a0219365bf8589d3bd6b5232170141 /tools | |
parent | e07a74dc0fed1570a4fbf3240cfb06a93b8f904e (diff) | |
download | linux-e124bab08a51d80badd94fef78a8284fbe49799c.tar.xz |
net: mscc: ocelot: report ndo_get_stats64 from the wraparound-resistant ocelot->stats
[ Upstream commit e780e3193e889fd8358b862f7cd18ec5a4901caf ]
Rather than reading the stats64 counters directly from the 32-bit
hardware, it's better to rely on the output produced by the periodic
ocelot_port_update_stats().
It would be even better to call ocelot_port_update_stats() right from
ocelot_get_stats64() to make sure we report the current values rather
than the ones from 2 seconds ago. But we need to export
ocelot_port_update_stats() from the switch lib towards the switchdev
driver for that, and future work will largely undo that.
There are more ocelot-based drivers waiting to be introduced, an example
of which is the SPI-controlled VSC7512. In that driver's case, it will
be impossible to call ocelot_port_update_stats() from ndo_get_stats64
context, since the latter is atomic, and reading the stats over SPI is
sleepable. So the compromise taken here, which will also hold going
forward, is to report 64-bit counters to stats64, which are not 100% up
to date.
Fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support")
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