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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15045C433FE for ; Mon, 6 Sep 2021 11:22:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED0046101C for ; Mon, 6 Sep 2021 11:22:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241281AbhIFLXV (ORCPT ); Mon, 6 Sep 2021 07:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbhIFLXR (ORCPT ); Mon, 6 Sep 2021 07:23:17 -0400 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 E7ECEC061575 for ; Mon, 6 Sep 2021 04:22:12 -0700 (PDT) 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=dLFz4/w0sUZswHb75ccRWmx4KirS+zbLOF9I69Q2X6k=; b=evcAILJMiDg2JcD4Vt+LZcGmaE PrmDvgYSTQlEVWkukc8LcVw5HHzhKyG/HRmbGflAuuyvUfLdz3ELjCKVTF7E+j3tEJ0zgCPuVN1ab /F4xS7xKOZqw23mNgD8MEufFLanpLIpw6JiOWiM480Rjzg7YvqSkW8SANDQPpsS8il0moqYMao3mL OhPa8yQRIY21cWOItjLwAkn5Exg9YQp4BKzuGvukq87z4McbpJfmj4eS456Ch9RFNbDFbFZbMcBk7 djWwGoMBFRhRs5Ye+fZp93uUtGpkNrubk/tI176IYKOyOVMS/MnCL+bU5TNCYt97f/xZlG+2eBA6y RnXkLf9g==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44974) 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 1mNChQ-0001dT-CD; Mon, 06 Sep 2021 12:22:03 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mNChL-0003EW-UG; Mon, 06 Sep 2021 12:21:59 +0100 Date: Mon, 6 Sep 2021 12:21:59 +0100 From: "Russell King (Oracle)" To: Joakim Zhang Cc: Andrew Lunn , Vladimir Oltean , "peppe.cavallaro@st.com" , "alexandre.torgue@foss.st.com" , "joabreu@synopsys.com" , "davem@davemloft.net" , "kuba@kernel.org" , "mcoquelin.stm32@gmail.com" , "netdev@vger.kernel.org" , "f.fainelli@gmail.com" , "hkallweit1@gmail.com" , dl-linux-imx Subject: Re: [PATCH] net: stmmac: fix MAC not working when system resume back with WoL enabled Message-ID: References: <20210903080147.GS22278@shell.armlinux.org.uk> <20210903093246.GT22278@shell.armlinux.org.uk> <20210903120127.GW22278@shell.armlinux.org.uk> <20210903201210.GF1350@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Sep 06, 2021 at 10:41:48AM +0000, Joakim Zhang wrote: > Hi Russell, > > Thanks Russell, it works as we are expected, I test both MAC-based WoL active and inactive cases. Yay! > And I get the point you mentioned before, if link parameters changed during system suspended, what would happen? That's a problem with any setup that uses the MAC to detect WoL packets, and the MAC requires software to run if the link state changes. It is one of the fundamental problems of MAC-side WoL detection. I see two possible solutions to this problem: 1) If the link changes, the PHY needs to wake the system up from suspend so that software can run to reprogram the MAC for the new link parameters, and then go back to sleep. 2) We need to set the link to a state which reduces the chances of the link parameters changing. I don't think we have any support in the kernel for (1) - we assume if we are woken up than the system as a whole will become operational, so there's no automatic "go back to sleep". We do have the ability to place the link into the slowest mutually supported speed via phy(link)?_speed_down(). This has the advantage of reducing the power used to keep the link active while in suspend (which is its primary purpose) but also reduces the possible link modes that could be autonegotiated with the partner. I think I'd suggest to Andrew that phy_speed_down() should only advertise one capability, not "everything we support below the minimum mutually supported capability" - that way, if a link change is attempted on the partner while the system is suspended, the link will not come up and its obvious it isn't going to work. I think this is an issue for a separate patch set. > Since net-next is closed, so I would cook a patch set (keep you as the > phylink patch author) after it re-open, could you accept it? Or you plan > to prepare this patch set for stmmac? As the bug was introduced in v5.7, this is a regression, and the fix isn't too complex. I believe it's suitable for the net tree. I'll prepare a proper patch for the net tree for phylink, which I'll send you, so you can include with your patch set. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!