]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: macsec: use new function dev_fetch_sw_netstats
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 12 Oct 2020 08:04:11 +0000 (10:04 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 14 Oct 2020 00:33:48 +0000 (17:33 -0700)
Simplify the code by using new function dev_fetch_sw_netstats().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/0d81e0f7-7784-42df-8e10-d0b77ca5b7ee@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/macsec.c

index 2b0c8f01ddc361c1efa3a2a844c506ccc632d201..11ca5fa902a161c040699b8190b01f6ef2f98973 100644 (file)
@@ -3647,30 +3647,10 @@ static int macsec_change_mtu(struct net_device *dev, int new_mtu)
 static void macsec_get_stats64(struct net_device *dev,
                               struct rtnl_link_stats64 *s)
 {
-       int cpu;
-
        if (!dev->tstats)
                return;
 
-       for_each_possible_cpu(cpu) {
-               struct pcpu_sw_netstats *stats;
-               struct pcpu_sw_netstats tmp;
-               int start;
-
-               stats = per_cpu_ptr(dev->tstats, cpu);
-               do {
-                       start = u64_stats_fetch_begin_irq(&stats->syncp);
-                       tmp.rx_packets = stats->rx_packets;
-                       tmp.rx_bytes   = stats->rx_bytes;
-                       tmp.tx_packets = stats->tx_packets;
-                       tmp.tx_bytes   = stats->tx_bytes;
-               } while (u64_stats_fetch_retry_irq(&stats->syncp, start));
-
-               s->rx_packets += tmp.rx_packets;
-               s->rx_bytes   += tmp.rx_bytes;
-               s->tx_packets += tmp.tx_packets;
-               s->tx_bytes   += tmp.tx_bytes;
-       }
+       dev_fetch_sw_netstats(s, dev->tstats);
 
        s->rx_dropped = dev->stats.rx_dropped;
        s->tx_dropped = dev->stats.tx_dropped;