Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4576295rwd; Tue, 30 May 2023 07:16:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ruIUvdUo2GVSl6n05VDivsqos+dsYfHANtYWen+4XCGWzyJi2wKEZI+Mp4LIvYY/1SZDI X-Received: by 2002:a17:90a:e7cc:b0:255:38ed:9dcd with SMTP id kb12-20020a17090ae7cc00b0025538ed9dcdmr11844413pjb.0.1685456178920; Tue, 30 May 2023 07:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685456178; cv=none; d=google.com; s=arc-20160816; b=gQo8EykSChtK0lIpMvNhXImPfSVNKj+nhSmcB5tDFjmPvCfEU/nQOhvOv2hAKoHo7f H4ZXEiOFUfCPeBnZgpyQCi9K/NCymdpA7jRk5EodXhGkURkFpR5Yhv2Dq9VEKDtCZSwb 7G/W6YLnrLhJurs+jZpCiheyRFPMp8Af6uhvP11kZ72wP6WBx75Qb5OpmwJc8UEE62mX ZD/mmtkNRVH8BPjdQ65AMDKAHx7Q0rz0lEt0t9oLdPRxuMpNGxt1n3i7MKo8S6h+QhoD qzDHVp1KTkGw5+OO9ndE4bKJw36momQzUQQzisepdcQyaYAfiW1ummNBZ2VrGH9OPOEe cANQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:organization:references:in-reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=DxEeEwLI+riVU0nN82Dofb9kzcwsJO6WvuTfNK7QJ+I=; b=m5XNkXb1jWilvBOCH6m0fOejQSSJdb94R+EbZ/fW1rSk9knQQDRTFUXdifUN5GXE4k L2x/z+tn33slDCXak50XGh6j8q7nT5IDPCxswB0YuPmdLK/64/euj53b3sItDDB8Nyvl RsOg4wq8omAx2vr6c+/jRgKxE+YC4gNajx72TDqD3Z195qTKBtmhVUqLeYXIbFh6dSrw nPf8V6dKb27GWmBLy/EGjo8xF64eQCJu5w0SliB0IhXyu3UaazB1SKi28tudnWsEZi6M oUwBH4C1PEaAxTBo6vg455aKTDfMnIn+00vd2fuZZycjaIgY38x8aW0RyqzhFDAsoCJM goJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=VOtG3IcY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a17090a7e0300b00250ce1755e9si7926344pjl.14.2023.05.30.07.16.05; Tue, 30 May 2023 07:16:18 -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=pass header.i=@denx.de header.s=phobos-20191101 header.b=VOtG3IcY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232923AbjE3OH7 (ORCPT + 99 others); Tue, 30 May 2023 10:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232910AbjE3OH6 (ORCPT ); Tue, 30 May 2023 10:07:58 -0400 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34719E8; Tue, 30 May 2023 07:07:53 -0700 (PDT) Received: from wsk (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 8732785F52; Tue, 30 May 2023 16:07:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1685455671; bh=DxEeEwLI+riVU0nN82Dofb9kzcwsJO6WvuTfNK7QJ+I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VOtG3IcY80mysNE6AwRVh++cAWX+S/rFMGZRC34W6E3L1bh9tWOmtsf+gFtXgdp7r 7WqATGBTUlS+bp/V4WLdYzuWulSIaWCrrW4KCj1QnfwOnxcLETkIsY4nCqp1PNZz6v EEMq8awIyqBr8JLt9Nm8L69jcU4gPDCpH5x9oWyTpk0QRITr42MGPFOVcqfuaDxuW4 Dlmd73wiZqTIML2z8R7e+YHhWc+eLDi1adn8alLL9++GsC5TcMDmpJKJhwsUgZnIR8 4XT2/5y9z5a7y/M6QcETrsdp473FxHyHa3PqGg0TwrpBx7oYX4MBRl/yciz3spESoD 9de0XsRxMu7Fg== Date: Tue, 30 May 2023 16:07:43 +0200 From: Lukasz Majewski To: "Russell King (Oracle)" Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] net: dsa: slave: Advertise correct EEE capabilities at slave PHY setup Message-ID: <20230530160743.2c93a388@wsk> In-Reply-To: References: <20230530122621.2142192-1-lukma@denx.de> Organization: denx.de X-Mailer: Claws Mail 3.19.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/gukjY9rUgd.rLL7bPFTqt74"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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_PASS,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 --Sig_/gukjY9rUgd.rLL7bPFTqt74 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Russell, > On Tue, May 30, 2023 at 02:26:21PM +0200, Lukasz Majewski wrote: > > One can disable in device tree advertising of EEE capabilities of > > PHY when 'eee-broken-100tx' property is present in DTS. > >=20 > > With DSA switch it also may happen that one would need to disable > > EEE due to some network issues. > >=20 > > Corresponding switch DTS description: > >=20 > > switch@0 { > > ports { > > port@0 { > > reg =3D <0>; > > label =3D "lan1"; > > phy-handle =3D <&switchphy0>; > > }; > > } > > mdio { > > switchphy0: switchphy@0 { > > reg =3D <0>; > > eee-broken-100tx; > > }; > > }; > >=20 > > This patch adjusts the content of MDIO_AN_EEE_ADV in MDIO_MMD_AN > > "device" so the phydev->eee_broken_modes are taken into account > > from the start of the slave PHYs. =20 >=20 > This should be handled by phylib today in recent kernels without the > need for any patch (as I describe below, because the config_aneg PHY > method should be programming it.) Are you seeing a problem with it > in 6.4-rc? Unfortunately, for this project I use LTS 5.15.z kernel. My impression is that the mv88e6xxx driver is not handling EEE setup during initialization (even with v6.4-rc). I've tried to replace genphy_config_eee_advert() with phy_init_eee, but it lacks the part to program PCS advertise registers. >=20 > > As a result the 'ethtool --show-eee lan1' shows that EEE is not > > supported from the outset. > >=20 > > Questions: > >=20 > > - Is the genphy_config_eee_advert() appropriate to be used here? > > As I found this issue on 5.15 kernel, it looks like mainline now > > uses PHY features for handle EEE (but the aforementioned function > > is still present in newest mainline - v6.4-rc1). > >=20 > > - I've also observed strange behaviour for EEE capability register: > > Why the value in MDIO_MMD_PCS device; reg MDIO_PCS_EEE_ABLE is > > somewhat "volatile" - in a sense that when I use: > > ethtool --set-eee lan2 eee off > >=20 > > It is cleared by PHY itself to 0x0 (from 0x2) and turning it on > > again is not working. > >=20 > > Is this expected? Or am I missing something? =20 >=20 > No - this register is supposed to report the capabilities of the PHY, > and bits 1..15 should be read-only, and as they report the > capabilities they should be fixed. Writing to bit 1 of this register > will therefore be ignored. It sounds like your PHY has some odd > behaviour - maybe someone misinterpreted 802.3 45.2.3.9? >=20 It is a good question. Or maybe after EEE disabling I read some wrong data (however, up till this moment bit offsets and values seems reasonable). > > Signed-off-by: Lukasz Majewski > > --- > > net/dsa/slave.c | 1 + > > 1 file changed, 1 insertion(+) > >=20 > > diff --git a/net/dsa/slave.c b/net/dsa/slave.c > > index 353d8fff3166..712923c7d4e2 100644 > > --- a/net/dsa/slave.c > > +++ b/net/dsa/slave.c > > @@ -2247,6 +2247,7 @@ static int dsa_slave_phy_setup(struct > > net_device *slave_dev) phylink_destroy(dp->pl); > > } > > =20 > > + genphy_config_eee_advert(slave_dev->phydev); =20 >=20 > No network driver (which includes DSA) should be calling any function > starting genphy_*. These functions are purely for phylib or phy > drivers to use, and no one else. As stated before, it looks like some PHY "update" in respect of EEE is not done when DSA framework creates phydevs for slave ports. >=20 > genphy_config_eee_advert() is a deprecated function (see commit > 5827b168125d ("net: phy: c45: migrate to genphy_c45_write_eee_adv()") > and thus should not be used. Ok. >=20 > genphy_c45_write_eee_adv() is called by > genphy_c45_an_config_eee_aneg() which will in turn be called by > genphy_config_aneg() for a clause 22 PHY, or by > genphy_c45_an_config_aneg() for a clause 45 PHY. These will write the > EEE advertisement mask to the PHY's AN MMD. >=20 Ok. > So, EEE should be handled by phylib according to the firmware > settings.=20 I also would expect, that phy core code parses DTS properties and then phydev->eee_broken_mode is used to mask EEE advertisement during PHY initialization and startup. > The only thing that network drivers that use phylib have to > deal with is setting their hardware for the LPI timeout and > enabling/disabling the timeout as necessary. >=20 Yes. I do agree. Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/gukjY9rUgd.rLL7bPFTqt74 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAmR2Ay8ACgkQAR8vZIA0 zr0yNgf+MSmXQfSuHrYUlnCE2+UdHZnZS1IgUyT0DBnm7WkVggfh5/jWjgtlmkx7 glfhaJYQRXUR9OKDnagJdpPzw4yrkX1S3N+5bAkqnFWHEO7idNnY9pgd7OJXg84r 0p96obyfkIxpSjQXd1oBWFlrJ2rJjvMEougmQ9ANaZJajVmV80K1u3qgIiSDc0Va 0dB/oAmGSi6JRgcrs3EARuCPL3Gt0KRo2Z4OllbhcqDZ6+bTShYffqfnNuyhG83E LRtpbgoLWqJsLTID4m1rfuo0hsrc06ewOuCeXdEDVO5P5Hm+f6VxrgxBpH6ymBm2 h/JuCiarOt2WxEO2UZnDawsCG20L5g== =+NgL -----END PGP SIGNATURE----- --Sig_/gukjY9rUgd.rLL7bPFTqt74--