From: Jeremy Kerr <jk@codeconstruct.com.au>
To: David Ahern <dsahern@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next v3 3/3] net: vrf: move to generic dstat helpers
Date: Fri, 07 Jun 2024 18:25:26 +0800 [thread overview]
Message-ID: <20240607-dstats-v3-3-cc781fe116f7@codeconstruct.com.au> (raw)
In-Reply-To: <20240607-dstats-v3-0-cc781fe116f7@codeconstruct.com.au>
The vrf driver has its own dstats-to-rtnl_link_stats64 collection, but
we now have a generic implementation for dstats collection, so switch to
this.
In doing so, we fix a minor issue where the (non-percpu)
dev->stats->tx_errors value was never collected into rtnl_link_stats64,
as the generic dev_get_dstats64() consumes the starting values from
dev->stats.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
v3:
- we no longer need ->ndo_get_stats64, as the collection is now
performed by default for NETDEV_PCPU_STAT_DSTATS devices.
---
drivers/net/vrf.c | 28 ----------------------------
1 file changed, 28 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 5018831b2a79..9af316cdd8b3 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -137,33 +137,6 @@ static void vrf_tx_error(struct net_device *vrf_dev, struct sk_buff *skb)
kfree_skb(skb);
}
-static void vrf_get_stats64(struct net_device *dev,
- struct rtnl_link_stats64 *stats)
-{
- int i;
-
- for_each_possible_cpu(i) {
- const struct pcpu_dstats *dstats;
- u64 tbytes, tpkts, tdrops, rbytes, rpkts;
- unsigned int start;
-
- dstats = per_cpu_ptr(dev->dstats, i);
- do {
- start = u64_stats_fetch_begin(&dstats->syncp);
- tbytes = u64_stats_read(&dstats->tx_bytes);
- tpkts = u64_stats_read(&dstats->tx_packets);
- tdrops = u64_stats_read(&dstats->tx_drops);
- rbytes = u64_stats_read(&dstats->rx_bytes);
- rpkts = u64_stats_read(&dstats->rx_packets);
- } while (u64_stats_fetch_retry(&dstats->syncp, start));
- stats->tx_bytes += tbytes;
- stats->tx_packets += tpkts;
- stats->tx_dropped += tdrops;
- stats->rx_bytes += rbytes;
- stats->rx_packets += rpkts;
- }
-}
-
static struct vrf_map *netns_vrf_map(struct net *net)
{
struct netns_vrf *nn_vrf = net_generic(net, vrf_net_id);
@@ -1201,7 +1174,6 @@ static const struct net_device_ops vrf_netdev_ops = {
.ndo_uninit = vrf_dev_uninit,
.ndo_start_xmit = vrf_xmit,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_get_stats64 = vrf_get_stats64,
.ndo_add_slave = vrf_add_slave,
.ndo_del_slave = vrf_del_slave,
};
--
2.39.2
next prev parent reply other threads:[~2024-06-07 10:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 10:25 [PATCH net-next v3 0/3] net: core: Unify dstats with tstats and lstats, implement generic dstats collection Jeremy Kerr
2024-06-07 10:25 ` [PATCH net-next v3 1/3] net: core,vrf: Change pcpu_dstat fields to u64_stats_t Jeremy Kerr
2024-06-08 13:37 ` Simon Horman
2024-06-07 10:25 ` [PATCH net-next v3 2/3] net: core: Implement dstats-type stats collections Jeremy Kerr
2024-06-08 13:37 ` Simon Horman
2024-06-07 10:25 ` Jeremy Kerr [this message]
2024-06-08 13:37 ` [PATCH net-next v3 3/3] net: vrf: move to generic dstat helpers Simon Horman
2024-06-10 15:19 ` [PATCH net-next v3 0/3] net: core: Unify dstats with tstats and lstats, implement generic dstats collection David Ahern
2024-06-12 3:00 ` 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=20240607-dstats-v3-3-cc781fe116f7@codeconstruct.com.au \
--to=jk@codeconstruct.com.au \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@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 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).