netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next v2 0/4] ip: Support bridge VLAN stats in `ip stats'
@ 2025-06-09 16:05 Petr Machata
  2025-06-09 16:05 ` [PATCH iproute2-next v2 1/4] ip: ipstats: Iterate all xstats attributes Petr Machata
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Petr Machata @ 2025-06-09 16:05 UTC (permalink / raw)
  To: David Ahern, netdev
  Cc: Ido Schimmel, Nikolay Aleksandrov, bridge, Petr Machata

ip stats displays bridge-related multicast and STP stats, but not VLAN
stats. There is code for requesting, decoding and formatting these stats
accessible through `bridge -s vlan', but the `ip stats' suite lacks it. In
this patchset, extract the `bridge vlan' code to a generally accessible
place and extend `ip stats' to use it.

This reuses the existing display and JSON format, and plugs it into the
existing `ip stats' hierarchy:

 # ip stats show dev v2 group xstats_slave subgroup bridge suite vlan
 2: v2: group xstats_slave subgroup bridge suite vlan
                   10
                     RX: 3376 bytes 50 packets
                     TX: 2824 bytes 44 packets

                   20
                     RX: 684 bytes 7 packets
                     TX: 0 bytes 0 packets

 # ip -j -p stats show dev v2 group xstats_slave subgroup bridge suite vlan
 [ {
         "ifindex": 2,
         "ifname": "v2",
         "group": "xstats_slave",
         "subgroup": "bridge",
         "suite": "vlan",
         "vlans": [ {
                 "vid": 10,
                 "rx_bytes": 3376,
                 "rx_packets": 50,
                 "tx_bytes": 2824,
                 "tx_packets": 44
             },{
                 "vid": 20,
                 "rx_bytes": 684,
                 "rx_packets": 7,
                 "tx_bytes": 0,
                 "tx_packets": 0
             } ]
     } ]

Similarly for the master stats:

 # ip stats show dev br1 group xstats subgroup bridge suite vlan
 211: br1: group xstats subgroup bridge suite vlan
                   10
                     RX: 3376 bytes 50 packets
                     TX: 2824 bytes 44 packets

                   20
                     RX: 684 bytes 7 packets
                     TX: 0 bytes 0 packets

 # ip -j -p stats show dev br1 group xstats subgroup bridge suite vlan
 [ {
         "ifindex": 211,
         "ifname": "br1",
         "group": "xstats",
         "subgroup": "bridge",
         "suite": "vlan",
         "vlans": [ {
                 "vid": 10,
                 "flags": [ ],
                 "rx_bytes": 3376,
                 "rx_packets": 50,
                 "tx_bytes": 2824,
                 "tx_packets": 44
             },{
                 "vid": 20,
                 "flags": [ ],
                 "rx_bytes": 684,
                 "rx_packets": 7,
                 "tx_bytes": 0,
                 "tx_packets": 0
             } ]
     } ]

v2:
- Patch #1:
    - Use rtattr_for_each_nested
    - Drop #include <alloca.h>, it's not used anymore
- Patch #3:
    - Add MAINTAINERS entry for the module
- Patch #4:
    - Add the master stats as well.

Petr Machata (4):
  ip: ipstats: Iterate all xstats attributes
  ip: ip_common: Drop ipstats_stat_desc_xstats::inner_max
  lib: bridge: Add a module for bridge-related helpers
  ip: iplink_bridge: Support bridge VLAN stats in `ip stats'

 MAINTAINERS        |  2 ++
 bridge/vlan.c      | 50 +++++---------------------------------------
 include/bridge.h   | 11 ++++++++++
 ip/ip_common.h     |  1 -
 ip/iplink_bond.c   |  2 --
 ip/iplink_bridge.c | 52 ++++++++++++++++++++++++++++++++++++++++++----
 ip/ipstats.c       | 17 +++++++--------
 lib/Makefile       |  3 ++-
 lib/bridge.c       | 47 +++++++++++++++++++++++++++++++++++++++++
 9 files changed, 122 insertions(+), 63 deletions(-)
 create mode 100644 include/bridge.h
 create mode 100644 lib/bridge.c

-- 
2.49.0


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

end of thread, other threads:[~2025-06-10 13:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09 16:05 [PATCH iproute2-next v2 0/4] ip: Support bridge VLAN stats in `ip stats' Petr Machata
2025-06-09 16:05 ` [PATCH iproute2-next v2 1/4] ip: ipstats: Iterate all xstats attributes Petr Machata
2025-06-10  7:14   ` Ido Schimmel
2025-06-10 12:20   ` Nikolay Aleksandrov
2025-06-09 16:05 ` [PATCH iproute2-next v2 2/4] ip: ip_common: Drop ipstats_stat_desc_xstats::inner_max Petr Machata
2025-06-10 12:21   ` Nikolay Aleksandrov
2025-06-09 16:05 ` [PATCH iproute2-next v2 3/4] lib: bridge: Add a module for bridge-related helpers Petr Machata
2025-06-10  7:16   ` Ido Schimmel
2025-06-10 12:21   ` Nikolay Aleksandrov
2025-06-09 16:05 ` [PATCH iproute2-next v2 4/4] ip: iplink_bridge: Support bridge VLAN stats in `ip stats' Petr Machata
2025-06-10  7:22   ` Ido Schimmel
2025-06-10 13:14     ` Petr Machata
2025-06-10 12:21   ` Nikolay Aleksandrov

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).