netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: David Ahern <dsahern@kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	<netdev@vger.kernel.org>
Cc: Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	"Jakub Kicinski" <kuba@kernel.org>, <mlxsw@nvidia.com>
Subject: [PATCH iproute2-next v2 0/4] Support for nexthop group statistics
Date: Thu, 14 Mar 2024 15:52:11 +0100	[thread overview]
Message-ID: <cover.1710427655.git.petrm@nvidia.com> (raw)

Next hop group stats allow verification of balancedness of a next hop
group. The feature was merged in kernel commit 7cf497e5a122 ("Merge branch
'nexthop-group-stats'"). This patchset adds to ip the corresponding
support.

NH group stats come in two flavors: as statistics for SW and for HW
datapaths. The former is shown when -s is given to "ip nexthop". The latter
demands more work from the kernel, and possibly driver and HW, and might
not be always necessary. Therefore tie it to -s -s, similarly to how ip
link shows more detailed stats when -s is given twice.

Here's an example usage:

 # ip link add name gre1 up type gre \
      local 172.16.1.1 remote 172.16.1.2 tos inherit
 # ip nexthop replace id 1001 dev gre1
 # ip nexthop replace id 1002 dev gre1
 # ip nexthop replace id 1111 group 1001/1002 hw_stats on
 # ip -s -s -j -p nexthop show id 1111
 [ {
 	[ ...snip... ]
         "hw_stats": {
             "enabled": true,
             "used": true
         },
         "group_stats": [ {
                 "id": 1001,
                 "packets": 0,
                 "packets_hw": 0
             },{
                 "id": 1002,
                 "packets": 0,
                 "packets_hw": 0
             } ]
     } ]

hw_stats.enabled shows whether hw_stats have been requested for the given
group. hw_stats.used shows whether any driver actually implemented the
counter. group_stats[].packets show the total stats, packets_hw only the
HW-datapath stats.

v2:
- Patch #1:
    - have rta_getattr_uint() support 8- and 16-bit quantities as well
- Patch #2:
    - Use print_nl() for the newlines

Petr Machata (4):
  libnetlink: Add rta_getattr_uint()
  ip: ipnexthop: Support dumping next hop group stats
  ip: ipnexthop: Support dumping next hop group HW stats
  ip: ipnexthop: Allow toggling collection of nexthop group HW
    statistics

 include/libnetlink.h  |  14 +++++
 ip/ipnexthop.c        | 129 ++++++++++++++++++++++++++++++++++++++++++
 ip/nh_common.h        |  11 ++++
 man/man8/ip-nexthop.8 |   2 +
 4 files changed, 156 insertions(+)

-- 
2.43.0


             reply	other threads:[~2024-03-14 14:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 14:52 Petr Machata [this message]
2024-03-14 14:52 ` [PATCH iproute2-next v2 1/4] libnetlink: Add rta_getattr_uint() Petr Machata
2024-03-14 14:52 ` [PATCH iproute2-next v2 2/4] ip: ipnexthop: Support dumping next hop group stats Petr Machata
2024-03-14 15:51   ` Stephen Hemminger
2024-03-15 11:15     ` Petr Machata
2024-03-14 14:52 ` [PATCH iproute2-next v2 3/4] ip: ipnexthop: Support dumping next hop group HW stats Petr Machata
2024-03-14 14:52 ` [PATCH iproute2-next v2 4/4] ip: ipnexthop: Allow toggling collection of nexthop group HW statistics Petr Machata
2024-03-15 15:10 ` [PATCH iproute2-next v2 0/4] Support for nexthop group statistics 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.1710427655.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=dsahern@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@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 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).