Skip to content

Commit 53abd9c

Browse files
Mohsin Bashirkuba-moo
authored andcommitted
eth: fbnic: Lock the tx_dropped update
Wrap copying of drop stats on TX path from fbd->hw_stats by the hw_stats_lock. Currently, it is being performed outside the lock and another thread accessing fbd->hw_stats can lead to inconsistencies. Fixes: 5f8bd2c ("eth: fbnic: add support for TMI stats") Signed-off-by: Mohsin Bashir <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2972395 commit 53abd9c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_netdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,12 @@ static void fbnic_get_stats64(struct net_device *dev,
423423
tx_dropped = stats->dropped;
424424

425425
/* Record drops from Tx HW Datapath */
426+
spin_lock(&fbd->hw_stats_lock);
426427
tx_dropped += fbd->hw_stats.tmi.drop.frames.value +
427428
fbd->hw_stats.tti.cm_drop.frames.value +
428429
fbd->hw_stats.tti.frame_drop.frames.value +
429430
fbd->hw_stats.tti.tbi_drop.frames.value;
431+
spin_unlock(&fbd->hw_stats_lock);
430432

431433
stats64->tx_bytes = tx_bytes;
432434
stats64->tx_packets = tx_packets;

0 commit comments

Comments
 (0)