Vladimir Oltean says:
====================
Standardized ethtool counters for Felix DSA driver
The main purpose of this change set is to add reporting of structured
ethtool statistics counters to the felix DSA driver (see patch 11/14 for
details), as a prerequisite for extending these counters to the
eMAC/pMAC defined by the IEEE MAC Merge layer.
Along the way, the main purpose has diverged into multiple sub-purposes
which are also tackled:
- A bug fix patch submitted to "net" has made ocelot->stats_lock a spin
lock, which is not an issue currently (all Ocelot switches are MMIO),
but will be an issue for Colin Foster who is working on a SPI
controlled Ocelot switch. We restore the hardware access to port stats
to be sleepable.
- PSFP (tc-gate, tc-police) tc-flower stats on Felix use a non-converged
procedure to access the hardware counters, although the interface is
very similar to what is used for the port counters. Benefit from the
logic used for the port counters, which gains us 64-bit tc-flower
stats that are resistant to overflows.
- Also export the ndo_get_stats64 method used by the ocelot switchdev
driver to Felix, so that ifconfig sees something hardware-based as
well (but not 100% up to date).
- Create a new ocelot_stats.c file which groups everything stats-related
together. Along with this, also move some other topic-specific code,
like FDB and PTP, out of the main ocelot.c.
- Minimize the lines of code for the stats layout definitions. These
changes alone cause the patch set to have an overall reduction of
lines of code in the driver, even though we are adding new
functionality as well.
Tested the port counters with lockdep and friends, with some
garden-variety traffic (ping, iperf3) and the PSFP counters with
tools/testing/selftests/drivers/net/ocelot/psfp.sh.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>