[PATCH net 0/8] Fixes for Ocelot driver statistics

Vladimir Oltean
2022-08-16T13:54:20Z

This series contains bug fixes for the ocelot drivers (both switchdev
and DSA). Some concern the counters exposed to ethtool -S, and others to
the counters exposed to ifconfig. I'm aware that the changes are fairly
large, but I wanted to prioritize on a proper approach to addressing the
issues rather than a quick hack.

Some of the noticed problems:
- bad register offsets for some counters
- unhandled concurrency leading to corrupted counters
- unhandled 32-bit wraparound of ifconfig counters

The issues on the ocelot switchdev driver were noticed through code
inspection, I do not have the hardware to test.

This patch set necessarily converts ocelot->stats_lock from a mutex to a
spinlock. I know this affects Colin Foster's development with the SPI
controlled VSC7512. I have other changes prepared for net-next that
convert this back into a mutex (along with other changes in this area).

Vladimir Oltean (8):
net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters
net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters
net: mscc: ocelot: fix address of SYS_COUNT_TX_AGING counter
net: mscc: ocelot: turn stats_lock into a spinlock
net: mscc: ocelot: fix race between ndo_get_stats64 and
ocelot_check_stats_work
net: mscc: ocelot: make struct ocelot_stat_layout array indexable
net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset
net: mscc: ocelot: report ndo_get_stats64 from the
wraparound-resistant ocelot->stats

drivers/net/dsa/ocelot/felix_vsc9959.c | 558 +++++++++++++++++----
drivers/net/dsa/ocelot/seville_vsc9953.c | 553 ++++++++++++++++----
drivers/net/ethernet/mscc/ocelot.c | 62 ++-
drivers/net/ethernet/mscc/ocelot_net.c | 55 +-
drivers/net/ethernet/mscc/ocelot_vsc7514.c | 468 +++++++++++++----
drivers/net/ethernet/mscc/vsc7514_regs.c | 84 +++-
include/soc/mscc/ocelot.h | 179 ++++++-
7 files changed, 1581 insertions(+), 378 deletions(-)

--
2.34.1