Skip to content

ethtool: add uAPI for reading standard stats

Jakub Kicinski netdev 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 13 repliesIn review
  2. v19 patches 5 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9docs: networking: extend the statistics documentationDocumentation/networking/statistics.rst+42 -20 replies
2/9docs: ethtool: document standard statisticsDocumentation/networking/ethtool-netlink.rst+82 -00 replies
3/9ethtool: add a new command for reading standard statsinclude/linux/ethtool.h include/uapi/linux/ethtool.h include/uapi/linux/ethtool_netlink.h +5 more+287 -110 replies
4/9ethtool: add interface to read standard MAC statsinclude/linux/ethtool.h include/uapi/linux/ethtool.h include/uapi/linux/ethtool_netlink.h +3 more+182 -00 replies
5/9ethtool: add interface to read standard MAC Ctrl statsinclude/linux/ethtool.h include/uapi/linux/ethtool.h include/uapi/linux/ethtool_netlink.h +3 more+67 -00 replies
6/9ethtool: add interface to read RMON statsinclude/linux/ethtool.h include/uapi/linux/ethtool.h include/uapi/linux/ethtool_netlink.h +3 more+161 -02 replies
7/9mlxsw: implement ethtool standard statsdrivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c+129 -00 replies
8/9bnxt: implement ethtool standard statsdrivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+125 -01 reply
9/9mlx5: implement ethtool standard statsdrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c drivers/net/ethernet/mellanox/mlx5/core/en_stats.c drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+182 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH net-next v2 0/9] ethtool: add uAPI for reading standard stats

Continuing the effort of providing a unified access method to standard stats, and explicitly tying the definitions to the standards this series adds an API for general stats which do no fit into more targeted control APIs.

There is nothing clever here, just a netlink API for dumping statistics defined by standards and RFCs which today end up in ethtool -S under infinite variations of names.

This series adds basic IEEE stats (for PHY, MAC, Ctrl frames) and RMON stats. AFAICT other RFCs only duplicate the IEEE stats.

This series does _not_ add a netlink API to read driver-defined stats. There seems to be little to gain from moving that part to netlink.

The netlink message format is very simple, and aims to allow adding stats and groups with no changes to user tooling (which IIUC is expected for ethtool).

On user space side we can re-use -S, and make it dump standard stats if --groups are defined.

$ ethtool -S eth0 --groups eth-phy eth-mac eth-ctrl rmon
Stats for eth0:
eth-phy-SymbolErrorDuringCarrier: 0
eth-mac-FramesTransmittedOK: 0
eth-mac-FrameTooLongErrors: 0
eth-ctrl-MACControlFramesTransmitted: 0
eth-ctrl-MACControlFramesReceived: 1
eth-ctrl-UnsupportedOpcodesReceived: 0
rmon-etherStatsUndersizePkts: 0
rmon-etherStatsJabbers: 0
rmon-rx-etherStatsPkts64Octets: 1
rmon-rx-etherStatsPkts128to255Octets: 0
rmon-rx-etherStatsPkts1024toMaxOctets: 1
rmon-tx-etherStatsPkts64Octets: 1
rmon-tx-etherStatsPkts128to255Octets: 0
rmon-tx-etherStatsPkts1024toMaxOctets: 1

v1:

Driver support for mlxsw, mlx5 and bnxt included.

Compared to the RFC I went ahead with wrapping the stats into a 1:1 nest. Now IDs of stats can start from 0, at a cost of slightly "careful" u64 alignment handling.

v2:

Add missing kdoc in patch 5.

Jakub Kicinski (9):
docs: networking: extend the statistics documentation
docs: ethtool: document standard statistics
ethtool: add a new command for reading standard stats
ethtool: add interface to read standard MAC stats
ethtool: add interface to read standard MAC Ctrl stats
ethtool: add interface to read RMON stats
mlxsw: implement ethtool standard stats
bnxt: implement ethtool standard stats
mlx5: implement ethtool standard stats

 Documentation/networking/ethtool-netlink.rst  |  82 ++++
 Documentation/networking/statistics.rst       |  44 +-
 .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 125 ++++++
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  |  37 ++
 .../ethernet/mellanox/mlx5/core/en_stats.c    | 142 +++++-
 .../ethernet/mellanox/mlx5/core/en_stats.h    |  10 +
 .../mellanox/mlxsw/spectrum_ethtool.c         | 129 ++++++
 include/linux/ethtool.h                       |  96 ++++
 include/uapi/linux/ethtool.h                  |  10 +
 include/uapi/linux/ethtool_netlink.h          | 137 ++++++
 net/ethtool/Makefile                          |   2 +-
 net/ethtool/netlink.c                         |  10 +
 net/ethtool/netlink.h                         |   8 +
 net/ethtool/stats.c                           | 410 ++++++++++++++++++
 net/ethtool/strset.c                          |  25 ++
 15 files changed, 1257 insertions(+), 10 deletions(-)
 create mode 100644 net/ethtool/stats.c
Signature · 1 line
2.30.2