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 2FCF5C2BD09 for ; Fri, 28 Jun 2024 22:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id: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-Owner; bh=FkeOeWfmA8N6WfXP0KBtOcijRi04NyPUZ7Dnot/6j3o=; b=3s6WxOIFmmf06w4Jfr5cMoXaiX hnHmIHZcAbfWF069vOV0PXXIQ2udq7A23btSpXQwYL4aimLdL6VDV1jxeFM7BBIMMDjhHQG0rajs3 PzPQBjoQH107fiVu/hJoEkCNMH6Mfw9J9v2R6U2qgIQHOqR5nvYSFVlBt9CAAP/qVyTOu5IU9D6eV Xjm4hmaPkwA1ZUpulHgKaybOb8SdZmpxQVehAld4BtUwOZpC6Vej8HJ1lkkI/BvzrmUOeB+7TSfUX sANWmu8fFFc1LM2ejxTlbo+gy/5XKBU151HNYZ5XMaYMJ8OnXr0i57LUGp7NQ+U+OPAu6KGI8Icfz 5RE6BKvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNJuK-0000000F9px-3Llq; Fri, 28 Jun 2024 22:17:28 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNJuB-0000000F9od-2DAP for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 22:17:21 +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=FkeOeWfmA8N6WfXP0KBtOcijRi04NyPUZ7Dnot/6j3o=; b=hsjFH66D8g9+9dSOKNWklH9uAF YHXMKCxnAGWqimirw253jOOwZbhGZXu4SAPG1j2GtfIL4VYas6eNgesM7eayLd5ByzrFcpar7cCm/ SO9HxlYCH2wwr22sMmdQ57Vy7pbmrtjnm8aBQGrGyAyvD4dlfxmYXdSl7mSE36TNOlGZuPaZfyBJc IbKx8njf8xWafxyFQpLbJwEO2MzbKK/jTiCi6cNiRb5y6MHOnKQcFoKRrPDQhLAzTVbdYOKGHvtUD JaR+QF3Km+/aElUekrbXOkSB70v0tV3ji2Svk0JGWK/rIVCdkzCOFq89rzLd1wCHGgTM9MyN44lWv zy2KYpDQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:43110) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sNJtl-0007Yz-2e; Fri, 28 Jun 2024 23:16:53 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sNJtl-0006qf-Rf; Fri, 28 Jun 2024 23:16:53 +0100 Date: Fri, 28 Jun 2024 23:16:53 +0100 From: "Russell King (Oracle)" To: Sagar Cheluvegowda Cc: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bhupesh Sharma , kernel@quicinc.com, Andrew Halaney , Andrew Lunn , linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v2 3/3] net: stmmac: Bring down the clocks to lower frequencies when mac link goes down Message-ID: References: <20240625-icc_bw_voting_from_ethqos-v2-0-eaa7cf9060f0@quicinc.com> <20240625-icc_bw_voting_from_ethqos-v2-3-eaa7cf9060f0@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240625-icc_bw_voting_from_ethqos-v2-3-eaa7cf9060f0@quicinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_151719_588810_FA8FFBFC X-CRM114-Status: GOOD ( 20.39 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 25, 2024 at 04:49:30PM -0700, Sagar Cheluvegowda wrote: > When mac link goes down we don't need to mainitain the clocks to operate > at higher frequencies, as an optimized solution to save power when > the link goes down we are trying to bring down the clocks to the > frequencies corresponding to the lowest speed possible. I thought I had already commented on a similar patch, but I can't find anything in my mailboxes to suggest I had. > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index ec7c61ee44d4..f0166f0bc25f 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -996,6 +996,9 @@ static void stmmac_mac_link_down(struct phylink_config *config, > { > struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); > > + if (priv->plat->fix_mac_speed) > + priv->plat->fix_mac_speed(priv->plat->bsp_priv, SPEED_10, mode); > + > stmmac_mac_set(priv, priv->ioaddr, false); > priv->eee_active = false; > priv->tx_lpi_enabled = false; > @@ -1004,6 +1007,11 @@ static void stmmac_mac_link_down(struct phylink_config *config, > > if (priv->dma_cap.fpesel) > stmmac_fpe_link_state_handle(priv, false); > + > + stmmac_set_icc_bw(priv, SPEED_10); > + > + if (priv->plat->fix_mac_speed) > + priv->plat->fix_mac_speed(priv->plat->bsp_priv, SPEED_10, mode); Two things here: 1) Why do we need to call fix_mac_speed() at the start and end of this stmmac_mac_link_down()? 2) What if the MAC doesn't support 10M operation? For example, dwxgmac2 and dwxlgmac2 do not support anything below 1G. It feels that this is storing up a problem for the future, where a platform that uses e.g. xlgmac2 also implements fix_mac_speed() and then gets a surprise when it's called with SPEED_10. Personally, I don't like "fix_mac_speed", and I don't like it even more with this change. I would prefer to see link_up/link_down style operations so that platforms can do whatever they need to on those events, rather than being told what to do by a single call that may look identical irrespective of whether the link came up or went down. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!