iptunnel: use new function dev_fetch_sw_netstats
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 12 Oct 2020 08:17:07 +0000 (10:17 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 14 Oct 2020 00:33:49 +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/050f9a83-b195-a3d6-edbd-91a59040be21@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/ip_tunnel_core.c

index b2ea1a8c5fd66d6b67502caf0bdf9d809981f85a..25f1caf5abf93c85ea6d8483e36e1d69b1d5065e 100644 (file)
@@ -433,29 +433,8 @@ EXPORT_SYMBOL(skb_tunnel_check_pmtu);
 void ip_tunnel_get_stats64(struct net_device *dev,
                           struct rtnl_link_stats64 *tot)
 {
-       int i;
-
        netdev_stats_to_stats64(tot, &dev->stats);
-
-       for_each_possible_cpu(i) {
-               const struct pcpu_sw_netstats *tstats =
-                                                  per_cpu_ptr(dev->tstats, i);
-               u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
-               unsigned int start;
-
-               do {
-                       start = u64_stats_fetch_begin_irq(&tstats->syncp);
-                       rx_packets = tstats->rx_packets;
-                       tx_packets = tstats->tx_packets;
-                       rx_bytes = tstats->rx_bytes;
-                       tx_bytes = tstats->tx_bytes;
-               } while (u64_stats_fetch_retry_irq(&tstats->syncp, start));
-
-               tot->rx_packets += rx_packets;
-               tot->tx_packets += tx_packets;
-               tot->rx_bytes   += rx_bytes;
-               tot->tx_bytes   += tx_bytes;
-       }
+       dev_fetch_sw_netstats(tot, dev->tstats);
 }
 EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64);