Thread (26 messages) 26 messages, 4 authors, 2022-03-31

Re: ordering of call to unbind() in usbnet_disconnect

From: Oliver Neukum <oneukum@suse.com>
Date: 2022-03-31 09:21:03


On 27.03.22 10:37, Oleksij Rempel wrote:
On Sat, Mar 26, 2022 at 02:04:30PM +0100, Lukas Wunner wrote:
quoted
On Sat, Mar 26, 2022 at 01:49:28PM +0100, Andrew Lunn wrote:
quoted
On Sat, Mar 26, 2022 at 01:39:29PM +0100, Lukas Wunner wrote:
quoted
On probe, they first attach the PHY, then register the netdev.
On remove, they detach the PHY, then unregister the netdev.

Is it legal to detach the PHY from a registered (potentially running)
netdev? It looks wrong to me.
I think the network stack guarantee that the close() method is called
before unregister completes. It is a common pattern to attach the PHY
in open() and detach it in close(). The stack itself should not be
using the PHY when it is down, the exception being IOCTL handlers
which people often get wrong.
But the PHY is detached from a *running* netdev *before* that netdev
is unregistered (and closed).  Is that really legal?
IMO, it reflects, more or less, the reality of devices with SFP modules.
The PHY can be physically removed from running netdev. At same time,
netdev should be registered and visible for the user, even if PHY is not
physically attached.
Hi,

this makes sense, but the relevance to the question of how to do an
unplug of the whole device is indirect, isn't it? I am afraid, putting my
maintainer's hat on, I have to point on that we have a stable tree for
which we will need some solution.

Nor can usbnet exclusively cater to device that expose their PHY
over MDIO. (or at all really). Intuitively I must say that exactly reversing
the order of probe() in disconnect() is kind of the default.
If there is a need to deviate from that, of course we will acomodate that,
but making this the exclusive order is another matter.

I really get that you want to discuss this matter exhaustively, but we
need to
come to some kind of conclusion.

    Regards
        Oliver
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help