Merge branch 'felix-dsa-ethtool-stats'
authorDavid S. Miller <davem@davemloft.net>
Fri, 9 Sep 2022 09:59:13 +0000 (10:59 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Sep 2022 09:59:13 +0000 (10:59 +0100)
commit6fff926141416a971fcdf7fb71fff404ee53ad47
treec5d1bf616ac8308cc9c165567a837300d77b1742
parent34df6a8a50aa72c4ac4fd65033a2798fc321adf8
parent4d1d157fb6a49f6720a3fb3135299e475d5bc844
Merge branch 'felix-dsa-ethtool-stats'

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>