netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Petr Machata <petrm@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Cc: Ido Schimmel <idosch@nvidia.com>, Simon Horman <horms@kernel.org>,
	mlxsw@nvidia.com, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH net-next v2 7/7] net: nexthop: Expose nexthop group HW stats to user space
Date: Fri, 1 Mar 2024 08:55:30 -0700	[thread overview]
Message-ID: <386b5f4d-2228-4e57-a4b3-fb17facf9029@kernel.org> (raw)
In-Reply-To: <f35433867d7bab05bbe0a1b4a09c3454cdefeb7b.1709217658.git.petrm@nvidia.com>

On 2/29/24 11:16 AM, Petr Machata wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> 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
> ---
> 
> Notes:
>     v2:
>     - Use uint to encode NHA_GROUP_STATS_ENTRY_PACKETS_HW
>     - Do not cancel outside of nesting in nla_put_nh_group_stats()
> 
>  include/net/nexthop.h        |  18 +++++
>  include/uapi/linux/nexthop.h |   9 +++
>  net/ipv4/nexthop.c           | 133 ++++++++++++++++++++++++++++++++---
>  3 files changed, 151 insertions(+), 9 deletions(-)
> 


> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
> index 15f108c440ae..169a003cc855 100644
> --- a/net/ipv4/nexthop.c
> +++ b/net/ipv4/nexthop.c
> @@ -43,7 +43,8 @@ static const struct nla_policy rtm_nh_policy_new[] = {
>  static const struct nla_policy rtm_nh_policy_get[] = {
>  	[NHA_ID]		= { .type = NLA_U32 },
>  	[NHA_OP_FLAGS]		= NLA_POLICY_MASK(NLA_U32,
> -						  NHA_OP_FLAG_DUMP_STATS),
> +						  NHA_OP_FLAG_DUMP_STATS |
> +						  NHA_OP_FLAG_DUMP_HW_STATS),
>  };
>  
>  static const struct nla_policy rtm_nh_policy_del[] = {
> @@ -56,7 +57,8 @@ static const struct nla_policy rtm_nh_policy_dump[] = {
>  	[NHA_MASTER]		= { .type = NLA_U32 },
>  	[NHA_FDB]		= { .type = NLA_FLAG },
>  	[NHA_OP_FLAGS]		= NLA_POLICY_MASK(NLA_U32,
> -						  NHA_OP_FLAG_DUMP_STATS),
> +						  NHA_OP_FLAG_DUMP_STATS |
> +						  NHA_OP_FLAG_DUMP_HW_STATS),

2 instances of the same mask; worth giving it a name.

Reviewed-by: David Ahern <dsahern@kernel.org>



  reply	other threads:[~2024-03-01 15:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 18:16 [PATCH net-next v2 0/7] Support for nexthop group statistics Petr Machata
2024-02-29 18:16 ` [PATCH net-next v2 1/7] net: nexthop: Adjust netlink policy parsing for a new attribute Petr Machata
2024-03-01 15:31   ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 2/7] net: nexthop: Add NHA_OP_FLAGS Petr Machata
2024-03-01 15:36   ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 3/7] net: nexthop: Add nexthop group entry stats Petr Machata
2024-03-01 15:36   ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 4/7] net: nexthop: Expose nexthop group stats to user space Petr Machata
2024-03-01 15:45   ` David Ahern
2024-03-01 17:17     ` Petr Machata
2024-03-01 17:28     ` Jakub Kicinski
2024-03-02  2:45       ` David Ahern
2024-03-03  3:36         ` Jakub Kicinski
2024-03-01 17:32   ` Eric Dumazet
2024-03-04 11:09     ` Petr Machata
2024-02-29 18:16 ` [PATCH net-next v2 5/7] net: nexthop: Add hardware statistics notifications Petr Machata
2024-03-01 15:46   ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 6/7] net: nexthop: Add ability to enable / disable hardware statistics Petr Machata
2024-03-01 15:49   ` David Ahern
2024-03-01 17:18     ` Petr Machata
2024-02-29 18:16 ` [PATCH net-next v2 7/7] net: nexthop: Expose nexthop group HW stats to user space Petr Machata
2024-03-01 15:55   ` David Ahern [this message]
2024-03-01 17:22     ` Petr Machata

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=386b5f4d-2228-4e57-a4b3-fb17facf9029@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    /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).