Re: [PATCH net-next v10 6/9] net: phy: phy_port: Store information about a MII port's vacant state

From: Andrew Lunn

Date: Wed May 20 2026 - 16:02:04 EST


> I've given this a go, and now I remember why it's that way. In a nutshell,
> if something fails during .module_insert() (e.g. module isn't compatible
> with the MII modes ont the cage), then .module_remove() isn't called, so we
> can't track module presence unless we add that in the sfp code itself.

I did wounder about that, it is a pretty typically pattern.


>
> However a better way to deal with this whole situation may just be to store
> the presence information in the module's port itself, as the parent port id
> :
> phy_port.id = 1
> / phy_port.id = 2;
> / / phy_port.upstream_port = 1
> +------+ +----------+ +------------+
> | MAC | --- | SFP Cage | --- | SFP module |
> +------+ +----------+ +------------+
>
> So, we lose one piece of information, that is "is there an SFP module
> present, even if the module doesn't work". It's now indirectly present
> as "there's another port that references the SFP cage port, hence it's
> not empty".

That is reasonable.

Andrew