net: mvmdio: Avoid excessive sleeps in polled mode
authorTobias Waldekranz <tobias@waldekranz.com>
Mon, 4 Dec 2023 10:08:10 +0000 (11:08 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 6 Dec 2023 04:10:16 +0000 (20:10 -0800)
commit7dd12fe34686d89c332b1a05104d18d728591f0a
treeb0ab61dff55052f7e28f7b4e3c5a50e7fb5029b5
parentf3c928008ab218055e26917ffdbdaf429e8e616a
net: mvmdio: Avoid excessive sleeps in polled mode

Before this change, when operating in polled mode, i.e. no IRQ is
available, every individual C45 access would be hit with a 150us sleep
after the bus access.

For example, on a board with a CN9130 SoC connected to an MV88X3310
PHY, a single C45 read would take around 165us:

    root@infix:~$ mdio f212a600.mdio-mii mmd 4:1 bench 0xc003
    Performed 1000 reads in 165ms

By replacing the long sleep with a tighter poll loop, we observe a 10x
increase in bus throughput:

    root@infix:~$ mdio f212a600.mdio-mii mmd 4:1 bench 0xc003
    Performed 1000 reads in 15ms

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20231204100811.2708884-3-tobias@waldekranz.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/mvmdio.c