From: Paolo Abeni <pabeni@redhat.com>
To: maxime.chevallier@bootlin.com
Cc: o.rempel@pengutronix.de, herve.codina@bootlin.com,
andrew@lunn.ch, edumazet@google.com,
linux-kernel@vger.kernel.org, hkallweit1@gmail.com,
netdev@vger.kernel.org, kuba@kernel.org,
romain.gantois@bootlin.com, f.fainelli@gmail.com,
christophe.leroy@csgroup.eu, kory.maincent@bootlin.com,
mwojtas@chromium.org, dimitri.fedrau@liebherr.com,
nicveronese@gmail.com, pabeni@redhat.com, horms@kernel.org,
daniel@makrotopia.org, kabel@kernel.org, linux@armlinux.org.uk,
vladimir.oltean@nxp.com, davem@davemloft.net,
thomas.petazzoni@bootlin.com, bjorn@kernel.org
Subject: Re: [net-next,v7,05/10] net: phy: Represent PHY-less SFP modules with phy_port
Date: Thu, 12 Mar 2026 11:47:33 +0100 [thread overview]
Message-ID: <20260312104733.87688-1-pabeni@redhat.com> (raw)
In-Reply-To: <20260309152747.702373-6-maxime.chevallier@bootlin.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: phy: Represent PHY-less SFP modules with phy_port
Now that the SFP bus infrastructure notifies when PHY-less modules are
connected, we can create a phy_port to represent it. Instead of letting
the SFP subsystem handle that, the Bus' upstream is in charge of
maintaining that phy_port and register it to the topology, as the
upstream (in this case a phy device) is directly interacting with the
underlying net_device.
Add a phy_caps helper to get the achievable modes on this module based
on what the phy_port representing the bus supports.
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 4b06644866b2..faa58a780477 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
[ ... ]
> @@ -1483,6 +1483,8 @@ static int phy_sfp_connect_phy(void *upstream, struct phy_device *phy)
> struct phy_device *phydev = upstream;
> struct net_device *dev = phydev->attached_dev;
>
> + phydev->has_sfp_mod_phy = true;
> +
> if (dev)
> return phy_link_topo_add_phy(dev, phy, PHY_UPSTREAM_PHY, phydev);
If phy_link_topo_add_phy() fails, does has_sfp_mod_phy get cleaned up
correctly?
Looking at the SFP framework, when phy_link_topo_add_phy() fails here,
sfp_sm_probe_phy() in sfp.c will free the PHY but won't call
disconnect_phy (because sfp->mod_phy was not set). This leaves
has_sfp_mod_phy stuck as true.
On a subsequent SFP module insertion, phy_sfp_module_start() checks
!phydev->has_sfp_mod_phy:
drivers/net/phy/phy_device.c:phy_sfp_module_start() {
if (!phydev->has_sfp_mod_phy)
return phy_add_sfp_mod_port(phydev);
}
Seeing has_sfp_mod_phy is true (stale), it skips creating the mod_port
for a PHY-less module. The module then won't be represented in the link
topology.
Would it be better to either set has_sfp_mod_phy after
phy_link_topo_add_phy() succeeds, or clear it in an error path?
next prev parent reply other threads:[~2026-03-12 10:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 15:27 [PATCH net-next v7 00/10] net: phy_port: SFP modules representation and phy_port listing Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 01/10] net: phy: phy_link_topology: Add a helper for opportunistic alloc Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 02/10] net: phy: phy_link_topology: Track ports in phy_link_topology Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 03/10] net: phylink: Register a phy_port for MAC-driven SFP busses Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 04/10] net: phy: Create SFP phy_port before registering upstream Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 05/10] net: phy: Represent PHY-less SFP modules with phy_port Maxime Chevallier
2026-03-12 10:47 ` Paolo Abeni [this message]
2026-03-12 10:51 ` [net-next,v7,05/10] " Paolo Abeni
2026-03-09 15:27 ` [PATCH net-next v7 06/10] net: phylink: " Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 07/10] net: phy: phy_port: Store information about a MII port's vacant state Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 08/10] net: phy: phy_link_topology: Add a helper to retrieve ports Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 09/10] netlink: specs: Add ethernet port listing with ethtool Maxime Chevallier
2026-03-09 15:27 ` [PATCH net-next v7 10/10] net: ethtool: Introduce ethtool command to list ports Maxime Chevallier
2026-03-13 2:07 ` Jakub Kicinski
2026-03-13 8:35 ` Maxime Chevallier
2026-03-18 7:28 ` Maxime Chevallier
2026-03-18 22:00 ` Jakub Kicinski
2026-03-19 9:27 ` Maxime Chevallier
2026-03-19 14:53 ` Jakub Kicinski
2026-03-19 17:52 ` Maxime Chevallier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260312104733.87688-1-pabeni@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew@lunn.ch \
--cc=bjorn@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=dimitri.fedrau@liebherr.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=herve.codina@bootlin.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kabel@kernel.org \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=mwojtas@chromium.org \
--cc=netdev@vger.kernel.org \
--cc=nicveronese@gmail.com \
--cc=o.rempel@pengutronix.de \
--cc=romain.gantois@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox