summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2020-10-12 11:16:18 +0300
committerJakub Kicinski <kuba@kernel.org>2020-10-14 03:33:49 +0300
commita0d269810185b427feb1ba671cffeac0be17fa27 (patch)
tree8d23d416394aa9a98beff8bd806d68f6b41b9cbe /net
parentf3f04f0f3ab971a00e42ca3804d73bd8f1c88b4a (diff)
downloadlinux-a0d269810185b427feb1ba671cffeac0be17fa27.tar.xz
net: dsa: use new function dev_fetch_sw_netstats
Simplify the code by using new function dev_fetch_sw_netstats(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Tested-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/b6047017-8226-6b7e-a3cd-064e69fdfa27@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/slave.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index e7c1d62fde99..3bc5ca40c9fb 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,