b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From: Felix Fietkau <nbd@nbd.name> |
| 2 | Date: Mon, 8 Jun 2020 17:02:39 +0200 |
| 3 | Subject: [PATCH] net: ethernet: mtk_eth_soc: significantly reduce mdio bus |
| 4 | 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 | --- |
| 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"); |