Skip to content

Commit

Permalink
mlx4: do not use priv->stats_lock in mlx4_en_auto_moderation()
Browse files Browse the repository at this point in the history
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 <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 27, 2016
1 parent 0b42f25 commit b9972d2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/ethernet/mellanox/mlx4/en_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down

0 comments on commit b9972d2

Please sign in to comment.