[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51faeed2-6a6b-439b-80e6-8cf2b5ce401a@lunn.ch>
Date: Fri, 14 Jun 2024 00:02:12 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Paul Geurts <paul.geurts@...drive-technologies.com>
Cc: wei.fang@....com, shenwei.wang@....com, xiaoning.wang@....com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, imx@...ts.linux.dev, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fec_main: Register net device before initializing the
MDIO bus
On Thu, Jun 13, 2024 at 04:41:11PM +0200, Paul Geurts wrote:
> Registration of the FEC MDIO bus triggers a probe of all devices
> connected to that bus. DSA based Ethernet switch devices connect to the
> uplink Ethernet port during probe. When a DSA based, MDIO controlled
> Ethernet switch is connected to FEC, it cannot connect the uplink port,
> as the FEC MDIO port is registered before the net device is being
> registered. This causes an unnecessary defer of the Ethernet switch
> driver probe.
>
> Register the net device before initializing and registering the MDIO
> bus.
The problem with this is, as soon as you call register_netdev(), the
device is alive and sending packets. It can be sending packets even
before register_netdev() returns, e.g. in the case of NFS root. So
fec_enet_open() gets called, and tried to find its PHY. But the MDIO
bus is not registered yet....
So yes, DSA ends up doing an EPROBE_DEFER cycle. Not much we can do
about that. We can try to keep the DSA probe functions as cheap as
possible, and put all the expensive stuff in setup(), which will only
be called once we have all the needed resources.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists