From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26504606A325 for ; Mon, 30 Nov 2026 23:48:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=wn2THaHx; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Am7cVxMI DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=/WvmnCByCv1C4yL+BFhS2LMig2WFt6p3YwVu2gMwJxc=; b=wn2THaHxGsXsHawRiaDIWGH9aH guaGkEk/0S9BvWeeWV77TJ3zoVUrt2KK9ytSkgNxnixrWv11H8c3IR6vBTP6MM70ZZXZGw7YjFl/M OZEGhPnBwKIdHR3qZkZ+69zptEiyvVTpo4OB7DSYWJJMMydgYwnOiR6GIDlafE9soldQfZYXBy6R1 9sqx4byPRI2PxVIny6t4OQnlZojhlE4mcVXVqPVcnYrEEKQirT0Gg+sgQQSQISqY2BeqUmyE58FtY EP7A2knEw0trlWi4MMG0+HjaNTT2KumkDSTFlXWkEw2TnVQObMiJFqUtLPnYpjrwFEqWWoZUrC40C F+uS6o5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYB6b-000000064Fk-2gua; Mon, 30 Nov 2026 23:48:21 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYB62-00000006419-2QFh; Mon, 30 Nov 2026 23:47:46 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 46A6C4517A; Mon, 30 Nov 2026 23:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B64B1F00924; Mon, 30 Nov 2026 23:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796082466; bh=/WvmnCByCv1C4yL+BFhS2LMig2WFt6p3YwVu2gMwJxc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Am7cVxMIBWFXzbcSqmxeZdoaLZZ6iyhCw31Dee/1DIA8ImPCCjlnAzFWClDOX0DbV dwtzOPMHvXI7nXgzA/Ns3NZuOkix4MYJ53amG7STK4wlhX6A7o7ubiEuk69x+ImeSz acD/zTyzqC5LCFLn73AaGf3n01LhZ2pUilwTWMMQsCr2cOvKHdKNP21ifAQr1BUNwU fs4yUlM7ChLHUgsT63n/Wqby3Udc+OV2Y/fm6l9lpb4Npbk12JeLAgGmfBHYdAd8dU gTasKaP7o8wcIKTZrsTxoQY0I1xkJm8N9jYWGYd4RFuXxCS9KzhpenY6uQjYYFwFpq 8P/6/S7zECegQ== Subject: Re: [PATCH net-next v23 07/15] net: sfp: support deferred module insertion From: netdev-bot+sashiko@kernel.org To: ansuelsmth@gmail.com Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, willemb@google.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, lorenzo@kernel.org, hkallweit1@gmail.com, linux@armlinux.org.uk, maxime.chevallier@bootlin.com, p.zabel@pengutronix.de, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com, rmk+kernel@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, llvm@lists.linux.dev, zhengping.zhang@airoha.com Date: Mon, 30 Nov 2026 23:47:43 +0000 Message-ID: <179608246397.3146.5781345525320123745@kernel.org> In-Reply-To: <20261129230558.612526-8-ansuelsmth@gmail.com> References: <20261129230558.612526-8-ansuelsmth@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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/20261129230558.612526-1-ansuelsmth%40gmail.com