From: Heiner Kallweit <hkallweit1@gmail.com>
To: "David Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>, "Bjørn Mork" <bjorn@mork.no>,
"Oliver Neukum" <oneukum@suse.com>,
"Igor Mitsyanko" <imitsyanko@quantenna.com>,
"Sergey Matyukevich" <geomatsi@gmail.com>,
"Kalle Valo" <kvalo@codeaurora.org>,
"Roopa Prabhu" <roopa@nvidia.com>,
"Nikolay Aleksandrov" <nikolay@nvidia.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Alexey Kuznetsov" <kuznet@ms2.inr.ac.ru>,
"Hideaki YOSHIFUJI" <yoshfuji@linux-ipv6.org>,
"Johannes Berg" <johannes@sipsolutions.net>,
"Pravin B Shelar" <pshelar@ovn.org>,
"Steffen Klassert" <steffen.klassert@secunet.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
linux-rdma@vger.kernel.org,
Linux USB Mailing List <linux-usb@vger.kernel.org>,
linux-wireless <linux-wireless@vger.kernel.org>,
bridge@lists.linux-foundation.org
Subject: [PATCH net-next 08/12] net: dsa: use new function dev_fetch_sw_netstats
Date: Sun, 11 Oct 2020 21:41:27 +0200 [thread overview]
Message-ID: <4c7b9a8d-caa2-52dd-8973-10f4e2892dd6@gmail.com> (raw)
In-Reply-To: <a46f539e-a54d-7e92-0372-cd96bb280729@gmail.com>
Simplify the code by using new function dev_fetch_sw_netstats().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
net/dsa/slave.c | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index e7c1d62fd..3bc5ca40c 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1221,28 +1221,9 @@ static void dsa_slave_get_stats64(struct net_device *dev,
struct rtnl_link_stats64 *stats)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct pcpu_sw_netstats *s;
- unsigned int start;
- int i;
netdev_stats_to_stats64(stats, &dev->stats);
- for_each_possible_cpu(i) {
- u64 tx_packets, tx_bytes, rx_packets, rx_bytes;
-
- s = per_cpu_ptr(p->stats64, i);
- do {
- start = u64_stats_fetch_begin_irq(&s->syncp);
- tx_packets = s->tx_packets;
- tx_bytes = s->tx_bytes;
- rx_packets = s->rx_packets;
- rx_bytes = s->rx_bytes;
- } while (u64_stats_fetch_retry_irq(&s->syncp, start));
-
- stats->tx_packets += tx_packets;
- stats->tx_bytes += tx_bytes;
- stats->rx_packets += rx_packets;
- stats->rx_bytes += rx_bytes;
- }
+ dev_fetch_sw_netstats(stats, p->stats64);
}
static int dsa_slave_get_rxnfc(struct net_device *dev,
--
2.28.0
next prev parent reply other threads:[~2020-10-11 19:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-11 19:34 [PATCH net-next 00/12] net: add and use function dev_fetch_sw_netstats for fetching pcpu_sw_netstats Heiner Kallweit
2020-10-11 19:36 ` [PATCH net-next 01/12] net: core: add " Heiner Kallweit
2020-10-11 19:54 ` Stephen Hemminger
2020-10-11 20:18 ` Heiner Kallweit
2020-10-11 22:07 ` Jakub Kicinski
2020-10-11 19:37 ` [PATCH net-next 02/12] IB/hfi1: use new function dev_fetch_sw_netstats Heiner Kallweit
2020-10-11 19:38 ` [PATCH net-next 03/12] net: macsec: " Heiner Kallweit
2020-10-11 19:38 ` [PATCH net-next 04/12] net: usb: qmi_wwan: " Heiner Kallweit
2020-10-12 6:47 ` Bjørn Mork
2020-10-11 19:39 ` [PATCH net-next 05/12] net: usbnet: " Heiner Kallweit
2020-10-11 19:40 ` [PATCH net-next 06/12] qtnfmac: " Heiner Kallweit
2020-10-12 7:10 ` Kalle Valo
2020-10-11 19:40 ` [PATCH net-next 07/12] net: bridge: " Heiner Kallweit
2020-10-11 19:41 ` Heiner Kallweit [this message]
2020-10-11 20:15 ` [PATCH net-next 08/12] net: dsa: " Vladimir Oltean
2020-10-12 1:49 ` Florian Fainelli
2020-10-11 19:42 ` [PATCH net-next 09/12] iptunnel: " Heiner Kallweit
2020-10-11 19:42 ` [PATCH net-next 10/12] mac80211: " Heiner Kallweit
2020-10-11 19:43 ` [PATCH net-next 11/12] net: openvswitch: " Heiner Kallweit
2020-10-11 19:44 ` [PATCH net-next 12/12] xfrm: " Heiner Kallweit
2020-10-11 22:10 ` [PATCH net-next 00/12] net: add and use function dev_fetch_sw_netstats for fetching pcpu_sw_netstats Jakub Kicinski
2020-10-11 22:29 ` Heiner Kallweit
2020-10-11 22:41 ` Jakub Kicinski
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=4c7b9a8d-caa2-52dd-8973-10f4e2892dd6@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=bjorn@mork.no \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=geomatsi@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=imitsyanko@quantenna.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=kvalo@codeaurora.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=olteanv@gmail.com \
--cc=oneukum@suse.com \
--cc=pshelar@ovn.org \
--cc=roopa@nvidia.com \
--cc=steffen.klassert@secunet.com \
--cc=vivien.didelot@gmail.com \
--cc=yoshfuji@linux-ipv6.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).