[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260118100000.224793-1-amadeus@jmu.edu.cn>
Date: Sun, 18 Jan 2026 18:00:00 +0800
From: Chukun Pan <amadeus@....edu.cn>
To: Vivian Wang <wangruikang@...as.ac.cn>
Cc: Yixun Lan <dlan@...too.org>,
Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org,
spacemit@...ts.linux.dev,
netdev@...r.kernel.org,
Chukun Pan <amadeus@....edu.cn>
Subject: [PATCH 1/1] net: spacemit: Check netif_carrier_ok when reading stats
Currently, when the interface is not linked up, reading the interface
stats will print several timeout logs. Add a netif_carrier_ok check to
the emac_stats_update function to avoid this situation:
root@...nWrt:~# ubus call network.device status
[ 120.365060] k1_emac cac81000.ethernet eth1: Read stat timeout
Fixes: bfec6d7f2001 ("net: spacemit: Add K1 Ethernet MAC")
Signed-off-by: Chukun Pan <amadeus@....edu.cn>
---
drivers/net/ethernet/spacemit/k1_emac.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/spacemit/k1_emac.c b/drivers/net/ethernet/spacemit/k1_emac.c
index c85dc742c404..d7972f247bcc 100644
--- a/drivers/net/ethernet/spacemit/k1_emac.c
+++ b/drivers/net/ethernet/spacemit/k1_emac.c
@@ -1080,8 +1080,10 @@ static void emac_stats_update(struct emac_priv *priv)
assert_spin_locked(&priv->stats_lock);
- if (!netif_running(priv->ndev) || !netif_device_present(priv->ndev)) {
- /* Not up, don't try to update */
+ if (!netif_running(priv->ndev) ||
+ !netif_carrier_ok(priv->ndev) ||
+ !netif_device_present(priv->ndev)) {
+ /* Not up or link, don't try to update */
return;
}
--
2.25.1
Powered by blists - more mailing lists