Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2236820rwb; Wed, 30 Nov 2022 04:19:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ntuI0a1gAH25+okRHdLNFYB742ncq/8abmAhPFKU4bYqWwAYo3uaxkSQcrP/b8Kb3Cma5 X-Received: by 2002:a17:902:6b8b:b0:188:a40b:47c9 with SMTP id p11-20020a1709026b8b00b00188a40b47c9mr41976403plk.75.1669810795782; Wed, 30 Nov 2022 04:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669810795; cv=none; d=google.com; s=arc-20160816; b=LxId2bSdoM8CRc5m+sCasKXfi0Vd+SZd7xxRGSJ3+BVXuJURmpcL71ETvvfh35hTPK r+1SzL2heeFGWskE4zPE9YJHTM+AZXLxcBvhb3RkrzdT+zRVYmR6KNVa0WJcONM6K9hV /N16joqtjhnzWIdrCuQxQYSSdxMxt7b/p98pN0XoARLT0cBX8UJFDJya7uNpEPmeWpZE RH9Lk77mlrpkCDCvQrGBPHKODek9DdKXN27nnNM5HZA8hWZ8ZP+rOunf/GKl+4JIveF5 7msxinrfVk49hpVzBCSyMx9CozYlZzWysEQmH+RdnON6GQ0exLu5tSVU33Y9w2fqp76Y BU5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bala5sYXRYw+sGi8PWv5pz9c1EOsKG0X5boc/1rjBGA=; b=vi6jmqhF77zmg7VZMYZgvk/BcxrybRHW7qpXA08VjPHz1PMAUNNa1spctbe51wlesJ KfjhZ2Fj4YjsIvdWj1XCw086S8viW6seANBpFgoqovMS0z6XtbhB9lBy8vvu7JfxH/VP l2mYWNbjENUeHRgeoiH1JGEThDp8ne7OQqmnrV8ULAtMWfR4OIDRVNwyQZQuDE52CjAg zWQ3EN/AMUEalKe9DDs0gAKY+NWlxcNbunSuf6ByeSNJIQOSGPM3OyiEFUUkRybwDem7 FMGqVjwbusWTII5gRFIxQkI/dV8gWNiuBtvuAQOOOAv2LerqSyMdiHFb+UOP3MU+6oK4 j+gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=AgOWSJCq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a170902ec8a00b0017f9db0233fsi1166328plg.448.2022.11.30.04.19.44; Wed, 30 Nov 2022 04:19:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=AgOWSJCq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235281AbiK3LeS (ORCPT + 84 others); Wed, 30 Nov 2022 06:34:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235085AbiK3Ld3 (ORCPT ); Wed, 30 Nov 2022 06:33:29 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DEB363DA; Wed, 30 Nov 2022 03:32:44 -0800 (PST) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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!