]> git.ipfire.org Git - thirdparty/linux.git/commit
net: spacemit: Check for netif_carrier_ok() in emac_stats_update()
authorVivian Wang <wangruikang@iscas.ac.cn>
Fri, 23 Jan 2026 03:52:23 +0000 (11:52 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 27 Jan 2026 03:49:41 +0000 (19:49 -0800)
commit2c84959167d6493dbdac88965c7389b8ab88bf4e
tree5351b374de3eb4b49109113a8080314c3ea088eb
parente2a9eeb69f7d4ca4cf4c70463af77664fdb6ab1d
net: spacemit: Check for netif_carrier_ok() in emac_stats_update()

Some PHYs stop the refclk for power saving, usually while link down.
This causes reading stats to time out.

Therefore, in emac_stats_update(), also don't update and reschedule if
!netif_carrier_ok(). But that means we could be missing later updates if
the link comes back up, so also reschedule when link up is detected in
emac_adjust_link().

While we're at it, improve the comments and error message prints around
this to reflect the better understanding of how this could happen.
Hopefully if this happens again on new hardware, these comments will
direct towards a solution.

Closes: https://lore.kernel.org/r/20260119141620.1318102-1-amadeus@jmu.edu.cn/
Fixes: bfec6d7f2001 ("net: spacemit: Add K1 Ethernet MAC")
Co-developed-by: Chukun Pan <amadeus@jmu.edu.cn>
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Link: https://patch.msgid.link/20260123-k1-ethernet-clarify-stat-timeout-v3-1-93b9df627e87@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/spacemit/k1_emac.c