Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1868925rdb; Thu, 7 Dec 2023 10:51:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEb0nayHG77PlA43anLWolwd7kX0rFU6p8JAf4Qeu5DiS9WkpIA3IA8eWRIxj5/5nvMKP6V X-Received: by 2002:a05:6a20:861d:b0:18c:41cd:c74d with SMTP id l29-20020a056a20861d00b0018c41cdc74dmr2179677pze.5.1701975086539; Thu, 07 Dec 2023 10:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701975086; cv=none; d=google.com; s=arc-20160816; b=0FH4hDDzthbfGsG+nA5iCKF6YwF6IgcqdVEDeEU1HPSYe3WYLGdaKsZpkQtSleMy1/ GWP6fqea0r4yBHyczUnbpqeXU0AqJJRSrAOM4j7i/8tRAQo86TtipBi1PE7I0JuHjiaK VgrdC+1GM4DR7ZOY1jZ8fb8DFqnq/O9RrVIhjAucMq2adTa00ugQYaYa2fYsYCPKQ/oX hW1A+wH3HtRICUtOmJ7+a6LznD0JL+BtcamQTm1yEl/bjAKu3AWWHaYADMOSAeYHfDIR PLtZg9s5Nre7UyU2a83k4aFg17gE+++cNZNEjRNjMZ3zbSf/wdhx/NbrPcRu55ajlv4Y PLqw== 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=SC4n/zXNUUfBAekQk0GSBXQG99rCFLSursm1c12jHB8=; fh=B+D4mIXzAvja0pAxHocHVfkWanGpBcQn37jkrZ1ZxOg=; b=WUmcpjoqAQmdWRf6aKKsydm7sRLF75+a0c/nmjxs4XWPOAEDak8hNCHIJ7X8gPV1P3 docABEMU9s5sT3RB12HoxJBafa13uRU8xTOYOLQxVeKF+0RlrWVo/PJl35hQQMY+GRzs rIfUN/Bbt/+1EpaweDQ/PH3qIIls5spMeRNKI5P8UiYupA5lP1FQXrzf0jHJgQX6ukQe aDk7bs9XTqYwvS0PesXYGivS0pJXrULxyF5w7sJ05jqnsa9C9XU/twxCUZAk0t+Zr1Tt RkbBQu9wYgA4wzy+frLEFTsxCdXE5d63FRlWSfsf7J1V4Ivxk0oY4lNi1SjavRYtbOQi SEMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=D+Bv31+p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id n3-20020a632703000000b005b99bfe3301si133147pgn.462.2023.12.07.10.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 10:51:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=D+Bv31+p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id F4012805A5E4; Thu, 7 Dec 2023 10:51:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233077AbjLGSuy (ORCPT + 99 others); Thu, 7 Dec 2023 13:50:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443743AbjLGSum (ORCPT ); Thu, 7 Dec 2023 13:50:42 -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 7B37F121; Thu, 7 Dec 2023 10:50:46 -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=SC4n/zXNUUfBAekQk0GSBXQG99rCFLSursm1c12jHB8=; b=D+Bv31+pmR2HKYSu9WWo8G+iKO Q+ym0IM0v5Np/DlRoQZzGADL3Mez59xLnfhj4GN9u8DEOA1ciWeqWxXwq08tv6sNCdJSAsITPtpWR ZggnqmzDkQGBLm9VnQiruV9Two2tFI4Bq6Vc+YTJkndgr5rwuCzQBdaeXq0gZOqgdsIqfVBbt8cxG vJRooJkXsYvWwjbQDWZ48Pt7V0ACG/eauYgwUBSKC9zcbSrI/cwU4jOYSUPfIH7HavLv3FBaJ5BQW YdPOpIMsrJuYZQgN1q/y5DaHHaA0mb1NnzLLDnLwE/ShkalxEWKfvoVLnCLMummC/R5BuQejHTHum 4IFd2MrQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:38272) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rBJSJ-0001YV-2i; Thu, 07 Dec 2023 18:50:40 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rBJSK-0003xn-Lc; Thu, 07 Dec 2023 18:50:40 +0000 Date: Thu, 7 Dec 2023 18:50:40 +0000 From: "Russell King (Oracle)" To: Florian Fainelli Cc: Justin Chen , Andrew Lunn , Doug Berger , netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , open list Subject: Re: [PATCH] net: phy: Only resume phy if it is suspended Message-ID: References: <20231205234229.274601-1-justin.chen@broadcom.com> <7e3208aa-3adf-47ec-9e95-3c88a121e8a3@lunn.ch> <55a08719-cd18-4a01-9a2a-0115065c06a6@broadcom.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=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 10:51:24 -0800 (PST) On Thu, Dec 07, 2023 at 09:56:01AM -0800, Florian Fainelli wrote: > Hi Andrew, > > So we discussed with Justin and Doug about this yesterday and the main > reason for the phy_resume() ... MAC initialization ... phy_start() pattern > has to do with external RGMII PHYs and the clocking dependency between the > MAC and the PHY on the RX path. And also a tiny bit of cargo culting, but > shhh. > > When the external RGMII PHYs are suspended they will stop providing a RXC > back to the Ethernet MAC and our Ethernet MAC like a lot of designs out > there require the RXC in order to be functional and complete its reset > procedure correctly (you would think there would be a way to mux in a > different clock, but that does not appear to be the case). If we reset the > UniMAC block without a RXC we will typically see duplicate packets being > received, or absurdly long round trip times as soon as we try to use the RX > path. This issue keeps appearing, and I think phylib ought to be doing more to support it, rather than ethernet drivers having to play fancy games. If one recalls stmmac, that has similar issues - it needs the RXC from the PHY to reset properly. I did propose that we have: +#define PHY_F_RXC_ALWAYS_ON BIT(30) that can be passed to phy_attach_direct()'s flags, which phylib drivers can then act upon to e.g. in the case of at803x, disable their hibernation mode which stops the RXC when the system isn't suspended. (AT803x Hibernation mode is enabled by default and the PHY automatically enters it when the link is down.) Maybe this flag should be used to determine the resume behaviour, e.g. to ensure that the RXC is re-enabled early without the MAC driver needing to be involved? WoL is a different problem - that depends whether the PHY is itself doing WoL independently from the MAC, or whether the MAC is involved. If the MAC is involved, then clearly the MII link between the PHY and MAC needs to be maintained while the system is in low power mode, which is an entirely different issue from the RXC being present while the MAC is being resumed. Maybe PHY_F_RXC_ALWAYS_ON is a bad name, as I intended it to only refer to while the system is running, not while in low power mode. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!