Subject: [PATCH iproute2-next 00/10] ip stats: Support for xstats and afstats

From: Petr Machata <[email-masked]>
Date: Mon, 9 May 2022 15:59:53 +0200

The RTM_GETSTATS response attributes IFLA_STATS_LINK_XSTATS and
IFLA_STATS_LINK_XSTATS_SLAVE are used to carry statistics related to,
respectively, netdevices of a certain type, and netdevices enslaved to
netdevices of a certain type. IFLA_STATS_AF_SPEC are similarly used to
carry statistics specific to a certain address family.

In this patch set, add support for three new stats groups that cover the
above attributes: xstats, xstats_slave and afstats. Add bridge and bond
subgroups to the former two groups, and mpls subgroup to the latter one.

Now "group" is used for selecting the top-level attribute, and subgroup
for the link-type or address-family nest below it (bridge, bond, mpls in
this patchset). But xstats (both master and slave) are further
subdivided. E.g. in the case of bridge statistics, the two subdivisions
are called "stp" and "mcast". To make it possible to pick these sets,
add to the two selector levels of group and subgroup a third level,
suite, which is filtered in the userspace.

The patchset progresses as follows:

- Patches #1 and #2 fix up MPLS stats formatting and expose the helpers
  for reuse.
- Patch #3 adds ip stats group afstats and a subgroup mpls
- Patch #4 adds support for JSON formatting to MPLS

- Patch #5 adds support for the selector level "suite"
- Patch #6 adds groups "xstats" and "xstats_slave"
- Patches #7 and #8 first prepare helpers, then add support for the
  "bridge" subgroup of the xstats groups.
- Patch #9 adds the "bond" subgroup.

- Patch #10 adds manual page coverage.

Petr Machata (10):
  iplink: Fix formatting of MPLS stats
  iplink: Publish a function to format MPLS stats
  ipstats: Add a group "afstats", subgroup "mpls"
  iplink: Add JSON support to MPLS stats formatter
  ipstats: Add a third level of stats hierarchy, a "suite"
  ipstats: Add groups "xstats", "xstats_slave"
  iplink_bridge: Split bridge_print_stats_attr()
  ipstats: Expose bridge stats in ipstats
  ipstats: Expose bond stats in ipstats
  man: ip-stats.8: Describe groups xstats, xstats_slave and afstats

 ip/ip_common.h      |  22 +++
 ip/iplink.c         |  75 ++++++++--
 ip/iplink_bond.c    |  55 +++++++-
 ip/iplink_bridge.c  | 334 ++++++++++++++++++++++++++++----------------
 ip/ipstats.c        | 126 ++++++++++++++++-
 man/man8/ip-stats.8 |  50 ++++++-
 6 files changed, 522 insertions(+), 140 deletions(-)

-- 
2.31.1