Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp431659rwd; Wed, 7 Jun 2023 01:49:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/EfEZkV4mCzmFjoxHjLz425Qz4/NVjw3d0ctJtH0c7Jk6hWNlV9RiD9rlZQ9A7gySmAPf X-Received: by 2002:a17:902:8bc1:b0:1af:f4f5:6fae with SMTP id r1-20020a1709028bc100b001aff4f56faemr4064931plo.54.1686127791091; Wed, 07 Jun 2023 01:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686127791; cv=none; d=google.com; s=arc-20160816; b=cAEk+6tHNARwKmw0bjiyGg8TGtqF6gkiYU5BVpmBtNIDCgUExLIxUNAOGD4HIZ9WRV CMl77PVbN85MZ263z8BA/B4s2G20pWWweuVyU4K8WEa9v6zJ48ufyEqu8Fb+brgXlaVn lDT1YZ1GAK1B6gOr54DTh5q5+pyNP3OVAb3ECmxVPPHDNCPF/pCCIFbtih/PUBUVYjOj sHskKV+/0dZZQZR9RaMGCzXfl55ZrR6LrkcmhkDyBuhX09oJfqYbP3PL1kHOpNM+w64F eA2bajwa0XQFcfHP7LytvB8epBhrd+kVvKzqMic05ZNwbfl9VkoMCWwBkmeuLtsz0X5T g98A== 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=s4MbmFqXBHLby6hrFobQYZmOb5HK3o02YxuG4peZWhY=; b=DH95HmblmHYbjFmHpXCdYFMHtF0FTmZFSVlOrA7Doon2vYtUzx8oOJ4RKcElqjcGlS uWdrY69IScny5eZlwvBM0EWlXsYJ3dQbEERCf30XwSzsuLq+sdf4NsB9cEo/GQG0PyNp X1j3e1SHikiakxCEbgStYQtt20TXlBJbOrlmVAhWFTfi9VqVOyR5W959hVQeH1t7wazR iWmZ6eF6w17e11zqC3vNT0Gf3v6ttMD+3F5yZJMBdi0mP3CN9ciQpdPPGoRUTv2LB1Jt I/rIlsPnVycItcDj2OSQ7ifCy1/V1ix97q/osyubl13BWAfGoydpwg8gq/Bqw9hYQHnQ BqKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=CPqPJkSG; 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 l14-20020a17090ac58e00b00246a5991cc6si801330pjt.162.2023.06.07.01.49.38; Wed, 07 Jun 2023 01:49:51 -0700 (PDT) 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=CPqPJkSG; 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 S239081AbjFGIqp (ORCPT + 99 others); Wed, 7 Jun 2023 04:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238568AbjFGIqn (ORCPT ); Wed, 7 Jun 2023 04:46:43 -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 E6BD011F; Wed, 7 Jun 2023 01:46:41 -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=s4MbmFqXBHLby6hrFobQYZmOb5HK3o02YxuG4peZWhY=; b=CPqPJkSGuRreFI6Et5QWmfEthB tRdKjHpMPY3b5gynsRsH+yU/Gi32jVoqT7nnWi0ZeN/Wq32mkt6AoEFcaGrYLOG/Ai1+l52W0PGiB po1w6XmNaz81C8jSerbkoqTEA1fmv6VyBuaj7gzoa5KGecNMVgywyOywz6L7//AJWdnHQ14GPJgrj beYqlZ2FN1i33HHkd/j4UnnpYCJqz5bCRaEh2pZz8mUitK4H4+5POZVv+wTds2sgt+/Lp2GYVtJ7K Yuu5LYz4ddDooT0FJGsVwFMWISbbVruuyKFauGz/ImkKImJNAWaVGOwYwCKzrzFn+X7ThrrLvQKC2 fNF5oR+A==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:38184) 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 1q6ooR-00074x-2r; Wed, 07 Jun 2023 09:46:39 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q6ooO-00084c-Q3; Wed, 07 Jun 2023 09:46:36 +0100 Date: Wed, 7 Jun 2023 09:46:36 +0100 From: "Russell King (Oracle)" To: Florian Fainelli Cc: netdev@vger.kernel.org, o.rempel@pengutronix.de, andrew@lunn.ch, hkallweit1@gmail.com, Doug Berger , Florian Fainelli , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , open list Subject: Re: [PATCH net] net: bcmgenet: Fix EEE implementation Message-ID: References: <20230606214348.2408018-1-florian.fainelli@broadcom.com> <1074c668-3e75-dff7-9d23-d43fbeb98d84@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1074c668-3e75-dff7-9d23-d43fbeb98d84@broadcom.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Tue, Jun 06, 2023 at 03:16:03PM -0700, Florian Fainelli wrote: > On 6/6/23 15:02, Russell King (Oracle) wrote: > > On Tue, Jun 06, 2023 at 02:43:47PM -0700, Florian Fainelli wrote: > > > We had a number of short comings: > > > > > > - EEE must be re-evaluated whenever the state machine detects a link > > > change as wight be switching from a link partner with EEE > > > enabled/disabled > > > > > > - tx_lpi_enabled controls whether EEE should be enabled/disabled for the > > > transmit path, which applies to the TBUF block > > > > > > - We do not need to forcibly enable EEE upon system resume, as the PHY > > > state machine will trigger a link event that will do that, too > > > > > > Fixes: 6ef398ea60d9 ("net: bcmgenet: add EEE support") > > > Signed-off-by: Florian Fainelli > > > --- > > > netdev maintainers, please do not apply without Andrew, Russell and > > > Oleksij reviewing first since this relates to the on-going EEE rework > > > from Andrew. > > > > Hi Florian, > > > > Please could you include some information on the UMAC_EEE_CTRL EEE_EN > > bit - is this like the main switch for EEE which needs to be set > > along with the bits in the tbuf register for the transmit side to > > signal LPI? > > EEE_EN is described as: > > If set, the TX LPI policy control engine is enabled and the MAC inserts > LPI_idle codes if the link is idle. The rx_lpi_detect assertion is > independent of this configuration. > > in the RBUF, EEE_EN is described as: > > 1: to enable Energy Efficient feature between Unimac and PHY for Rx Path > > and in the TBUF, EEE_EN is described as: > > 1: to enable Energy Efficient feature between Unimac and PHY for Tx Path > > The documentation is unfortunately scare about how these two signals connect > :/ Thanks for the clarification. Squaring this with my understanding of EEE, the transmit side makes sense. LPI on the transmit side is only asserted only when EEE_EN and TBUF_EEE_EN are both set, so this is the behaviour we want. If we were evaluating this in software, my understanding is it would be: if (eee_enabled && eee_active && tx_lpi_enabled) enable LPI generation at MAC; else disable LPI generation at MAC; and the code here treats eee_enabled && eee_active as the "enabled" flag controlling EEE_EN, and tx_lpi_enabled controls TBUF_EEE_EN. The hardware effectively does the last && operation for us. So this all seems fine. On the receive side, if the link partner successfully negotiates EEE, then it can assert LPI, and the local end will see that assertion (hence, rx_lpi_detect may become true.) If the transmit side doesn't generate LPI, then this won't have any effect other than maybe setting status bits, so I don't see that setting RBUF_EEE_EN when eee_enabled && eee_active would be wrong. Moving the phy_init_eee() (as it currently stands) into the adjust_link path is definitely the right thing, since it provides the resolution of the negotiated EEE state. So, all round, I think your patch makes complete sense as far as the logic goes. Reviewed-by: Russell King (Oracle) However, one thing I will ask is whether the hardware has any configuration of the various timers for EEE operation, and if it does, are they dependent on the negotiated speed of the interface? In Marvell's neta and pp2 drivers, the timers scale with link speed and thus need reprogramming accordingly. In any case, 802.3 specifies different timer settings depending on link speed and media type. Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!