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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C786C6379F for ; Fri, 17 Feb 2023 13:58:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbjBQN6d (ORCPT ); Fri, 17 Feb 2023 08:58:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbjBQN6c (ORCPT ); Fri, 17 Feb 2023 08:58:32 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D8D5E592 for ; Fri, 17 Feb 2023 05:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=Ou5lkUF84+yOvPcv/TkEql/meqor8YmT0zAewjT9NQA=; b=oH2gbAwryMNtaqmPqVTa70l524 SwAORctGTcWkOos6kM4T5dQ18yOU8yWtNK4X9IiwwCUSXknjzIlZ3Hr9zCs+qwaEgznt3D1FO1Rix zTAMI1OJFlx+dPMywOnavp9+M6hjhEllT4pzwAybR4ISaA23PHYkXYQCrJvI5dSOMxn8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pT1Fo-005Hxg-9q; Fri, 17 Feb 2023 14:58:24 +0100 Date: Fri, 17 Feb 2023 14:58:24 +0100 From: Andrew Lunn To: Oleksij Rempel Cc: netdev , Florian Fainelli , Vladimir Oltean , Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , AngeloGioacchino Del Regno , Doug Berger , Broadcom internal kernel review list , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , UNGLinuxDriver@microchip.com, Byungho An , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Heiner Kallweit , Russell King , Woojung Huh , Oleksij Rempel Subject: Re: [PATCH RFC 08/18] net: FEC: Fixup EEE Message-ID: References: <20230217034230.1249661-1-andrew@lunn.ch> <20230217034230.1249661-9-andrew@lunn.ch> <20230217081943.GA9065@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230217081943.GA9065@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > @@ -1997,6 +1988,7 @@ static void fec_enet_adjust_link(struct net_device *ndev) > > netif_tx_unlock_bh(ndev); > > napi_enable(&fep->napi); > > } > > + fec_enet_eee_mode_set(ndev, phy_dev->eee_active); > > Most of iMX variants do not support EEE. It should be something like this: > if (fep->quirks & FEC_QUIRK_HAS_EEE) > fec_enet_eee_mode_set(ndev, phy_dev->eee_active); Yes, i missed that. Thanks. > > @@ -3131,15 +3120,7 @@ fec_enet_set_eee(struct net_device *ndev, struct ethtool_eee *edata) > > return -ENETDOWN; > > > > p->tx_lpi_timer = edata->tx_lpi_timer; > > - > > - if (!edata->eee_enabled || !edata->tx_lpi_enabled || > > - !edata->tx_lpi_timer) > > - ret = fec_enet_eee_mode_set(ndev, false); > > - else > > - ret = fec_enet_eee_mode_set(ndev, true); > > - > > - if (ret) > > - return ret; > > + p->tx_lpi_enabled = edata->tx_lpi_enabled; > > Hm.. this change have effect only after link restart. Should we do > something like this? > > if (phydev->link) > fec_enet_eee_mode_set(ndev, phydev->eee_active); > > or, execute phy_ethtool_set_eee() first and some how detect if link > changed? Or restart link by phylib on every change? The whole startup sequence needs looking at, and ties in with the phy_supports_eee() call we need to add. Given that EEE is broken with most MAC drivers, i thought we could do that in a follow up patch series. As Russell says, we want to avoid multiple auto-neg cycles. Ideally we want phy_supports_eee() to be called before phy_start() so that EEE advertisement is set correctly for the first auto-neg. What is missing from many MAC drivers is a default value from the LPI timer. It seems like the need eee_set() has to be called with a value, or they are relying on hardware reset values. Maybe we need to define a default? We also need to discuss policy of if EEE should be enabled by default for those systems which support it. As you have pointed out, it can effect PTP quality. Andrew