blob: 922c35a3e477b5aa862d87f35bcf167679bb4a39 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From: Felix Fietkau <nbd@nbd.name>
2Date: Mon, 8 Jun 2020 17:02:39 +0200
3Subject: [PATCH] net: ethernet: mtk_eth_soc: significantly reduce mdio bus
4 access latency
5
6usleep_range often ends up sleeping much longer than the 10-20us provided
7as a range here. This causes significant latency in mdio bus acceses,
8which easily adds multiple seconds to the boot time on MT7621 when polling
9DSA slave ports.
10Use cond_resched instead of usleep_range, since the MDIO access does not
11take much time
12
13Signed-off-by: Felix Fietkau <nbd@nbd.name>
14---
15
16--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
17+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
18@@ -85,7 +85,7 @@ static int mtk_mdio_busy_wait(struct mtk
19 return 0;
20 if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
21 break;
22- usleep_range(10, 20);
23+ cond_resched();
24 }
25
26 dev_err(eth->dev, "mdio: MDIO timeout\n");