]> www.infradead.org Git - users/hch/misc.git/commit
net: cadence: macb: Synchronize stats calculations
authorSean Anderson <sean.anderson@linux.dev>
Thu, 20 Feb 2025 16:29:50 +0000 (11:29 -0500)
committerJakub Kicinski <kuba@kernel.org>
Sat, 22 Feb 2025 00:31:35 +0000 (16:31 -0800)
commitfa52f15c745ce55261b92873676f64f7348cfe82
tree0e466e024bf86dcfa4f0caf9cb18c00168ccce78
parent27843ce6ba3d3122b65066550fe33fb8839f8aef
net: cadence: macb: Synchronize stats calculations

Stats calculations involve a RMW to add the stat update to the existing
value. This is currently not protected by any synchronization mechanism,
so data races are possible. Add a spinlock to protect the update. The
reader side could be protected using u64_stats, but we would still need
a spinlock for the update side anyway. And we always do an update
immediately before reading the stats anyway.

Fixes: 89e5785fc8a6 ("[PATCH] Atmel MACB ethernet driver")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Link: https://patch.msgid.link/20250220162950.95941-1-sean.anderson@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_main.c