]> git.ipfire.org Git - thirdparty/linux.git/commit
net: nexthop: Expose nexthop group HW stats to user space
authorIdo Schimmel <idosch@nvidia.com>
Wed, 6 Mar 2024 12:49:21 +0000 (13:49 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Mar 2024 10:35:47 +0000 (10:35 +0000)
commit5072ae00aea434d922cabd1c3e6236350a77c4d7
tree7b35070d352f0eb55e57bbb996b6632708558302
parent746c19a52ec50b81422fd4772254d55e588d7df6
net: nexthop: Expose nexthop group HW stats to user space

Add netlink support for reading NH group hardware stats.

Stats collection is done through a new notifier,
NEXTHOP_EVENT_HW_STATS_REPORT_DELTA. Drivers that implement HW counters for
a given NH group are thereby asked to collect the stats and report back to
core by calling nh_grp_hw_stats_report_delta(). This is similar to what
netdevice L3 stats do.

Besides exposing number of packets that passed in the HW datapath, also
include information on whether any driver actually realizes the counters.
The core can tell based on whether it got any _report_delta() reports from
the drivers. This allows enabling the statistics at the group at any time,
with drivers opting into supporting them. This is also in line with what
netdevice L3 stats are doing.

So as not to waste time and space, tie the collection and reporting of HW
stats with a new op flag, NHA_OP_FLAG_DUMP_HW_STATS.

Co-developed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Kees Cook <keescook@chromium.org> # For the __counted_by bits
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/nexthop.h
include/uapi/linux/nexthop.h
net/ipv4/nexthop.c