]> git.baikalelectronics.ru Git - kernel.git/commitdiff
wireguard: receive: use dev_sw_netstats_rx_add()
authorEric Dumazet <edumazet@google.com>
Wed, 8 Jun 2022 15:46:36 +0000 (08:46 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 10 Jun 2022 04:53:10 +0000 (21:53 -0700)
We have a convenient helper, let's use it.
This will make the following patch easier to review and smaller.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/wireguard/receive.c

index 7b8df406c7737398f0270361afcb196af4b6a76e..7135d51d2d872edb66c856379ce2923b214289e9 100644 (file)
 /* Must be called with bh disabled. */
 static void update_rx_stats(struct wg_peer *peer, size_t len)
 {
-       struct pcpu_sw_netstats *tstats =
-               get_cpu_ptr(peer->device->dev->tstats);
-
-       u64_stats_update_begin(&tstats->syncp);
-       ++tstats->rx_packets;
-       tstats->rx_bytes += len;
+       dev_sw_netstats_rx_add(peer->device->dev, len);
        peer->rx_bytes += len;
-       u64_stats_update_end(&tstats->syncp);
-       put_cpu_ptr(tstats);
 }
 
 #define SKB_TYPE_LE32(skb) (((struct message_header *)(skb)->data)->type)