All of lore.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
	edumazet@google.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	horms@kernel.org, dsahern@kernel.org
Subject: [PATCH net-next 0/2] net: collect tstats automatically
Date: Wed, 28 Feb 2024 03:31:20 -0800	[thread overview]
Message-ID: <20240228113125.3473685-1-leitao@debian.org> (raw)

The commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and
convert veth & vrf") added a field in struct_netdevice, which tells what
type of statistics the driver supports.

That field is used primarily to allocate stats structures automatically,
but, it also could leveraged to simplify the drivers even further, such
as, if the driver relies in the default stats collection, then it
doesn't need to assign to .ndo_get_stats64. That means that drivers only
assign functions to .ndo_get_stats64 if they are using something
special.

I started to move some of these drivers[1][2][3] to use the core
allocation, and with this change in, I just need to touch the driver
once, and be able to simplify the whole stats allocation and collection
for generic case.

There are 44 devices today that could benefit from this simplification.

	# grep -r .ndo_get_stats64 | grep dev_get_tstats64 | wc -l
	44

As of today, netnext only has the `sit` driver fully ported to core
stats allocation, hence the second patch.

Links:
[1] https://lore.kernel.org/all/20240227182338.2739884-1-leitao@debian.org/
[2] https://lore.kernel.org/all/20240222144117.1370101-1-leitao@debian.org/
[3] https://lore.kernel.org/all/20240223115839.3572852-1-leitao@debian.org/

Breno Leitao (2):
  net: get stats64 if device if driver is configured
  net: sit: Do not set .ndo_get_stats64

 net/core/dev.c | 2 ++
 net/ipv6/sit.c | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.43.0


             reply	other threads:[~2024-02-28 11:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 11:31 Breno Leitao [this message]
2024-02-28 11:31 ` [PATCH net-next 1/2] net: get stats64 if device if driver is configured Breno Leitao
2024-02-28 14:34   ` Simon Horman
2024-02-28 11:31 ` [PATCH net-next 2/2] net: sit: Do not set .ndo_get_stats64 Breno Leitao
2024-02-28 14:34   ` Simon Horman
2024-02-29 12:00 ` [PATCH net-next 0/2] net: collect tstats automatically 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=20240228113125.3473685-1-leitao@debian.org \
    --to=leitao@debian.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.