Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp230236rdb; Thu, 19 Oct 2023 02:49:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjz1EuRoPzmcI6stMQTH29b+M5USJV86eFbNRQar40UY4MS60nFz+7F8VwXarfXKX0N36O X-Received: by 2002:a17:902:f550:b0:1c5:ff18:98af with SMTP id h16-20020a170902f55000b001c5ff1898afmr2038710plf.4.1697708974790; Thu, 19 Oct 2023 02:49:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697708974; cv=none; d=google.com; s=arc-20160816; b=KxhZApRRbtSog/+zmkqnIBYigYf4h4RCWjaf/JXHv3hSxExy2xKHTk4Wl+VXrDInOu qVKUYzrW9Di+ow70xBdvR31egZDdSsTpfwXK+ICejRZrxTVeEeAwQ8dz0gbLiedfyFcX 49jm1AIp6jCHGf3c3QQ70Pp/RFHefuPWr5c3H69/LrY1qWeFZ6n7hKjHLgCD42ChyGa0 zNaZPeg+HIscHTzs9CaGcsEc+eA8Tz1yQhmmSFIqXZDCv7mobaa3fLe0aqfjO2BhAfGH DOMmF650VJzMPpq1kE9VhfNmPUEhIXz2jOMQzGOBLEjDo2wQxmCW6CdIwFT2UT5Uczgy CMcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qpF8KClNXxkzLlXVOZctDVyKn0c9iPcIIyzhXpT+IE0=; fh=FYI/dsdmJc8fqkfj9G51PkwdeVP/TnLFLpJDQhZeFyc=; b=uYRdYx/+Zcz92F9fZmrmmM7XjxQ6f4doC9KVMj26nJaEAlYqODJD+K4sP6ruh9h/Ux DQD5b6eUGgfhDKds3/Of/47y18hzopt9Hg7iR0En1dRyYHtv8o0gtok9rAnr2wvAXaIu BN/lmAOP4BerKY6TKDssidB/Zkdb5ZcH7/43aaYpLSDhT33FuaaW9/q9n5k9ztz6Eejf VQN9FKdL5NlBTvWLPlxZTOE95lfnzattf39HQBjrSNEMX4ZvatN1rS50E4A2pIPMKwig IxaoWrcooTIS1TBhSl8g0ueNaKe0rowgYRcormB6Ioydc+9ST3Z5OsRZMbrbhnbicZr8 NiJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y18-20020a17090322d200b001c9daca280esi1943313plg.235.2023.10.19.02.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 02:49:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DDD9C8073DDB; Thu, 19 Oct 2023 02:49:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345017AbjJSJtW (ORCPT + 99 others); Thu, 19 Oct 2023 05:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233009AbjJSJtT (ORCPT ); Thu, 19 Oct 2023 05:49:19 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF5E184 for ; Thu, 19 Oct 2023 02:49:17 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qtPeK-0000PU-NG; Thu, 19 Oct 2023 11:49:04 +0200 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtPeI-002lD7-FX; Thu, 19 Oct 2023 11:49:02 +0200 Received: from ore by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qtPeI-00FFi4-Cl; Thu, 19 Oct 2023 11:49:02 +0200 Date: Thu, 19 Oct 2023 11:49:02 +0200 From: Oleksij Rempel To: Vladimir Oltean Cc: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Russell King , netdev@vger.kernel.org, Alexander Stein Subject: Re: [PATCH net-next v2 3/3] net: phy: micrel: Fix forced link mode for KSZ886X switches Message-ID: <20231019094902.GB3632494@pengutronix.de> References: <20231012065502.2928220-1-o.rempel@pengutronix.de> <20231012065502.2928220-1-o.rempel@pengutronix.de> <20231012065502.2928220-4-o.rempel@pengutronix.de> <20231012065502.2928220-4-o.rempel@pengutronix.de> <20231013122646.bjiy6soo3pdquk53@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231013122646.bjiy6soo3pdquk53@skbuf> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Thu, 19 Oct 2023 02:49:32 -0700 (PDT) Hi Vladimir, On Fri, Oct 13, 2023 at 03:26:46PM +0300, Vladimir Oltean wrote: > Hi Oleksij, > > On Thu, Oct 12, 2023 at 08:55:02AM +0200, Oleksij Rempel wrote: > > Address a link speed detection issue in KSZ886X PHY driver when in > > forced link mode. Previously, link partners like "ASIX AX88772B" > > with KSZ8873 could fall back to 10Mbit instead of configured 100Mbit. > > > > The issue arises as KSZ886X PHY continues sending Fast Link Pulses (FLPs) > > even with autonegotiation off, misleading link partners in autoneg mode, > > leading to incorrect link speed detection. > > > > Now, when autonegotiation is disabled, the driver sets the link state > > forcefully using KSZ886X_CTRL_FORCE_LINK bit. This action, beyond just > > disabling autonegotiation, makes the PHY state more reliably detected by > > link partners using parallel detection, thus fixing the link speed > > misconfiguration. > > > > With autonegotiation enabled, link state is not forced, allowing proper > > autonegotiation process participation. > > > > Signed-off-by: Oleksij Rempel > > --- > > Have you considered denying "ethtool -s swpN autoneg off" in "net.git" > (considering that it doesn't work properly), and re-enabling it in > "net-next.git"? Yes, but for ksz8 task I don't have budget to go this way. > > drivers/net/phy/micrel.c | 32 +++++++++++++++++++++++++++++--- > > 1 file changed, 29 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c > > index 927d3d54658e..599ebf54fafe 100644 > > --- a/drivers/net/phy/micrel.c > > +++ b/drivers/net/phy/micrel.c > > @@ -1729,9 +1729,35 @@ static int ksz886x_config_aneg(struct phy_device *phydev) > > { > > int ret; > > > > - ret = genphy_config_aneg(phydev); > > - if (ret) > > - return ret; > > + if (phydev->autoneg != AUTONEG_ENABLE) { > > + ret = genphy_setup_forced(phydev); > > + if (ret) > > + return ret; > > __genphy_config_aneg() will call genphy_setup_forced() as appropriate, > and additionally it will resync the master-slave resolution to a forced > value, if needed. So I think it's better to call genphy_config_aneg() > from the common code path, and just use the "if (phydev->autoneg)" test > to keep the vendor-specific register in sync with the autoneg setting. ack. Will update it. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |