Skip to content

ethtool, stats: introduce and use standard XDP stats

Alexander Lobakin bpf linux-doc lkml netdev virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest21 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21ethtool, stats: use a shorthand pointer in stats_prepare_data()net/ethtool/stats.c+11 -90 replies
2/21ethtool, stats: add compile-time checks for standard statsnet/ethtool/stats.c+9 -00 replies
3/21ethtool, stats: introduce standard XDP statisticsinclude/linux/ethtool.h include/uapi/linux/ethtool.h include/uapi/linux/ethtool_netlink.h +3 more+211 -119 replies
4/21ethernet, dpaa2: simplify per-channel Ethtool stats countingdrivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c+7 -20 replies
5/21ethernet, dpaa2: convert to standard XDP statsdrivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c+34 -60 replies
6/21ethernet, ena: constify src and syncp args of ena_safe_update_stat()drivers/net/ethernet/amazon/ena/ena_ethtool.c+2 -20 replies
7/21ethernet, ena: convert to standard XDP statsdrivers/net/ethernet/amazon/ena/ena_ethtool.c+40 -62 replies
8/21ethernet, enetc: convert to standard XDP statsdrivers/net/ethernet/freescale/enetc/enetc_ethtool.c+44 -140 replies
9/21ethernet, mvneta: rename xdp_xmit_err to xdp_xmit_dropsdrivers/net/ethernet/marvell/mvneta.c+9 -90 replies
10/21ethernet, mvneta: convert to standard XDP statsdrivers/net/ethernet/marvell/mvneta.c+52 -560 replies
11/21ethernet, mvpp2: rename xdp_xmit_err to xdp_xmit_dropsdrivers/net/ethernet/marvell/mvpp2/mvpp2.h drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+9 -90 replies
12/21ethernet, mvpp2: convert to standard XDP statsdrivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+20 -700 replies
13/21ethernet, sfc: convert to standard XDP statsdrivers/net/ethernet/sfc/ef100_ethtool.c drivers/net/ethernet/sfc/ethtool.c drivers/net/ethernet/sfc/ethtool_common.c +1 more+38 -41 reply
14/21veth: rename rx_drops to xdp_errorsdrivers/net/veth.c+15 -150 replies
15/21veth: rename xdp_xmit_errors to xdp_xmit_dropsdrivers/net/veth.c+9 -90 replies
16/21veth: rename drop xdp_ suffix from packets and bytes statsdrivers/net/veth.c+18 -180 replies
17/21veth: convert to standard XDP statsdrivers/net/veth.c+57 -340 replies
18/21virtio-net: rename xdp_tx{,__drops} SQ stats to xdp_xmit{,__drops}drivers/net/virtio_net.c+6 -60 replies
18/21virtio-net: rename xdp_tx{,__drops} SQ stats to xdp_xmit{,__drops}drivers/net/virtio_net.c+6 -60 replies
19/21virtio-net: don't mix error-caused drops with XDP_DROP casesdrivers/net/virtio_net.c+14 -40 replies
20/21virtio-net: convert to standard XDP statsdrivers/net/virtio_net.c+45 -70 replies
21/21Documentation, ethtool-netlink: update standard statistics documentationDocumentation/networking/ethtool-netlink.rst+30 -150 replies

Reviews trailers per patch

All 22 patches have a Reviewed-by or Acked-by.

PatchJesse BrandeburgEdward Cree
1/21R-b
2/21R-b
3/21R-b
4/21R-b
5/21R-b
6/21R-b
7/21R-b
8/21R-b
9/21R-b
10/21R-b
11/21R-b
12/21R-b
13/21R-b A-b
14/21R-b
15/21R-b
16/21R-b
17/21R-b
18/21R-b R-b
18/21R-b R-b
19/21R-b
20/21R-b
21/21R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 00/21] ethtool, stats: introduce and use standard XDP stats

This series follows the Jakub's work on standard statistics and unifies XDP statistics across [most of] the drivers. The only driver left unconverted is mlx5 -- it has rather complex statistics, so I believe it would be better to leave this up to its developers.

