7ebc3fa90345808dc7db3846366c90d9cf4aceea
[openwrt/staging/wigyori.git] /
1 From 3630d519d7c3eab92567658690e44ffe0517d109 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Thu, 22 Apr 2021 22:20:58 -0700
4 Subject: [PATCH] net: ethernet: mtk_eth_soc: reduce MDIO bus access latency
5
6 usleep_range often ends up sleeping much longer than the 10-20us provided
7 as a range here. This causes significant latency in mdio bus acceses,
8 which easily adds multiple seconds to the boot time on MT7621 when polling
9 DSA slave ports.
10 Use cond_resched instead of usleep_range, since the MDIO access does not
11 take much time
12
13 Signed-off-by: Felix Fietkau <nbd@nbd.name>
14 Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 ---
17 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
21 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
22 @@ -86,7 +86,7 @@ static int mtk_mdio_busy_wait(struct mtk
23 return 0;
24 if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
25 break;
26 - usleep_range(10, 20);
27 + cond_resched();
28 }
29
30 dev_err(eth->dev, "mdio: MDIO timeout\n");