From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82A02420877; Tue, 7 Jul 2026 18:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783450237; cv=none; b=WoXrhsLuMI28Hs60/73RRztvYZlBnrWtsuqs9NGOTFDFl3q9KVhRtFk2jKr+X32vLGteH4unCTEVNGjb+Pc5HgJppryCbQdseTrHE2BdLUSkrd/yJra5fWtwnWb1YcG5gCXvuoWq8ywuth9iYwek78jgNEyqqu6zk1HV2tH7ask= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783450237; c=relaxed/simple; bh=ozGq+CJotooqpuCRkkMgl4URHl6kxiPhWa11/A4vUbU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WE1/lZ0pz0sy9B/8jV6Q8XtdQ0ELQq4ORtnOnUCf6dta+ug8a7DhH/DAoSL3hyFex6fcxrP/i1MMc4TBsHUAJMSS3+CQTj8DG8cZbNZpVEotnJMo4jxjOjIFS2uzHoVGVO9Irj5QoxqgnlPnza+H6DJZats/Zr+rNavPDEUotNA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=ms5VMpjP; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="ms5VMpjP" 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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260707162146.73823-1-stefan@agner.ch> 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