The stats itself consists of 12 counters:
- packets: number of frames passed to bpf_prog_run_xdp();
- errors: number of general XDP errors, if driver has one unified counter;
- aborted: number of XDP_ABORTED returns;
- drop: number of XDP_DROP returns;
- invalid: number of returns of unallowed values (i.e. not XDP_*);
- pass: number of XDP_PASS returns;
- redirect: number of successfully performed XDP_REDIRECT requests;
- redirect_errors: number of failed XDP_REDIRECT requests;
- tx: number of successfully performed XDP_TX requests;
- tx_errors: number of failed XDP_TX requests;
- xmit: number of xdp_frames successfully transmitted via .ndo_xdp_xmit();
- xmit_drops: number of frames dropped from .ndo_xdp_xmit().

As most drivers stores them on a per-channel basis, Ethtool standard stats infra has been expanded to support this. A new nested attribute has been added which indicated that the fields enclosed in this block are related to one particular channel. If Ethtool utility is older than the kernel, those blocks will just be skipped with no errors.
When the stats are not per-channel, Ethtool core treats them as regular and so does Ethtool utility display them. Otherwise, the example output looks like:

$ ./ethtool -S enp175s0f0 --all-groups
Standard stats for enp175s0f0:
[ snip ]
channel0-xdp-aborted: 1
channel0-xdp-drop: 2
channel0-xdp-illegal: 3
channel0-xdp-pass: 4
channel0-xdp-redirect: 5
[ snip ]

...and the JSON output looks like:

[ snip ]

        "xdp": {
            "per-channel": [
                "channel0": {
                    "aborted": 1,
                    "drop": 2,
                    "illegal": 3,
                    "pass": 4,
                    "redirect": 5,
[ snip ]
                } ]
        }

[ snip ]

Rouhly half of the commits are present to unify XDP stats logics across the drivers, and the first two are preparatory/housekeeping.

This set is also available here: [0]

[0] https://github.com/alobakin/linux/tree/xdp_stats

Alexander Lobakin (21):
ethtool, stats: use a shorthand pointer in stats_prepare_data() ethtool, stats: add compile-time checks for standard stats ethtool, stats: introduce standard XDP statistics ethernet, dpaa2: simplify per-channel Ethtool stats counting ethernet, dpaa2: convert to standard XDP stats
ethernet, ena: constify src and syncp args of ena_safe_update_stat() ethernet, ena: convert to standard XDP stats
ethernet, enetc: convert to standard XDP stats
ethernet, mvneta: rename xdp_xmit_err to xdp_xmit_drops ethernet, mvneta: convert to standard XDP stats
ethernet, mvpp2: rename xdp_xmit_err to xdp_xmit_drops ethernet, mvpp2: convert to standard XDP stats
ethernet, sfc: convert to standard XDP stats
veth: rename rx_drops to xdp_errors
veth: rename xdp_xmit_errors to xdp_xmit_drops
veth: rename drop xdp_ suffix from packets and bytes stats
veth: convert to standard XDP stats
virtio-net: rename xdp_tx{,__drops} SQ stats to xdp_xmit{,__drops}
virtio-net: don't mix error-caused drops with XDP_DROP cases
virtio-net: convert to standard XDP stats
Documentation, ethtool-netlink: update standard statistics
documentation

 Documentation/networking/ethtool-netlink.rst  |  45 +++--
 drivers/net/ethernet/amazon/ena/ena_ethtool.c |  50 +++++-
 .../net/ethernet/freescale/dpaa2/dpaa2-eth.h  |   7 +-
 .../ethernet/freescale/dpaa2/dpaa2-ethtool.c  |  38 +++-
 .../ethernet/freescale/enetc/enetc_ethtool.c  |  58 ++++--
 drivers/net/ethernet/marvell/mvneta.c         | 112 ++++++------
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h    |   2 +-
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  96 +++-------
 drivers/net/ethernet/sfc/ef100_ethtool.c      |   2 +
 drivers/net/ethernet/sfc/ethtool.c            |   2 +
 drivers/net/ethernet/sfc/ethtool_common.c     |  35 +++-
 drivers/net/ethernet/sfc/ethtool_common.h     |   3 +
 drivers/net/veth.c                            | 167 ++++++++++--------
 drivers/net/virtio_net.c                      |  76 ++++++--
 include/linux/ethtool.h                       |  36 ++++
 include/uapi/linux/ethtool.h                  |   2 +
 include/uapi/linux/ethtool_netlink.h          |  34 ++++
 net/ethtool/netlink.h                         |   1 +
 net/ethtool/stats.c                           | 163 +++++++++++++++--
 net/ethtool/strset.c                          |   5 +
 20 files changed, 659 insertions(+), 275 deletions(-)
Signature · 1 line
2.31.1