vlan: adopt u64_stats_t

As explained in commit 316580b69d ("u64_stats: provide u64_stats_t type")
we should use u64_stats_t and related accessors to avoid load/store tearing.

Add READ_ONCE() when reading rx_errors & tx_dropped.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Eric Dumazet
2022-06-08 08:46:32 -07:00
committed by Jakub Kicinski
parent d62607c3fe
commit 09cca53c16
5 changed files with 29 additions and 29 deletions

View File

@@ -46,10 +46,10 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
pcpu_stats = get_cpu_ptr(vlan->pcpu_stats);
u64_stats_update_begin(&pcpu_stats->syncp);
pcpu_stats->rx_packets++;
pcpu_stats->rx_bytes += len;
u64_stats_inc(&pcpu_stats->rx_packets);
u64_stats_add(&pcpu_stats->rx_bytes, len);
if (multicast)
pcpu_stats->rx_multicast++;
u64_stats_inc(&pcpu_stats->rx_multicast);
u64_stats_update_end(&pcpu_stats->syncp);
put_cpu_ptr(vlan->pcpu_stats);
} else {