From: Eric Dumazet Date: Wed, 23 Nov 2016 17:46:52 +0000 (-0800) Subject: mlx4: do not use priv->stats_lock in mlx4_en_auto_moderation() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b9972d2205f696fdb53ee0133aebd2d0a99e1801;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mlx4: do not use priv->stats_lock in mlx4_en_auto_moderation() Per RX ring packets/bytes counters are not protected by global priv->stats_lock. Better not confuse the reader, and use READ_ONCE() to show we read these counters without surrounding synchronization. Interrupt moderation is best effort, and we do not really care of ultra precise counters. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index c48ce3f366c3..ea76b28b728b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -1394,10 +1394,8 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) return; for (ring = 0; ring < priv->rx_ring_num; ring++) { - spin_lock_bh(&priv->stats_lock); - rx_packets = priv->rx_ring[ring]->packets; - rx_bytes = priv->rx_ring[ring]->bytes; - spin_unlock_bh(&priv->stats_lock); + rx_packets = READ_ONCE(priv->rx_ring[ring]->packets); + rx_bytes = READ_ONCE(priv->rx_ring[ring]->bytes); rx_pkt_diff = ((unsigned long) (rx_packets - priv->last_moder_packets[ring]));