All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: David Ahern <dsahern@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>
Subject: [PATCH iproute2-next 00/11] ip stats: A new front-end for RTM_GETSTATS / RTM_SETSTATS
Date: Fri, 22 Apr 2022 10:30:49 +0200	[thread overview]
Message-ID: <cover.1650615982.git.petrm@nvidia.com> (raw)

A new rtnetlink message, RTM_SETSTATS, has been added recently in kernel
commit ca0a53dcec94 ("Merge branch 'net-hw-counters-for-soft-devices'").

At the same time, RTM_GETSTATS has been around for a while. The users of
this API are spread in a couple different places: "ip link xstats" reads
stats from the IFLA_STATS_LINK_XSTATS and _XSTATS_SLAVE subgroups, "ip
link afstats" then reads IFLA_STATS_AF_SPEC.

Finally, to read IFLA_STATS_LINK_OFFLOAD_XSTATS, one would use ifstats.
This does not seem to be a good fit for IFLA_OFFLOAD_XSTATS_HW_S_INFO in
particular.

The obvious place to expose all these offload stats suites would be
under a new link subcommand "ip link offload_xstats", or similar, which
would then have syntax for both showing stats and setting them.

However, this looks like a good opportunity to introduce a new top-level
command, "ip stats", that would be the go-to place to access anything
backed by RTM_GETSTATS and RTM_SETSTATS.

This patchset therefore does the following:

- It adds the new "stats" infrastructure

- It adds specifically the ability to toggle and show the suites that
  were recently added to Linux, IFLA_OFFLOAD_XSTATS_HW_S_INFO and
  IFLA_OFFLOAD_XSTATS_L3_STATS.

- It adds support to dump IFLA_OFFLOAD_XSTATS_CPU_HIT, which was not
  available under "ip" at all.

- Does all this in a way that is easy to extend for new stats suites.

The patchset proceeds as follows:

- Patches #1 and #2 lay some groundwork and tweak existing code.

- Patch #3 adds the shell of the new "ip stats" command.

- Patch #4 adds "ip stats set" and the ability to toggle l3_stats in
  particular.

- Patch #5 adds "ip stats show", but no actual stats suites.

- Patches #6-#9 add support for showing individual stats suites:
  respectively, IFLA_STATS_LINK_64, IFLA_OFFLOAD_XSTATS_CPU_HIT,
  IFLA_OFFLOAD_XSTATS_HW_S_INFO and IFLA_OFFLOAD_XSTATS_L3_STATS.

- Patch #10 adds support for monitoring stats events to "ip monitor".

- Patch #11 adds man page verbiage for the above.

The plan is to contribute support for afstats and xstats in a follow-up
patch set.

Petr Machata (11):
  libnetlink: Add filtering to rtnl_statsdump_req_filter()
  ip: Publish functions for stats formatting
  ip: Add a new family of commands, "stats"
  ipstats: Add a "set" command
  ipstats: Add a shell of "show" command
  ipstats: Add a group "link"
  ipstats: Add a group "offload", subgroup "cpu_hit"
  ipstats: Add offload subgroup "hw_stats_info"
  ipstats: Add offload subgroup "l3_stats"
  ipmonitor: Add monitoring support for stats events
  man: Add man pages for the "stats" functions

 bridge/vlan.c         |    6 +-
 include/libnetlink.h  |   11 +-
 ip/Makefile           |    3 +-
 ip/ip.c               |    1 +
 ip/ip_common.h        |   31 +
 ip/ipaddress.c        |   33 +-
 ip/iplink.c           |    3 +-
 ip/iplink_xstats.c    |    3 +-
 ip/ipmonitor.c        |   16 +-
 ip/ipstats.c          | 1241 +++++++++++++++++++++++++++++++++++++++++
 lib/libnetlink.c      |   19 +-
 man/man8/ip-monitor.8 |    2 +-
 man/man8/ip-stats.8   |  160 ++++++
 man/man8/ip.8         |    7 +-
 misc/ifstat.c         |    2 +-
 15 files changed, 1512 insertions(+), 26 deletions(-)
 create mode 100644 ip/ipstats.c
 create mode 100644 man/man8/ip-stats.8

-- 
2.31.1


             reply	other threads:[~2022-04-22  8:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22  8:30 Petr Machata [this message]
2022-04-22  8:30 ` [PATCH iproute2-next 01/11] libnetlink: Add filtering to rtnl_statsdump_req_filter() Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 02/11] ip: Publish functions for stats formatting Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 03/11] ip: Add a new family of commands, "stats" Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 04/11] ipstats: Add a "set" command Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 05/11] ipstats: Add a shell of "show" command Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 06/11] ipstats: Add a group "link" Petr Machata
2022-05-01 14:52   ` Ido Schimmel
2022-05-02  4:56     ` David Ahern
2022-05-02  6:19       ` Ido Schimmel
2022-05-02  9:37     ` Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 07/11] ipstats: Add a group "offload", subgroup "cpu_hit" Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 08/11] ipstats: Add offload subgroup "hw_stats_info" Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 09/11] ipstats: Add offload subgroup "l3_stats" Petr Machata
2022-04-22  8:30 ` [PATCH iproute2-next 10/11] ipmonitor: Add monitoring support for stats events Petr Machata
2022-04-22  8:31 ` [PATCH iproute2-next 11/11] man: Add man pages for the "stats" functions Petr Machata
2022-04-28  2:20 ` [PATCH iproute2-next 00/11] ip stats: A new front-end for RTM_GETSTATS / RTM_SETSTATS patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1650615982.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=dsahern@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.