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 0F1BAC433FE for ; Wed, 30 Nov 2022 11:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zvhxiXHkL09Nczp3QLQdNYwHN3LMx82bq60+sFj2Dwk=; b=vbocAQdirqOes8 Zz2eVjhBVIhcbLWQB7s3gIzE3Ti70dD72O2lCsff+2ozuPlP/dJxBjJej2yXZk5nao7zC4Y/NhwSM W4wWhHZL5g1oQRhBnY8TE6Vu281np3RhKEUlE8cIon3ywbW8BtuC3lfwZ/Wwo5Nl0DGmGIgPZaIM5 L6PwpCDO9pfocPUQbUIQUQoZ1IMWXIiyO29wWoK7XKjX7d5NFqGOPSXQJIvQMfB+8tb84cc6Bve95 P8X/Z0bkQX1zFTSREBer5MAp7dJsnCOKwg4v5ZROMGW2se2ahQ1bU0zj3x5ABUsHCX986JGkGLuJj K223tDA+G5+unnsPIbAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0LKd-00FpfF-16; Wed, 30 Nov 2022 11:32:51 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0LKZ-00FpbS-8Y for linux-arm-kernel@lists.infradead.org; Wed, 30 Nov 2022 11:32:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bala5sYXRYw+sGi8PWv5pz9c1EOsKG0X5boc/1rjBGA=; b=AgOWSJCqrMdjpt/RLVZvdAOeUK xpWG2CF3aCC/+Z6UDvNjRIOuths+gW7BwUI0HoW76l0YHVFPIxv/+dR2TI30LFQEUNkWXjzzqYM9u rKcb00iFtgZDeJ3m8AOKekdE7vrBJnvA0zFDat+gJdmqTrgWdJ6d/IAN5E+MVuNam/Cu5gf20BJ0H qVdkki/yQjiF1DE52usTcJf0/CLXStCKMDbWN2zGm54fpu9y/Qg0mqgKdPoDmSrsbwvkRuU+GiElb ygwh4y0HvbVy5PibWanCGzbZ4JXYIVu74CQG72YM7Cp4BfUVyCkIUc1WWqAepU6d5qcVfLuKJTBAj w07kh9pw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35494) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p0LKM-0001eb-Vm; Wed, 30 Nov 2022 11:32:35 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1p0LKK-0002S4-Le; Wed, 30 Nov 2022 11:32:32 +0000 Date: Wed, 30 Nov 2022 11:32:32 +0000 From: "Russell King (Oracle)" To: Clark Wang Cc: peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] net: phylink: add sync flag mac_ready to fix resume issue with WoL enabled Message-ID: References: <20221130111148.1064475-1-xiaoning.wang@nxp.com> <20221130111148.1064475-2-xiaoning.wang@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221130_033247_330026_97ED93D3 X-CRM114-Status: GOOD ( 17.86 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Nov 30, 2022 at 11:23:42AM +0000, Russell King (Oracle) wrote: > On Wed, Nov 30, 2022 at 07:11:47PM +0800, Clark Wang wrote: > > Issue we met: > > On some platforms, mac cannot work after resumed from the suspend with WoL > > enabled. > > > > The cause of the issue: > > 1. phylink_resolve() is in a workqueue which will not be executed immediately. > > This is the call sequence: > > phylink_resolve()->phylink_link_up()->pl->mac_ops->mac_link_up() > > For stmmac driver, mac_link_up() will set the correct speed/duplex... > > values which are from link_state. > > 2. In stmmac_resume(), it will call stmmac_hw_setup() after called the > > phylink_resume(). stmmac_core_init() is called in function stmmac_hw_setup(), > > ... and that is where the problem is. Don't call phylink_resume() before > your hardware is ready to see a link-up event. ... and while that is being fixed, maybe the stupid code in stmmac_resume() can also be fixed: rtnl_lock(); if (device_may_wakeup(priv->device) && priv->plat->pmt) { phylink_resume(priv->phylink); } else { phylink_resume(priv->phylink); if (device_may_wakeup(priv->device)) phylink_speed_up(priv->phylink); } rtnl_unlock(); rtnl_lock(); 1. phylink_resume() is always called after that first rtnl_lock(), so there's no point it being stupidly in each side of the if(). 2. the rtnl_unlock() followed by rtnl_lock() is completely unnecessary. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel