Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
[sfrench/cifs-2.6.git] / net / xfrm / xfrm_interface.c
index 0bb7963b9f6bc521fa3d8cb4e7a3380be80e001f..9b8e292a7c6a7525f509d9ae730652769892f1ce 100644 (file)
@@ -210,7 +210,6 @@ static void xfrmi_scrub_packet(struct sk_buff *skb, bool xnet)
 static int xfrmi_rcv_cb(struct sk_buff *skb, int err)
 {
        const struct xfrm_mode *inner_mode;
-       struct pcpu_sw_netstats *tstats;
        struct net_device *dev;
        struct xfrm_state *x;
        struct xfrm_if *xi;
@@ -255,13 +254,7 @@ static int xfrmi_rcv_cb(struct sk_buff *skb, int err)
        }
 
        xfrmi_scrub_packet(skb, xnet);
-
-       tstats = this_cpu_ptr(dev->tstats);
-
-       u64_stats_update_begin(&tstats->syncp);
-       tstats->rx_packets++;
-       tstats->rx_bytes += skb->len;
-       u64_stats_update_end(&tstats->syncp);
+       dev_sw_netstats_rx_add(dev, skb->len);
 
        return 0;
 }
@@ -548,27 +541,7 @@ static int xfrmi_update(struct xfrm_if *xi, struct xfrm_if_parms *p)
 static void xfrmi_get_stats64(struct net_device *dev,
                               struct rtnl_link_stats64 *s)
 {
-       int cpu;
-
-       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;