Vladimir Oltean e124bab08a 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>
2022-08-25 11:45:39 +02:00
..
2022-05-06 12:07:56 +01:00
2022-08-25 11:45:21 +02:00
2022-08-25 11:45:25 +02:00
2022-05-11 13:09:59 +01:00
2022-06-30 11:34:10 -07:00
2022-06-17 11:38:09 +01:00