From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 270B3C43458 for ; Tue, 7 Jul 2026 18:50:51 +0000 (UTC) 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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NI+VUTouKYW89nB5Z+aD4pi6ZXy+jv5hw3Htg0xYNWI=; b=V6uSl30lS9W6Tc0vSZWMdNHAzm 6YM890scks1OHa5qvnfKecy+rJYDiHs5UPmhXtlKExItjOAd/6X3uIH3E+mf0yl5/vqe/XpS6ld3f WpC1CQV3XVZTmPNw1wlmYccIoVUpKGA32xi37k2qrGwBJfPEv9OaE1bvS2Jpq2cCK5uR1FSKE40Yo ya6/xgWHCP0Xt6+7mAPHD/tl3acVH3eCHbbXRGQZwa2K3oIUAO9loQpr8vN9idcnbQOV27cF1YbHs YeqiVcFWLD/YaCVijJo6ZROPMpygm/ii3WuaKWy62TyJiyG12wgrag7PxnCLBXAM+R1wGmz0piSZ/ ebOGl/Ow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whAsS-0000000Ff8B-33w0; Tue, 07 Jul 2026 18:50:40 +0000 Received: from vps0.lunn.ch ([156.67.10.101]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1whAsQ-0000000Ff7g-1vHV for linux-arm-kernel@lists.infradead.org; Tue, 07 Jul 2026 18:50:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=NI+VUTouKYW89nB5Z+aD4pi6ZXy+jv5hw3Htg0xYNWI=; b=ms5VMpjP84ODY07OzejZ0XnMpX vXH83b9W0UFlLWSfBV3jFUnAbcxLrppZ9r5OR3w7XDOr85B5f0dC4sPAxeF8HOmKpcKnBTYU20rcs hEI0LXDlvCRmKfyCQdXaCj6D4lVxfItz2GuexpGblbQ7pIJPEQatSY6zi1+0whijn3Nc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1whAs8-00BDDv-0d; Tue, 07 Jul 2026 20:50:20 +0200 Date: Tue, 7 Jul 2026 20:50:20 +0200 From: Andrew Lunn To: Stefan Agner Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "Russell King (Oracle)" , Maxime Chevallier , Ovidiu Panait , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, regressions@lists.linux.dev Subject: Re: [PATCH net] net: stmmac: resume PHY before reopening the interface on MTU change Message-ID: References: <20260707162146.73823-1-stefan@agner.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260707162146.73823-1-stefan@agner.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260707_115038_521855_2B64A6D7 X-CRM114-Status: GOOD ( 22.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 07, 2026 at 06:21:46PM +0200, Stefan Agner wrote: > Since the referenced commit, changing the MTU on a running interface no > longer disconnects and reconnects the PHY; __stmmac_release() merely > stops phylink, which also suspends the PHY (BMCR power-down) when WoL > is not enabled. __stmmac_open() then performs the DMA software reset in > stmmac_hw_setup() before phylink_start() resumes the PHY again. > > IEEE 802.3 22.2.4.1.5 allows a PHY to stop its receive clock while > powered down, and stmmac requires a running receive clock for the DMA > software reset to complete (the phylink config sets mac_requires_rxc). > On such setups, e.g. the RK3566-based Home Assistant Green with an > RTL8211F-VD PHY in RGMII mode, any runtime MTU change now times out and > leaves the interface dead: > > rk_gmac-dwmac fe010000.ethernet end0: Failed to reset the dma > rk_gmac-dwmac fe010000.ethernet end0: stmmac_hw_setup: DMA engine initialization failed > rk_gmac-dwmac fe010000.ethernet end0: __stmmac_open: Hw setup failed > rk_gmac-dwmac fe010000.ethernet end0: failed reopening the interface after MTU change > > In the field this is triggered by NetworkManager applying an MTU while > activating the connection, breaking networking entirely. > > Resume the PHY before reopening the interface, like stmmac_resume() > does, to ensure the receive clock is running for the DMA software > reset. > > Fixes: db299a0c09e9 ("net: stmmac: move PHY handling out of __stmmac_open()/release()") > Link: https://github.com/home-assistant/operating-system/issues/4858 > Assisted-by: Claude:claude-fable-5 > Tested-by: Stefan Agner > Signed-off-by: Stefan Agner > --- > Note: phylink_prepare_resume()'s kernel-doc says it is to be called > prior to phylink_resume(); here it is paired with phylink_start() > (called from __stmmac_open()) instead, which phylink_resume() itself > uses to restart the machinery. If preferred, I can extend the > kernel-doc or introduce a more generically named helper. > > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -5884,6 +5884,15 @@ > > __stmmac_release(dev); > > + /* phylink_stop() in __stmmac_release() suspends the PHY. > + * IEEE 802.3 allows PHYs to stop their receive clock while > + * powered down, but the DMA software reset performed by > + * stmmac_hw_setup() requires a running receive clock. > + * Resume the PHY, as on system resume, to ensure its clocks > + * are running before reopening the interface. > + */ > + phylink_prepare_resume(priv->phylink); > + > ret = __stmmac_open(dev, dma_conf); > if (ret) { > free_dma_desc_resources(priv, dma_conf); I'm not convinced. __stmmac_open() and __stmmac_release() should be opposites of each other. If __stmmac_release() stops the clock, __stmmac_open() should start the clock. Andrew