linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 net-next 0/5] use bulk reads for ocelot statistics
@ 2022-02-10  4:13 Colin Foster
  2022-02-10  4:13 ` [PATCH v6 net-next 1/5] net: mscc: ocelot: fix mutex lock error during ethtool stats read Colin Foster
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Colin Foster @ 2022-02-10  4:13 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: Jakub Kicinski, David S. Miller, UNGLinuxDriver,
	Alexandre Belloni, Claudiu Manoil, Vladimir Oltean

Ocelot loops over memory regions to gather stats on different ports.
These regions are mostly continuous, and are ordered. This patch set
uses that information to break the stats reads into regions that can get
read in bulk.

The motiviation is for general cleanup, but also for SPI. Performing two
back-to-back reads on a SPI bus require toggling the CS line, holding,
re-toggling the CS line, sending 3 address bytes, sending N padding
bytes, then actually performing the read. Bulk reads could reduce almost
all of that overhead, but require that the reads are performed via
regmap_bulk_read.

Verified with eth0 hooked up to the CPU port:
# ethtool -S eth0 | grep -v ": 0"
NIC statistics:
     Good Rx Frames: 8352
     Rx Octets: 10972241
     Good Tx Frames: 1674
     Tx Octets: 146253
     Rx + Tx 65-127 Octet Frames: 2565
     Rx + Tx 128-255 Octet Frames: 93
     Rx + Tx 256-511 Octet Frames: 158
     Rx + Tx 512-1023 Octet Frames: 271
     Rx + Tx 1024-Up Octet Frames: 6939
     Net Octets: 11118494
     Rx DMA chan 0: head_enqueue: 1
     Rx DMA chan 0: tail_enqueue: 8479
     Rx DMA chan 0: busy_dequeue: 7614
     Rx DMA chan 0: good_dequeue: 8352
     Tx DMA chan 0: head_enqueue: 1335
     Tx DMA chan 0: tail_enqueue: 339
     Tx DMA chan 0: misqueued: 339
     Tx DMA chan 0: empty_dequeue: 1335
     Tx DMA chan 0: good_dequeue: 1674
     p00_rx_octets: 146253
     p00_rx_unicast: 1674
     p00_rx_frames_65_to_127_octets: 1666
     p00_rx_frames_128_to_255_octets: 7
     p00_rx_frames_over_1526_octets: 1
     p00_tx_octets: 10972241
     p00_tx_unicast: 8352
     p00_tx_frames_65_to_127_octets: 899
     p00_tx_frames_128_255_octets: 86
     p00_tx_frames_256_511_octets: 158
     p00_tx_frames_512_1023_octets: 271
     p00_tx_frames_1024_1526_octets: 222
     p00_tx_frames_over_1526_octets: 6716
     p00_tx_green_prio_0: 8352


And with swp2 connected to swp3 with STP enabled:
# ethtool -S swp2 | grep -v ": 0"
NIC statistics:
     tx_packets: 397
     tx_bytes: 20634
     rx_packets: 1
     rx_bytes: 46
     rx_octets: 64
     rx_multicast: 1
     rx_frames_below_65_octets: 1
     rx_classified_drops: 1
     tx_octets: 46586
     tx_multicast: 404
     tx_broadcast: 303
     tx_frames_below_65_octets: 397
     tx_frames_65_to_127_octets: 306
     tx_frames_128_255_octets: 4
     tx_green_prio_0: 311
     tx_green_prio_7: 396
# ethtool -S swp3 | grep -v ": 0"
NIC statistics:
     tx_packets: 1
     tx_bytes: 52
     rx_packets: 711
     rx_bytes: 34050
     rx_octets: 46848
     rx_multicast: 406
     rx_broadcast: 305
     rx_frames_below_65_octets: 399
     rx_frames_65_to_127_octets: 308
     rx_frames_128_to_255_octets: 4
     rx_classified_drops: 398
     rx_green_prio_0: 313
     tx_octets: 64
     tx_multicast: 1
     tx_frames_below_65_octets: 1
     tx_green_prio_7: 1


v1 > v2: reword commit messages
v2 > v3: correctly mark this for net-next when sending
v3 > v4: calloc array instead of zalloc per review
v4 > v5:
    Apply CR suggestions for whitespace
    Fix calloc / zalloc mixup
    Properly destroy workqueues
    Add third commit to split long macros
v5 > v6:
    Fix functionality - v5 was improperly tested
    Add bugfix for ethtool mutex lock
    Remove unnecessary ethtool stats reads


Colin Foster (5):
  net: mscc: ocelot: fix mutex lock error during ethtool stats read
  net: mscc: ocelot: remove unnecessary stat reading from ethtool
  net: ocelot: align macros for consistency
  net: mscc: ocelot: add ability to perform bulk reads
  net: mscc: ocelot: use bulk reads for stats

 drivers/net/ethernet/mscc/ocelot.c    | 97 +++++++++++++++++++++------
 drivers/net/ethernet/mscc/ocelot_io.c | 13 ++++
 include/soc/mscc/ocelot.h             | 57 +++++++++++-----
 3 files changed, 132 insertions(+), 35 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-02-10 15:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10  4:13 [PATCH v6 net-next 0/5] use bulk reads for ocelot statistics Colin Foster
2022-02-10  4:13 ` [PATCH v6 net-next 1/5] net: mscc: ocelot: fix mutex lock error during ethtool stats read Colin Foster
2022-02-10  9:50   ` Vladimir Oltean
2022-02-10  4:13 ` [PATCH v6 net-next 2/5] net: mscc: ocelot: remove unnecessary stat reading from ethtool Colin Foster
2022-02-10 10:34   ` Vladimir Oltean
2022-02-10  4:13 ` [PATCH v6 net-next 3/5] net: ocelot: align macros for consistency Colin Foster
2022-02-10  4:13 ` [PATCH v6 net-next 4/5] net: mscc: ocelot: add ability to perform bulk reads Colin Foster
2022-02-10  4:13 ` [PATCH v6 net-next 5/5] net: mscc: ocelot: use bulk reads for stats Colin Foster
2022-02-10 10:36   ` Vladimir Oltean
2022-02-10 14:37     ` Colin Foster
2022-02-10 15:21     ` Colin Foster
2022-02-10 15:27       ` Vladimir Oltean
2022-02-10 15:35         ` Colin Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).