Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The new deferral only covers a PCS dependency that is missing when module_insert() runs. -- net: sfp: support deferred module insertion This lets an upstream device defer SFP module insertion. If its module_insert() callback returns -EAGAIN, the module stays in SFP_MOD_WAITDEV. A new sfp_upstream_retry_module() helper lets the upstream retry the insertion once the missing dependency (e.g. a PCS provider) has registered.
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c > index 915156743701b..e5ddd62318bf9 100644 > --- a/drivers/net/phy/sfp.c > +++ b/drivers/net/phy/sfp.c
[ ... ]
> @@ -2830,6 +2836,8 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event) > /* Report the module insertion to the upstream device */ > err = sfp_module_insert(sfp->sfp_bus, &sfp->id, > sfp->quirk); > + if (err == -EAGAIN) > + break; > if (err < 0) { > sfp_sm_mod_next(sfp, SFP_MOD_ERROR, 0); > break;
[ ... ]
> @@ -3091,6 +3099,14 @@ static void sfp_stop(struct sfp *sfp) > sfp_sm_event(sfp, SFP_E_DEV_DOWN); > } > > +static void sfp_retry_module(struct sfp *sfp) > +{ > + mutex_lock(&sfp->sm_mutex); > + if (sfp->sm_mod_state == SFP_MOD_WAITDEV) > + __sfp_sm_event(sfp, SFP_E_UPSTREAM_RETRY); > + mutex_unlock(&sfp->sm_mutex); > +}
[Severity: Medium] Does this retry cover modules that have may_have_phy set? sfp_retry_module() only acts while sm_mod_state is SFP_MOD_WAITDEV. The only way to stay in that state is for sfp_module_insert() in sfp_sm_module() to return -EAGAIN. Copper modules have may_have_phy set. These are e1000_base_t modules, or modules with the 10G/5G/2.5GBASE-T extended compliance codes that sfp_module_parse_may_have_phy() checks for. For them, phylink_sfp_module_insert() returns before any PCS-dependent configuration: drivers/net/phy/phylink.c:phylink_sfp_module_insert() { ... /* If this module may have a PHY connecting later, defer until later */ if (pl->sfp_may_have_phy) return 0; ... } So the module moves to SFP_MOD_PRESENT, and the PCS dependency is only checked later in sfp_sm_main(). If the PCS provider has not registered yet, both paths there seem to end in SFP_S_FAIL. When a PHY is found: sfp_sm_probe_for_phy()->sfp_add_phy()->phylink_sfp_connect_phy() ->phylink_sfp_config_phy() This fails because the host interface (e.g. SGMII) is not yet in pl->supported_interfaces. When no PHY is found: sfp_module_start()->phylink_sfp_module_start() ->phylink_sfp_config_optical() This returns -EINVAL with "no common interface modes". Both failures lead here: drivers/net/phy/sfp.c:sfp_sm_main() { ... } else if (ret) { sfp_sm_next(sfp, SFP_S_FAIL, 0); break; } if (sfp_module_start(sfp->sfp_bus)) { sfp_sm_next(sfp, SFP_S_FAIL, 0); break; } ... } Later, when the provider registers, this chain runs: phylink_update_pcs()->phylink_sfp_retry_module() ->sfp_upstream_retry_module()->sfp_retry_module() sfp_retry_module() then sees sm_mod_state == SFP_MOD_PRESENT and does nothing. Would the link then stay down until the module is re-plugged, or the interface is cycled with ifdown/ifup? The later patch in this series, "net: phylink: support late PCS provider attach", only returns -EAGAIN when !caps->may_have_phy. So the rest of the series doesn't seem to cover this case either. The commit message starts with a general description ("when the upstream device needs a dependency that is not yet available"). Only the last sentence narrows it to optical SFPs. If leaving out copper and may_have_phy modules is intended, could the commit message say so?
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com