[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7947c611-982f-4ece-b7f4-d151f728fe6f@bootlin.com>
Date: Fri, 30 Jan 2026 14:36:16 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Romain Gantois <romain.gantois@...tlin.com>, davem@...emloft.net,
Andrew Lunn <andrew@...n.ch>, Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Russell King <linux@...linux.org.uk>, Heiner Kallweit <hkallweit1@...il.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com, Christophe Leroy
<christophe.leroy@...roup.eu>, Herve Codina <herve.codina@...tlin.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <vladimir.oltean@....com>,
Köry Maincent <kory.maincent@...tlin.com>,
Marek Behún <kabel@...nel.org>,
Oleksij Rempel <o.rempel@...gutronix.de>,
Nicolò Veronese <nicveronese@...il.com>,
Simon Horman <horms@...nel.org>, mwojtas@...omium.org,
Daniel Golle <daniel@...rotopia.org>,
Dimitri Fedrau <dimitri.fedrau@...bherr.com>
Subject: Re: [PATCH net-next 08/13] net: phylink: Represent PHY-less SFP
modules with phy_port
On 28/01/2026 17:01, Romain Gantois wrote:
> On Tuesday, 27 January 2026 14:41:56 CET Maxime Chevallier wrote:
> ...
>> @@ -1786,13 +1787,31 @@ static int phylink_create_sfp_port(struct phylink
>> *pl) else
>>
>> pl->sfp_bus_port = port;
>>
>> + if (pl->mod_port) {
>> + ret = phy_link_topo_add_port(pl->netdev, pl->mod_port);
>> + if (ret)
>> + goto out_bus_port;
>> + }
>> +
>> + return 0;
>> +out_bus_port:
>> + phy_link_topo_del_port(pl->netdev, port);
>
> This seems strange to me. Why clean up after phy_link_topo_add_port() if it
> returned an error code? Presumably phy_link_topo_add_port() cleans up after
> itself if it encounters an error doesn't it?
Because we're not cleaning up the same port, notice the 'port' vs
'pl->mod_port' params :)
>
>> + phy_port_destroy(port);
>>
>> return ret;
>>
>> }
>>
>> static void phylink_destroy_sfp_port(struct phylink *pl)
>> {
>>
>> - if (pl->netdev && pl->sfp_bus_port)
>> - phy_link_topo_del_port(pl->netdev, pl->sfp_bus_port);
>> + if (pl->netdev) {
>> + if (pl->sfp_bus_port)
>> + phy_link_topo_del_port(pl->netdev, pl->sfp_bus_port);
>> +
>> + /* Only remove it from the topology, it will be destroyed at
>> + * module removal.
>> + */
>> + if (pl->mod_port)
>> + phy_link_topo_del_port(pl->netdev, pl->mod_port);
>> + }
>>
>> if (pl->sfp_bus_port)
>>
>> phy_port_destroy(pl->sfp_bus_port);
>>
>> @@ -3998,6 +4017,49 @@ static void phylink_sfp_disconnect_phy(void
>> *upstream, phylink_disconnect_phy(upstream);
>>
>> }
>>
>> +static int phylink_sfp_connect_nophy(void *upstream)
>
> I'd name this "phylink_sfp_connect_no_phy" just to keep the name formatting
> consistent.
having 'nophy' as a single word made it clearer that this was "phy" vs
"nophy" IMO, rather than potentially interpreting "phy" as a suffix. but
I see your point, I think I'll rename it :)
Maxime
>
> Thanks,
>
Powered by blists - more mailing lists